OLD | NEW |
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 "chrome/browser/ui/ash/launcher/chrome_mash_shelf_controller.h" | 5 #include "chrome/browser/ui/ash/launcher/chrome_mash_shelf_controller.h" |
6 | 6 |
7 #include "chrome/browser/extensions/extension_app_icon_loader.h" | 7 #include "chrome/browser/extensions/extension_app_icon_loader.h" |
8 #include "chrome/browser/profiles/profile_manager.h" | 8 #include "chrome/browser/profiles/profile_manager.h" |
9 #include "chrome/browser/ui/app_list/arc/arc_app_icon_loader.h" | 9 #include "chrome/browser/ui/app_list/arc/arc_app_icon_loader.h" |
10 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" | 10 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" |
11 #include "chrome/browser/ui/ash/launcher/chrome_launcher_types.h" | 11 #include "chrome/browser/ui/ash/launcher/chrome_launcher_types.h" |
12 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h" | 12 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h" |
13 #include "chrome/grit/theme_resources.h" | 13 #include "chrome/grit/theme_resources.h" |
14 #include "content/public/common/mojo_shell_connection.h" | 14 #include "content/public/common/service_manager_connection.h" |
15 #include "extensions/common/constants.h" | 15 #include "extensions/common/constants.h" |
16 #include "extensions/grit/extensions_browser_resources.h" | 16 #include "extensions/grit/extensions_browser_resources.h" |
17 #include "mojo/common/common_type_converters.h" | 17 #include "mojo/common/common_type_converters.h" |
18 #include "services/shell/public/cpp/connector.h" | 18 #include "services/shell/public/cpp/connector.h" |
19 #include "ui/base/resource/resource_bundle.h" | 19 #include "ui/base/resource/resource_bundle.h" |
20 #include "ui/display/display.h" | 20 #include "ui/display/display.h" |
21 #include "ui/display/screen.h" | 21 #include "ui/display/screen.h" |
22 | 22 |
23 class ChromeShelfItemDelegate : public ash::mojom::ShelfItemDelegate { | 23 class ChromeShelfItemDelegate : public ash::mojom::ShelfItemDelegate { |
24 public: | 24 public: |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 } | 63 } |
64 | 64 |
65 ChromeMashShelfController::~ChromeMashShelfController() {} | 65 ChromeMashShelfController::~ChromeMashShelfController() {} |
66 | 66 |
67 void ChromeMashShelfController::LaunchItem(const std::string& app_id) { | 67 void ChromeMashShelfController::LaunchItem(const std::string& app_id) { |
68 helper_.LaunchApp(app_id, ash::LAUNCH_FROM_UNKNOWN, ui::EF_NONE); | 68 helper_.LaunchApp(app_id, ash::LAUNCH_FROM_UNKNOWN, ui::EF_NONE); |
69 } | 69 } |
70 | 70 |
71 void ChromeMashShelfController::Init() { | 71 void ChromeMashShelfController::Init() { |
72 shell::Connector* connector = | 72 shell::Connector* connector = |
73 content::MojoShellConnection::GetForProcess()->GetConnector(); | 73 content::ServiceManagerConnection::GetForProcess()->GetConnector(); |
74 connector->ConnectToInterface("service:ash", &shelf_controller_); | 74 connector->ConnectToInterface("service:ash", &shelf_controller_); |
75 | 75 |
76 // Initialize shelf alignment and auto-hide behavior from preferences. | 76 // Initialize shelf alignment and auto-hide behavior from preferences. |
77 for (const auto& display : display::Screen::GetScreen()->GetAllDisplays()) | 77 for (const auto& display : display::Screen::GetScreen()->GetAllDisplays()) |
78 OnShelfCreated(display.id()); | 78 OnShelfCreated(display.id()); |
79 | 79 |
80 // TODO(skuhne): The AppIconLoaderImpl has the same problem. Each loaded | 80 // TODO(skuhne): The AppIconLoaderImpl has the same problem. Each loaded |
81 // image is associated with a profile (its loader requires the profile). | 81 // image is associated with a profile (its loader requires the profile). |
82 // Since icon size changes are possible, the icon could be requested to be | 82 // Since icon size changes are possible, the icon could be requested to be |
83 // reloaded. However - having it not multi profile aware would cause problems | 83 // reloaded. However - having it not multi profile aware would cause problems |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 // This will uselessly store a preference value for invalid display ids. | 172 // This will uselessly store a preference value for invalid display ids. |
173 ash::launcher::SetShelfAutoHideBehaviorPref( | 173 ash::launcher::SetShelfAutoHideBehaviorPref( |
174 ProfileManager::GetActiveUserProfile()->GetPrefs(), display_id, | 174 ProfileManager::GetActiveUserProfile()->GetPrefs(), display_id, |
175 auto_hide); | 175 auto_hide); |
176 } | 176 } |
177 | 177 |
178 void ChromeMashShelfController::OnAppImageUpdated(const std::string& app_id, | 178 void ChromeMashShelfController::OnAppImageUpdated(const std::string& app_id, |
179 const gfx::ImageSkia& image) { | 179 const gfx::ImageSkia& image) { |
180 shelf_controller_->SetItemImage(app_id, *image.bitmap()); | 180 shelf_controller_->SetItemImage(app_id, *image.bitmap()); |
181 } | 181 } |
OLD | NEW |