| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_launcher_controller.h" | 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "chrome/browser/extensions/extension_app_icon_loader.h" | 8 #include "chrome/browser/extensions/extension_app_icon_loader.h" |
| 9 #include "chrome/browser/profiles/profile_manager.h" | 9 #include "chrome/browser/profiles/profile_manager.h" |
| 10 #include "chrome/browser/ui/app_list/arc/arc_app_icon_loader.h" | 10 #include "chrome/browser/ui/app_list/arc/arc_app_icon_loader.h" |
| 11 #include "chrome/browser/ui/ash/ash_util.h" | 11 #include "chrome/browser/ui/ash/ash_util.h" |
| 12 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" | 12 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" |
| 13 #include "chrome/browser/ui/ash/launcher/launcher_controller_helper.h" | 13 #include "chrome/browser/ui/ash/launcher/launcher_controller_helper.h" |
| 14 #include "content/public/common/service_manager_connection.h" | 14 #include "content/public/common/service_manager_connection.h" |
| 15 #include "content/public/common/service_names.mojom.h" |
| 15 #include "services/service_manager/public/cpp/connector.h" | 16 #include "services/service_manager/public/cpp/connector.h" |
| 16 #include "ui/display/display.h" | 17 #include "ui/display/display.h" |
| 17 #include "ui/display/screen.h" | 18 #include "ui/display/screen.h" |
| 18 | 19 |
| 19 // static | 20 // static |
| 20 ChromeLauncherController* ChromeLauncherController::instance_ = nullptr; | 21 ChromeLauncherController* ChromeLauncherController::instance_ = nullptr; |
| 21 | 22 |
| 22 ChromeLauncherController::~ChromeLauncherController() { | 23 ChromeLauncherController::~ChromeLauncherController() { |
| 23 if (instance_ == this) | 24 if (instance_ == this) |
| 24 instance_ = nullptr; | 25 instance_ = nullptr; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 49 auto connector = connection ? connection->GetConnector() : nullptr; | 50 auto connector = connection ? connection->GetConnector() : nullptr; |
| 50 // Unit tests may not have a connector. | 51 // Unit tests may not have a connector. |
| 51 if (!connector) | 52 if (!connector) |
| 52 return false; | 53 return false; |
| 53 | 54 |
| 54 // Under mash the ShelfController interface is in the ash process. In classic | 55 // Under mash the ShelfController interface is in the ash process. In classic |
| 55 // ash we provide it to ourself. | 56 // ash we provide it to ourself. |
| 56 if (chrome::IsRunningInMash()) { | 57 if (chrome::IsRunningInMash()) { |
| 57 connector->ConnectToInterface("ash", &shelf_controller_); | 58 connector->ConnectToInterface("ash", &shelf_controller_); |
| 58 } else { | 59 } else { |
| 59 connector->ConnectToInterface("content_browser", &shelf_controller_); | 60 connector->ConnectToInterface(content::mojom::kBrowserServiceName, |
| 61 &shelf_controller_); |
| 60 } | 62 } |
| 61 return true; | 63 return true; |
| 62 } | 64 } |
| 63 | 65 |
| 64 AppIconLoader* ChromeLauncherController::GetAppIconLoaderForApp( | 66 AppIconLoader* ChromeLauncherController::GetAppIconLoaderForApp( |
| 65 const std::string& app_id) { | 67 const std::string& app_id) { |
| 66 for (const auto& app_icon_loader : app_icon_loaders_) { | 68 for (const auto& app_icon_loader : app_icon_loaders_) { |
| 67 if (app_icon_loader->CanLoadImageForApp(app_id)) | 69 if (app_icon_loader->CanLoadImageForApp(app_id)) |
| 68 return app_icon_loader.get(); | 70 return app_icon_loader.get(); |
| 69 } | 71 } |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 // TODO(msw): Avoid handling this pref change and forwarding the value to ash. | 180 // TODO(msw): Avoid handling this pref change and forwarding the value to ash. |
| 179 ash::launcher::SetShelfAutoHideBehaviorPref(profile_->GetPrefs(), display_id, | 181 ash::launcher::SetShelfAutoHideBehaviorPref(profile_->GetPrefs(), display_id, |
| 180 auto_hide); | 182 auto_hide); |
| 181 } | 183 } |
| 182 | 184 |
| 183 void ChromeLauncherController::OnAppImageUpdated(const std::string& app_id, | 185 void ChromeLauncherController::OnAppImageUpdated(const std::string& app_id, |
| 184 const gfx::ImageSkia& image) { | 186 const gfx::ImageSkia& image) { |
| 185 // Implemented by subclasses; this should not be called. | 187 // Implemented by subclasses; this should not be called. |
| 186 NOTREACHED(); | 188 NOTREACHED(); |
| 187 } | 189 } |
| OLD | NEW |