Allow the externalfile scheme to be whitelisted as an allowed scheme for component...
[chromium-blink-merge.git] / ui / keyboard / keyboard.cc
blob2d4de139ddcd316a57d6f7ed13dec0494ddfb30c
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ui/keyboard/keyboard.h"
7 #include "base/files/file_path.h"
8 #include "base/path_service.h"
9 #include "ui/base/resource/resource_bundle.h"
10 #include "ui/keyboard/webui/vk_webui_controller.h"
12 namespace keyboard {
14 static bool initialized = false;
16 void ResetKeyboardForTesting() {
17 initialized = false;
20 void InitializeKeyboard() {
21 if (initialized)
22 return;
23 initialized = true;
25 base::FilePath pak_dir;
26 PathService::Get(base::DIR_MODULE, &pak_dir);
27 base::FilePath pak_file = pak_dir.Append(
28 FILE_PATH_LITERAL("keyboard_resources.pak"));
29 ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath(
30 pak_file, ui::SCALE_FACTOR_100P);
33 void InitializeWebUIBindings() {
34 CHECK(initialized);
35 base::FilePath content_resources;
36 DCHECK(PathService::Get(base::DIR_MODULE, &content_resources));
37 content_resources =
38 content_resources.Append(FILE_PATH_LITERAL("content_resources.pak"));
39 ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath(
40 content_resources, ui::SCALE_FACTOR_100P);
42 content::WebUIControllerFactory::RegisterFactory(
43 VKWebUIControllerFactory::GetInstance());
46 } // namespace keyboard