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

Side by Side Diff: chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc

Issue 2647293003: Merge to M-56 (branch 2924) Use the correct profile for shelf prefs. (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 } 69 }
70 70
71 return nullptr; 71 return nullptr;
72 } 72 }
73 73
74 void ChromeLauncherController::SetShelfAutoHideBehaviorFromPrefs() { 74 void ChromeLauncherController::SetShelfAutoHideBehaviorFromPrefs() {
75 if (!ConnectToShelfController()) 75 if (!ConnectToShelfController())
76 return; 76 return;
77 77
78 // The pref helper functions return default values for invalid display ids. 78 // The pref helper functions return default values for invalid display ids.
79 PrefService* prefs = ProfileManager::GetActiveUserProfile()->GetPrefs(); 79 PrefService* prefs = profile_->GetPrefs();
80 for (const auto& display : display::Screen::GetScreen()->GetAllDisplays()) { 80 for (const auto& display : display::Screen::GetScreen()->GetAllDisplays()) {
81 shelf_controller_->SetAutoHideBehavior( 81 shelf_controller_->SetAutoHideBehavior(
82 ash::launcher::GetShelfAutoHideBehaviorPref(prefs, display.id()), 82 ash::launcher::GetShelfAutoHideBehaviorPref(prefs, display.id()),
83 display.id()); 83 display.id());
84 } 84 }
85 } 85 }
86 86
87 void ChromeLauncherController::SetShelfAlignmentFromPrefs() { 87 void ChromeLauncherController::SetShelfAlignmentFromPrefs() {
88 if (!ConnectToShelfController()) 88 if (!ConnectToShelfController())
89 return; 89 return;
90 90
91 // The pref helper functions return default values for invalid display ids. 91 // The pref helper functions return default values for invalid display ids.
92 PrefService* prefs = ProfileManager::GetActiveUserProfile()->GetPrefs(); 92 PrefService* prefs = profile_->GetPrefs();
93 for (const auto& display : display::Screen::GetScreen()->GetAllDisplays()) { 93 for (const auto& display : display::Screen::GetScreen()->GetAllDisplays()) {
94 shelf_controller_->SetAlignment( 94 shelf_controller_->SetAlignment(
95 ash::launcher::GetShelfAlignmentPref(prefs, display.id()), 95 ash::launcher::GetShelfAlignmentPref(prefs, display.id()),
96 display.id()); 96 display.id());
97 } 97 }
98 } 98 }
99 99
100 void ChromeLauncherController::SetShelfBehaviorsFromPrefs() { 100 void ChromeLauncherController::SetShelfBehaviorsFromPrefs() {
101 SetShelfAutoHideBehaviorFromPrefs(); 101 SetShelfAutoHideBehaviorFromPrefs();
102 SetShelfAlignmentFromPrefs(); 102 SetShelfAlignmentFromPrefs();
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 // TODO(msw): Avoid handling this pref change and forwarding the value to ash. 178 // TODO(msw): Avoid handling this pref change and forwarding the value to ash.
179 ash::launcher::SetShelfAutoHideBehaviorPref(profile_->GetPrefs(), display_id, 179 ash::launcher::SetShelfAutoHideBehaviorPref(profile_->GetPrefs(), display_id,
180 auto_hide); 180 auto_hide);
181 } 181 }
182 182
183 void ChromeLauncherController::OnAppImageUpdated(const std::string& app_id, 183 void ChromeLauncherController::OnAppImageUpdated(const std::string& app_id,
184 const gfx::ImageSkia& image) { 184 const gfx::ImageSkia& image) {
185 // Implemented by subclasses; this should not be called. 185 // Implemented by subclasses; this should not be called.
186 NOTREACHED(); 186 NOTREACHED();
187 } 187 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698