blob: d4af02eb896ebe812b09d6a37c4e88683c7a2647 [file] [log] [blame]
// Copyright 2014 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "cobalt/base/init_cobalt.h"
#include <string>
#include "base/at_exit.h"
#include "base/command_line.h"
#include "base/i18n/icu_util.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/path_service.h"
#include "cobalt/base/cobalt_paths.h"
#include "cobalt/base/path_provider.h"
namespace cobalt {
namespace {
base::LazyInstance<std::string> s_initial_deep_link = LAZY_INSTANCE_INITIALIZER;
} // namespace
void InitCobalt(int argc, char* argv[], const char* link) {
CommandLine::Init(argc, argv);
if (link) {
s_initial_deep_link.Get() = link;
}
bool icu_initialized = icu_util::Initialize();
LOG_IF(ERROR, !icu_initialized) << "ICU initialization failed.";
// Register a path provider for Cobalt-specific paths.
PathService::RegisterProvider(&PathProvider, paths::PATH_COBALT_START,
paths::PATH_COBALT_END);
}
const char* GetInitialDeepLink() { return s_initial_deep_link.Get().c_str(); }
} // namespace cobalt