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" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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::MojoShellConnection::GetForProcess()->GetConnector(); |
74 connector->ConnectToInterface("mojo: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 |
84 // if the icon cache gets deleted upon user switch. | 84 // if the icon cache gets deleted upon user switch. |
(...skipping 87 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 |