blob: 6806d29410eb73a16f9834eb9ac865fab85e8d6e [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