summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authormsw <msw@chromium.org>2016-02-16 18:28:54 -0800
committerCommit bot <commit-bot@chromium.org>2016-02-17 02:30:06 +0000
commitf4bf6631e1ab404d4d6b5e1d753a750847c187d8 (patch)
treefb71edbb669621bd215b8beb6c233bc94630fa70 /ash
parent8f605702765719e2b15c93603b79bd32c7c6b39f (diff)
downloadchromium_src-f4bf6631e1ab404d4d6b5e1d753a750847c187d8.zip
chromium_src-f4bf6631e1ab404d4d6b5e1d753a750847c187d8.tar.gz
chromium_src-f4bf6631e1ab404d4d6b5e1d753a750847c187d8.tar.bz2
Fix ash_shell_with_content and mash_shell resource init.
Load ash's string and resource pak files; not Chrome's. TODO: Support other languages; drop 'test' from pak names. Remove unused ash/shell/content/shell_main_parts.* Remove unused chrome_browser_main_extra_parts_aura.cc include. Fix gn deps to support non-use_ash Win/Linux builds. BUG=584038 TEST=ash_shell_with_content and mash_shell --use-ash-sysui work on Win/Linux regardless of use_ash. R=sky@chromium.org Review URL: https://codereview.chromium.org/1694263004 Cr-Commit-Position: refs/heads/master@{#375763}
Diffstat (limited to 'ash')
-rw-r--r--ash/BUILD.gn6
-rw-r--r--ash/ash.gyp2
-rw-r--r--ash/mus/BUILD.gn14
-rw-r--r--ash/mus/sysui_application.cc25
-rw-r--r--ash/shell/content/client/shell_main_delegate.cc21
-rw-r--r--ash/shell/content/shell_main_parts.cc23
-rw-r--r--ash/shell/content/shell_main_parts.h17
7 files changed, 57 insertions, 51 deletions
diff --git a/ash/BUILD.gn b/ash/BUILD.gn
index a11f7f0..88d917c 100644
--- a/ash/BUILD.gn
+++ b/ash/BUILD.gn
@@ -463,6 +463,12 @@ executable("ash_shell_with_content") {
"//content/public/app:both",
]
+ data_deps = [
+ "//ash/strings:ash_test_strings",
+ "//ash/resources:ash_test_resources_100_percent",
+ "//ash/resources:ash_test_resources_200_percent",
+ ]
+
if (is_win) {
configs -= [ "//build/config/win:console" ]
configs += [ "//build/config/win:windowed" ]
diff --git a/ash/ash.gyp b/ash/ash.gyp
index 5f97917..610d859 100644
--- a/ash/ash.gyp
+++ b/ash/ash.gyp
@@ -802,8 +802,6 @@
'shell/content/client/shell_main_delegate.h',
'shell/content/shell_content_state_impl.cc',
'shell/content/shell_content_state_impl.h',
- 'shell/content/shell_main_parts.cc',
- 'shell/content/shell_main_parts.h',
],
'ash_unittests_sources': [
'accelerators/accelerator_commands_unittest.cc',
diff --git a/ash/mus/BUILD.gn b/ash/mus/BUILD.gn
index 8d21ad2..2a4664f 100644
--- a/ash/mus/BUILD.gn
+++ b/ash/mus/BUILD.gn
@@ -30,6 +30,7 @@ source_set("lib") {
"//components/mus/public/cpp",
"//components/mus/public/interfaces",
"//components/user_manager",
+ "//device/bluetooth",
"//mash/wm/public/interfaces",
"//mojo/common:common_base",
"//mojo/converters/geometry",
@@ -39,6 +40,7 @@ source_set("lib") {
"//skia",
"//ui/aura",
"//ui/events",
+ "//ui/events/devices",
"//ui/gfx",
"//ui/gfx/geometry",
"//ui/keyboard:mojom",
@@ -51,12 +53,14 @@ source_set("lib") {
"//ui/views/mus:for_mojo_application",
]
+ data_deps = [
+ "//ash/strings:ash_test_strings",
+ "//ash/resources:ash_test_resources_100_percent",
+ "//ash/resources:ash_test_resources_200_percent",
+ ]
+
if (is_chromeos) {
- deps += [
- "//chromeos",
- "//device/bluetooth",
- "//ui/events/devices",
- ]
+ deps += [ "//chromeos" ]
}
}
diff --git a/ash/mus/sysui_application.cc b/ash/mus/sysui_application.cc
index 11dd9b7..917788b 100644
--- a/ash/mus/sysui_application.cc
+++ b/ash/mus/sysui_application.cc
@@ -15,6 +15,8 @@
#include "ash/shell_init_params.h"
#include "ash/shell_window_ids.h"
#include "base/bind.h"
+#include "base/files/file_path.h"
+#include "base/path_service.h"
#include "base/threading/sequenced_worker_pool.h"
#include "components/mus/public/cpp/property_type_converters.h"
#include "mash/wm/public/interfaces/container.mojom.h"
@@ -143,8 +145,7 @@ class AshInit {
public:
AshInit() : worker_pool_(new base::SequencedWorkerPool(2, "AshWorkerPool")) {
ui::RegisterPathProvider();
- ui::ResourceBundle::InitSharedInstanceWithLocale(
- "en-US", nullptr, ui::ResourceBundle::LOAD_COMMON_RESOURCES);
+ InitializeResourceBundle();
}
~AshInit() { worker_pool_->Shutdown(); }
@@ -188,6 +189,26 @@ class AshInit {
SetupWallpaper(SkColorSetARGB(255, 0, 255, 0));
}
+ void InitializeResourceBundle() {
+ // Load ash resources and en-US strings; not 'common' (Chrome) resources.
+ // TODO(msw): Do not load 'test' resources (include sys lang; rename paks?).
+ // TODO(msw): Use the ResourceProvider interface to load these pak files.
+ // TODO(msw): Check ResourceBundle::IsScaleFactorSupported; load 300% etc.
+ base::FilePath path;
+ PathService::Get(base::DIR_MODULE, &path);
+ base::FilePath ash_test_strings =
+ path.Append(FILE_PATH_LITERAL("ash_test_strings.pak"));
+ base::FilePath ash_test_resources_100 =
+ path.Append(FILE_PATH_LITERAL("ash_test_resources_100_percent.pak"));
+ base::FilePath ash_test_resources_200 =
+ path.Append(FILE_PATH_LITERAL("ash_test_resources_200_percent.pak"));
+
+ ui::ResourceBundle::InitSharedInstanceWithPakPath(ash_test_strings);
+ ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
+ rb.AddDataPackFromPath(ash_test_resources_100, ui::SCALE_FACTOR_100P);
+ rb.AddDataPackFromPath(ash_test_resources_200, ui::SCALE_FACTOR_200P);
+ }
+
void SetupWallpaper(SkColor color) {
SkBitmap bitmap;
bitmap.allocN32Pixels(16, 16);
diff --git a/ash/shell/content/client/shell_main_delegate.cc b/ash/shell/content/client/shell_main_delegate.cc
index c6e596e..4b4a21d 100644
--- a/ash/shell/content/client/shell_main_delegate.cc
+++ b/ash/shell/content/client/shell_main_delegate.cc
@@ -6,7 +6,10 @@
#include "ash/shell/content/client/shell_content_browser_client.h"
#include "base/command_line.h"
+#include "base/files/file_path.h"
+#include "base/path_service.h"
#include "content/public/common/content_switches.h"
+#include "ui/base/ime/input_method_initializer.h"
#include "ui/base/resource/resource_bundle.h"
namespace ash {
@@ -29,6 +32,7 @@ bool ShellMainDelegate::BasicStartupComplete(int* exit_code) {
void ShellMainDelegate::PreSandboxStartup() {
InitializeResourceBundle();
+ ui::InitializeInputMethodForTesting();
}
content::ContentBrowserClient* ShellMainDelegate::CreateContentBrowserClient() {
@@ -37,8 +41,21 @@ content::ContentBrowserClient* ShellMainDelegate::CreateContentBrowserClient() {
}
void ShellMainDelegate::InitializeResourceBundle() {
- ui::ResourceBundle::InitSharedInstanceWithLocale(
- "en-US", NULL, ui::ResourceBundle::LOAD_COMMON_RESOURCES);
+ // Load ash resources and en-US strings; not 'common' (Chrome) resources.
+ // TODO(msw): Check ResourceBundle::IsScaleFactorSupported; load 300% etc.
+ base::FilePath path;
+ PathService::Get(base::DIR_MODULE, &path);
+ base::FilePath ash_test_strings =
+ path.Append(FILE_PATH_LITERAL("ash_test_strings.pak"));
+ base::FilePath ash_test_resources_100 =
+ path.Append(FILE_PATH_LITERAL("ash_test_resources_100_percent.pak"));
+ base::FilePath ash_test_resources_200 =
+ path.Append(FILE_PATH_LITERAL("ash_test_resources_200_percent.pak"));
+
+ ui::ResourceBundle::InitSharedInstanceWithPakPath(ash_test_strings);
+ ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
+ rb.AddDataPackFromPath(ash_test_resources_100, ui::SCALE_FACTOR_100P);
+ rb.AddDataPackFromPath(ash_test_resources_200, ui::SCALE_FACTOR_200P);
}
} // namespace shell
diff --git a/ash/shell/content/shell_main_parts.cc b/ash/shell/content/shell_main_parts.cc
deleted file mode 100644
index 1a0aad9..0000000
--- a/ash/shell/content/shell_main_parts.cc
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ash/shell/content/shell_main_parts.h"
-
-#include "base/i18n/icu_util.h"
-#include "ui/base/resource/resource_bundle.h"
-#include "ui/base/ui_base_paths.h"
-
-namespace ash {
-namespace shell {
-
-void PreMainMessageLoopStart() {
- ui::RegisterPathProvider();
- base::i18n::InitializeICU();
- // TODO(msw): Load ash and ui resources; not 'common' (Chrome) resources.
- ui::ResourceBundle::InitSharedInstanceWithLocale(
- "en-US", NULL, ui::ResourceBundle::LOAD_COMMON_RESOURCES);
-}
-
-} // namespace ash
-} // namespace shell
diff --git a/ash/shell/content/shell_main_parts.h b/ash/shell/content/shell_main_parts.h
deleted file mode 100644
index 55f1b11f..0000000
--- a/ash/shell/content/shell_main_parts.h
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef ASH_SHELL_CONTENT_SHELL_MAIN_PARTS_H_
-#define ASH_SHELL_CONTENT_SHELL_MAIN_PARTS_H_
-
-namespace ash {
-namespace shell {
-
-// Platform initializations prior to the start of the main message loop.
-void PreMainMessageLoopStart();
-
-} // namespace shell
-} // namespace ash
-
-#endif // ASH_SHELL_CONTENT_SHELL_MAIN_PARTS_H_