| 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.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 "services/service_manager/public/cpp/connector.h" | 15 #include "services/service_manager/public/cpp/connector.h" |
| 16 #include "ui/display/display.h" | 16 #include "ui/display/display.h" |
| 17 #include "ui/display/screen.h" | 17 #include "ui/display/screen.h" |
| 18 | 18 |
| 19 // static | 19 // static |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 } | 73 } |
| 74 | 74 |
| 75 return nullptr; | 75 return nullptr; |
| 76 } | 76 } |
| 77 | 77 |
| 78 void ChromeLauncherController::SetShelfAutoHideBehaviorFromPrefs() { | 78 void ChromeLauncherController::SetShelfAutoHideBehaviorFromPrefs() { |
| 79 if (!ConnectToShelfController()) | 79 if (!ConnectToShelfController()) |
| 80 return; | 80 return; |
| 81 | 81 |
| 82 // The pref helper functions return default values for invalid display ids. | 82 // The pref helper functions return default values for invalid display ids. |
| 83 PrefService* prefs = ProfileManager::GetActiveUserProfile()->GetPrefs(); | 83 PrefService* prefs = profile_->GetPrefs(); |
| 84 for (const auto& display : display::Screen::GetScreen()->GetAllDisplays()) { | 84 for (const auto& display : display::Screen::GetScreen()->GetAllDisplays()) { |
| 85 shelf_controller_->SetAutoHideBehavior( | 85 shelf_controller_->SetAutoHideBehavior( |
| 86 ash::launcher::GetShelfAutoHideBehaviorPref(prefs, display.id()), | 86 ash::launcher::GetShelfAutoHideBehaviorPref(prefs, display.id()), |
| 87 display.id()); | 87 display.id()); |
| 88 } | 88 } |
| 89 } | 89 } |
| 90 | 90 |
| 91 void ChromeLauncherController::SetShelfAlignmentFromPrefs() { | 91 void ChromeLauncherController::SetShelfAlignmentFromPrefs() { |
| 92 if (!ConnectToShelfController()) | 92 if (!ConnectToShelfController()) |
| 93 return; | 93 return; |
| 94 | 94 |
| 95 // The pref helper functions return default values for invalid display ids. | 95 // The pref helper functions return default values for invalid display ids. |
| 96 PrefService* prefs = ProfileManager::GetActiveUserProfile()->GetPrefs(); | 96 PrefService* prefs = profile_->GetPrefs(); |
| 97 for (const auto& display : display::Screen::GetScreen()->GetAllDisplays()) { | 97 for (const auto& display : display::Screen::GetScreen()->GetAllDisplays()) { |
| 98 shelf_controller_->SetAlignment( | 98 shelf_controller_->SetAlignment( |
| 99 ash::launcher::GetShelfAlignmentPref(prefs, display.id()), | 99 ash::launcher::GetShelfAlignmentPref(prefs, display.id()), |
| 100 display.id()); | 100 display.id()); |
| 101 } | 101 } |
| 102 } | 102 } |
| 103 | 103 |
| 104 void ChromeLauncherController::SetShelfBehaviorsFromPrefs() { | 104 void ChromeLauncherController::SetShelfBehaviorsFromPrefs() { |
| 105 SetShelfAutoHideBehaviorFromPrefs(); | 105 SetShelfAutoHideBehaviorFromPrefs(); |
| 106 SetShelfAlignmentFromPrefs(); | 106 SetShelfAlignmentFromPrefs(); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 // TODO(msw): Avoid handling this pref change and forwarding the value to ash. | 182 // TODO(msw): Avoid handling this pref change and forwarding the value to ash. |
| 183 ash::launcher::SetShelfAutoHideBehaviorPref(profile_->GetPrefs(), display_id, | 183 ash::launcher::SetShelfAutoHideBehaviorPref(profile_->GetPrefs(), display_id, |
| 184 auto_hide); | 184 auto_hide); |
| 185 } | 185 } |
| 186 | 186 |
| 187 void ChromeLauncherController::OnAppImageUpdated(const std::string& app_id, | 187 void ChromeLauncherController::OnAppImageUpdated(const std::string& app_id, |
| 188 const gfx::ImageSkia& image) { | 188 const gfx::ImageSkia& image) { |
| 189 // Implemented by subclasses; this should not be called. | 189 // Implemented by subclasses; this should not be called. |
| 190 NOTREACHED(); | 190 NOTREACHED(); |
| 191 } | 191 } |
| OLD | NEW |