Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(231)

Side by Side Diff: ash/mus/sysui_application.cc

Issue 1942473002: Eliminate mojo:resource_provider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/mus/sysui_application.h" 5 #include "ash/mus/sysui_application.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "ash/desktop_background/desktop_background_controller.h" 12 #include "ash/desktop_background/desktop_background_controller.h"
13 #include "ash/host/ash_window_tree_host_init_params.h" 13 #include "ash/host/ash_window_tree_host_init_params.h"
14 #include "ash/host/ash_window_tree_host_platform.h" 14 #include "ash/host/ash_window_tree_host_platform.h"
15 #include "ash/mus/keyboard_ui_mus.h" 15 #include "ash/mus/keyboard_ui_mus.h"
16 #include "ash/mus/shelf_delegate_mus.h" 16 #include "ash/mus/shelf_delegate_mus.h"
17 #include "ash/mus/shell_delegate_mus.h" 17 #include "ash/mus/shell_delegate_mus.h"
18 #include "ash/mus/stub_context_factory.h" 18 #include "ash/mus/stub_context_factory.h"
19 #include "ash/root_window_settings.h" 19 #include "ash/root_window_settings.h"
20 #include "ash/shell.h" 20 #include "ash/shell.h"
21 #include "ash/shell_init_params.h" 21 #include "ash/shell_init_params.h"
22 #include "ash/shell_window_ids.h" 22 #include "ash/shell_window_ids.h"
23 #include "base/bind.h" 23 #include "base/bind.h"
24 #include "base/files/file_path.h" 24 #include "base/files/file_path.h"
25 #include "base/path_service.h" 25 #include "base/path_service.h"
26 #include "base/threading/sequenced_worker_pool.h" 26 #include "base/threading/sequenced_worker_pool.h"
27 #include "components/mus/public/cpp/property_type_converters.h" 27 #include "components/mus/public/cpp/property_type_converters.h"
28 #include "components/resource_provider/public/cpp/resource_loader.h"
29 #include "mash/wm/public/interfaces/ash_window_type.mojom.h" 28 #include "mash/wm/public/interfaces/ash_window_type.mojom.h"
30 #include "mash/wm/public/interfaces/container.mojom.h" 29 #include "mash/wm/public/interfaces/container.mojom.h"
30 #include "services/catalog/public/cpp/resource_loader.h"
31 #include "ui/aura/env.h" 31 #include "ui/aura/env.h"
32 #include "ui/base/resource/resource_bundle.h" 32 #include "ui/base/resource/resource_bundle.h"
33 #include "ui/base/ui_base_paths.h" 33 #include "ui/base/ui_base_paths.h"
34 #include "ui/message_center/message_center.h" 34 #include "ui/message_center/message_center.h"
35 #include "ui/platform_window/stub/stub_window.h" 35 #include "ui/platform_window/stub/stub_window.h"
36 #include "ui/views/mus/aura_init.h" 36 #include "ui/views/mus/aura_init.h"
37 #include "ui/views/mus/native_widget_mus.h" 37 #include "ui/views/mus/native_widget_mus.h"
38 #include "ui/views/mus/window_manager_connection.h" 38 #include "ui/views/mus/window_manager_connection.h"
39 #include "ui/views/views_delegate.h" 39 #include "ui/views/views_delegate.h"
40 40
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 235
236 void InitializeResourceBundle(::shell::Connector* connector) { 236 void InitializeResourceBundle(::shell::Connector* connector) {
237 if (ui::ResourceBundle::HasSharedInstance()) 237 if (ui::ResourceBundle::HasSharedInstance())
238 return; 238 return;
239 239
240 std::set<std::string> resource_paths; 240 std::set<std::string> resource_paths;
241 resource_paths.insert(kResourceFileStrings); 241 resource_paths.insert(kResourceFileStrings);
242 resource_paths.insert(kResourceFile100); 242 resource_paths.insert(kResourceFile100);
243 resource_paths.insert(kResourceFile200); 243 resource_paths.insert(kResourceFile200);
244 244
245 resource_provider::ResourceLoader loader(connector, resource_paths); 245 catalog::ResourceLoader loader(connector, resource_paths);
246 if (!loader.BlockUntilLoaded())
247 return;
248 246
249 // Load ash resources and en-US strings; not 'common' (Chrome) resources. 247 // Load ash resources and en-US strings; not 'common' (Chrome) resources.
250 // TODO(msw): Check ResourceBundle::IsScaleFactorSupported; load 300% etc. 248 // TODO(msw): Check ResourceBundle::IsScaleFactorSupported; load 300% etc.
251 ui::ResourceBundle::InitSharedInstanceWithPakFileRegion( 249 ui::ResourceBundle::InitSharedInstanceWithPakFileRegion(
252 loader.ReleaseFile(kResourceFileStrings), 250 loader.TakeFile(kResourceFileStrings),
253 base::MemoryMappedFile::Region::kWholeFile); 251 base::MemoryMappedFile::Region::kWholeFile);
254 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 252 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
255 rb.AddDataPackFromFile(loader.ReleaseFile(kResourceFile100), 253 rb.AddDataPackFromFile(loader.TakeFile(kResourceFile100),
256 ui::SCALE_FACTOR_100P); 254 ui::SCALE_FACTOR_100P);
257 rb.AddDataPackFromFile(loader.ReleaseFile(kResourceFile200), 255 rb.AddDataPackFromFile(loader.TakeFile(kResourceFile200),
258 ui::SCALE_FACTOR_200P); 256 ui::SCALE_FACTOR_200P);
259 } 257 }
260 258
261 void SetupWallpaper(SkColor color) { 259 void SetupWallpaper(SkColor color) {
262 SkBitmap bitmap; 260 SkBitmap bitmap;
263 bitmap.allocN32Pixels(16, 16); 261 bitmap.allocN32Pixels(16, 16);
264 bitmap.eraseColor(color); 262 bitmap.eraseColor(color);
265 #if !defined(NDEBUG) 263 #if !defined(NDEBUG)
266 // In debug builds we generate a simple pattern that allows visually 264 // In debug builds we generate a simple pattern that allows visually
267 // notice if transparency is broken. 265 // notice if transparency is broken.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 void SysUIApplication::Create( 316 void SysUIApplication::Create(
319 ::shell::Connection* connection, 317 ::shell::Connection* connection,
320 mojo::InterfaceRequest<mash::shelf::mojom::ShelfController> request) { 318 mojo::InterfaceRequest<mash::shelf::mojom::ShelfController> request) {
321 mash::shelf::mojom::ShelfController* shelf_controller = 319 mash::shelf::mojom::ShelfController* shelf_controller =
322 static_cast<ShelfDelegateMus*>(Shell::GetInstance()->GetShelfDelegate()); 320 static_cast<ShelfDelegateMus*>(Shell::GetInstance()->GetShelfDelegate());
323 shelf_controller_bindings_.AddBinding(shelf_controller, std::move(request)); 321 shelf_controller_bindings_.AddBinding(shelf_controller, std::move(request));
324 } 322 }
325 323
326 } // namespace sysui 324 } // namespace sysui
327 } // namespace ash 325 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698