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

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

Issue 2613303003: 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 }
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