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

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

Issue 1851883002: Cleanup shelf initialization and observation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Check for shelf before setting prefs in ChromeLauncherController. Created 4 years, 8 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
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
11 #include "ash/ash_switches.h" 11 #include "ash/ash_switches.h"
12 #include "ash/desktop_background/desktop_background_controller.h" 12 #include "ash/desktop_background/desktop_background_controller.h"
13 #include "ash/multi_profile_uma.h" 13 #include "ash/multi_profile_uma.h"
14 #include "ash/root_window_controller.h" 14 #include "ash/root_window_controller.h"
15 #include "ash/shelf/shelf.h" 15 #include "ash/shelf/shelf.h"
16 #include "ash/shelf/shelf_item_delegate_manager.h" 16 #include "ash/shelf/shelf_item_delegate_manager.h"
17 #include "ash/shelf/shelf_layout_manager.h"
18 #include "ash/shelf/shelf_model.h" 17 #include "ash/shelf/shelf_model.h"
19 #include "ash/shell.h" 18 #include "ash/shell.h"
20 #include "ash/system/tray/system_tray_delegate.h" 19 #include "ash/system/tray/system_tray_delegate.h"
21 #include "ash/wm/window_util.h" 20 #include "ash/wm/window_util.h"
22 #include "base/command_line.h" 21 #include "base/command_line.h"
23 #include "base/macros.h" 22 #include "base/macros.h"
24 #include "base/strings/pattern.h" 23 #include "base/strings/pattern.h"
25 #include "base/strings/string_number_conversions.h" 24 #include "base/strings/string_number_conversions.h"
26 #include "base/strings/string_util.h" 25 #include "base/strings/string_util.h"
27 #include "base/strings/utf_string_conversions.h" 26 #include "base/strings/utf_string_conversions.h"
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 ChromeLauncherController::~ChromeLauncherController() { 508 ChromeLauncherController::~ChromeLauncherController() {
510 if (item_delegate_manager_) 509 if (item_delegate_manager_)
511 item_delegate_manager_->RemoveObserver(this); 510 item_delegate_manager_->RemoveObserver(this);
512 511
513 // Reset the BrowserStatusMonitor as it has a weak pointer to this. 512 // Reset the BrowserStatusMonitor as it has a weak pointer to this.
514 browser_status_monitor_.reset(); 513 browser_status_monitor_.reset();
515 514
516 // Reset the app window controllers here since it has a weak pointer to this. 515 // Reset the app window controllers here since it has a weak pointer to this.
517 app_window_controllers_.clear(); 516 app_window_controllers_.clear();
518 517
519 for (auto iter : shelves_)
520 iter->shelf_layout_manager()->RemoveObserver(this);
521
522 model_->RemoveObserver(this); 518 model_->RemoveObserver(this);
523 if (ash::Shell::HasInstance()) 519 if (ash::Shell::HasInstance())
524 ash::Shell::GetInstance()->window_tree_host_manager()->RemoveObserver(this); 520 ash::Shell::GetInstance()->window_tree_host_manager()->RemoveObserver(this);
525 for (IDToItemControllerMap::iterator i = id_to_item_controller_map_.begin(); 521 for (IDToItemControllerMap::iterator i = id_to_item_controller_map_.begin();
526 i != id_to_item_controller_map_.end(); ++i) { 522 i != id_to_item_controller_map_.end(); ++i) {
527 int index = model_->ItemIndexByID(i->first); 523 int index = model_->ItemIndexByID(i->first);
528 // A "browser proxy" is not known to the model and this removal does 524 // A "browser proxy" is not known to the model and this removal does
529 // therefore not need to be propagated to the model. 525 // therefore not need to be propagated to the model.
530 if (index != -1 && 526 if (index != -1 &&
531 model_->items()[index].type != ash::TYPE_BROWSER_SHORTCUT) 527 model_->items()[index].type != ash::TYPE_BROWSER_SHORTCUT)
532 model_->RemoveItemAt(index); 528 model_->RemoveItemAt(index);
533 } 529 }
534 530
535 if (ash::Shell::HasInstance())
536 ash::Shell::GetInstance()->RemoveShellObserver(this);
537
538 // Release all profile dependent resources. 531 // Release all profile dependent resources.
539 ReleaseProfile(); 532 ReleaseProfile();
540 if (instance_ == this) 533 if (instance_ == this)
541 instance_ = NULL; 534 instance_ = NULL;
542 535
543 // Get rid of the multi user window manager instance. 536 // Get rid of the multi user window manager instance.
544 chrome::MultiUserWindowManager::DeleteInstance(); 537 chrome::MultiUserWindowManager::DeleteInstance();
545 } 538 }
546 539
547 // static 540 // static
548 ChromeLauncherController* ChromeLauncherController::CreateInstance( 541 ChromeLauncherController* ChromeLauncherController::CreateInstance(
549 Profile* profile, 542 Profile* profile,
550 ash::ShelfModel* model) { 543 ash::ShelfModel* model) {
551 // We do not check here for re-creation of the ChromeLauncherController since 544 // We do not check here for re-creation of the ChromeLauncherController since
552 // it appears that it might be intentional that the ChromeLauncherController 545 // it appears that it might be intentional that the ChromeLauncherController
553 // can be re-created. 546 // can be re-created.
554 instance_ = new ChromeLauncherController(profile, model); 547 instance_ = new ChromeLauncherController(profile, model);
555 return instance_; 548 return instance_;
556 } 549 }
557 550
558 void ChromeLauncherController::Init() { 551 void ChromeLauncherController::Init() {
559 CreateBrowserShortcutLauncherItem(); 552 CreateBrowserShortcutLauncherItem();
560 UpdateAppLaunchersFromPref(); 553 UpdateAppLaunchersFromPref();
561 554
555 #if defined(OS_CHROMEOS)
562 // TODO(sky): update unit test so that this test isn't necessary. 556 // TODO(sky): update unit test so that this test isn't necessary.
563 if (ash::Shell::HasInstance()) { 557 if (ash::Shell::HasInstance())
564 SetShelfAutoHideBehaviorFromPrefs();
565 SetShelfAlignmentFromPrefs();
566 #if defined(OS_CHROMEOS)
567 SetVirtualKeyboardBehaviorFromPrefs(); 558 SetVirtualKeyboardBehaviorFromPrefs();
568 #endif // defined(OS_CHROMEOS) 559 #endif // defined(OS_CHROMEOS)
569 syncable_prefs::PrefServiceSyncable* prefs = 560
570 PrefServiceSyncableFromProfile(profile_); 561 syncable_prefs::PrefServiceSyncable* prefs =
571 if (!prefs->FindPreference(prefs::kShelfAlignmentLocal)->HasUserSetting() || 562 PrefServiceSyncableFromProfile(profile_);
572 !prefs->FindPreference(prefs::kShelfAutoHideBehaviorLocal)-> 563 if (!prefs->FindPreference(prefs::kShelfAlignmentLocal)->HasUserSetting() ||
573 HasUserSetting()) { 564 !prefs->FindPreference(prefs::kShelfAutoHideBehaviorLocal)
574 // This causes OnIsSyncingChanged to be called when the value of 565 ->HasUserSetting()) {
575 // PrefService::IsSyncing() changes. 566 // This causes OnIsSyncingChanged to be called when the value of
576 prefs->AddObserver(this); 567 // PrefService::IsSyncing() changes.
577 } 568 prefs->AddObserver(this);
578 ash::Shell::GetInstance()->AddShellObserver(this);
579 } 569 }
580 } 570 }
581 571
582 ash::ShelfID ChromeLauncherController::CreateAppLauncherItem( 572 ash::ShelfID ChromeLauncherController::CreateAppLauncherItem(
583 LauncherItemController* controller, 573 LauncherItemController* controller,
584 const std::string& app_id, 574 const std::string& app_id,
585 ash::ShelfItemStatus status) { 575 ash::ShelfItemStatus status) {
586 CHECK(controller); 576 CHECK(controller);
587 int index = 0; 577 int index = 0;
588 // Panels are inserted on the left so as not to push all existing panels over. 578 // Panels are inserted on the left so as not to push all existing panels over.
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 int index = model_->ItemIndexByID(i->first); 876 int index = model_->ItemIndexByID(i->first);
887 if (index == -1) 877 if (index == -1)
888 continue; 878 continue;
889 ash::ShelfItem item = model_->items()[index]; 879 ash::ShelfItem item = model_->items()[index];
890 item.image = image; 880 item.image = image;
891 model_->Set(index, item); 881 model_->Set(index, item);
892 // It's possible we're waiting on more than one item, so don't break. 882 // It's possible we're waiting on more than one item, so don't break.
893 } 883 }
894 } 884 }
895 885
896 void ChromeLauncherController::OnAutoHideBehaviorChanged(
897 aura::Window* root_window,
898 ash::ShelfAutoHideBehavior new_behavior) {
899 SetShelfAutoHideBehaviorPrefs(new_behavior, root_window);
900 }
901
902 void ChromeLauncherController::SetLauncherItemImage( 886 void ChromeLauncherController::SetLauncherItemImage(
903 ash::ShelfID shelf_id, 887 ash::ShelfID shelf_id,
904 const gfx::ImageSkia& image) { 888 const gfx::ImageSkia& image) {
905 int index = model_->ItemIndexByID(shelf_id); 889 int index = model_->ItemIndexByID(shelf_id);
906 if (index == -1) 890 if (index == -1)
907 return; 891 return;
908 ash::ShelfItem item = model_->items()[index]; 892 ash::ShelfItem item = model_->items()[index];
909 item.image = image; 893 item.image = image;
910 model_->Set(index, item); 894 model_->Set(index, item);
911 } 895 }
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 window->Minimize(); 1133 window->Minimize();
1150 return ash::ShelfItemDelegate::kNoAction; 1134 return ash::ShelfItemDelegate::kNoAction;
1151 } 1135 }
1152 1136
1153 window->Show(); 1137 window->Show();
1154 window->Activate(); 1138 window->Activate();
1155 return ash::ShelfItemDelegate::kExistingWindowActivated; 1139 return ash::ShelfItemDelegate::kExistingWindowActivated;
1156 } 1140 }
1157 1141
1158 void ChromeLauncherController::OnShelfCreated(ash::Shelf* shelf) { 1142 void ChromeLauncherController::OnShelfCreated(ash::Shelf* shelf) {
1159 shelves_.insert(shelf); 1143 aura::Window* root_window =
1160 shelf->shelf_layout_manager()->AddObserver(this); 1144 shelf->shelf_widget()->GetNativeWindow()->GetRootWindow();
1145
1146 shelf->SetAutoHideBehavior(
1147 GetShelfAutoHideBehaviorFromPrefs(profile_, root_window));
1148
1149 if (ash::ShelfWidget::ShelfAlignmentAllowed())
1150 shelf->SetAlignment(GetShelfAlignmentFromPrefs(profile_, root_window));
1161 } 1151 }
1162 1152
1163 void ChromeLauncherController::OnShelfDestroyed(ash::Shelf* shelf) { 1153 void ChromeLauncherController::OnShelfDestroyed(ash::Shelf* shelf) {}
1164 shelves_.erase(shelf); 1154
1165 // RemoveObserver is not called here, since by the time this method is called 1155 void ChromeLauncherController::OnShelfAlignmentChanged(ash::Shelf* shelf) {
1166 // Shelf is already in its destructor. 1156 const char* value = nullptr;
1157 switch (shelf->GetAlignment()) {
1158 case ash::SHELF_ALIGNMENT_BOTTOM:
1159 value = ash::kShelfAlignmentBottom;
1160 break;
1161 case ash::SHELF_ALIGNMENT_LEFT:
1162 value = ash::kShelfAlignmentLeft;
1163 break;
1164 case ash::SHELF_ALIGNMENT_RIGHT:
1165 value = ash::kShelfAlignmentRight;
1166 break;
1167 }
1168
1169 aura::Window* root_window =
1170 shelf->shelf_widget()->GetNativeWindow()->GetRootWindow();
1171
1172 UpdatePerDisplayPref(profile_->GetPrefs(), root_window,
1173 prefs::kShelfAlignment, value);
1174
1175 if (root_window == ash::Shell::GetPrimaryRootWindow()) {
1176 // See comment in |kShelfAlignment| about why we have two prefs here.
1177 profile_->GetPrefs()->SetString(prefs::kShelfAlignmentLocal, value);
1178 profile_->GetPrefs()->SetString(prefs::kShelfAlignment, value);
1179 }
1180 }
1181
1182 void ChromeLauncherController::OnShelfAutoHideBehaviorChanged(
1183 ash::Shelf* shelf) {
1184 const char* value = nullptr;
1185 switch (shelf->GetAutoHideBehavior()) {
1186 case ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS:
1187 value = ash::kShelfAutoHideBehaviorAlways;
1188 break;
1189 case ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER:
1190 value = ash::kShelfAutoHideBehaviorNever;
1191 break;
1192 case ash::SHELF_AUTO_HIDE_ALWAYS_HIDDEN:
1193 // This one should not be a valid preference option for now. We only want
1194 // to completely hide it when we run in app mode - or while we temporarily
1195 // hide the shelf as part of an animation (e.g. the multi user change).
1196 return;
1197 }
1198
1199 aura::Window* root_window =
1200 shelf->shelf_widget()->GetNativeWindow()->GetRootWindow();
1201
1202 UpdatePerDisplayPref(profile_->GetPrefs(), root_window,
1203 prefs::kShelfAutoHideBehavior, value);
1204
1205 if (root_window == ash::Shell::GetPrimaryRootWindow()) {
1206 // See comment in |kShelfAlignment| about why we have two prefs here.
1207 profile_->GetPrefs()->SetString(prefs::kShelfAutoHideBehaviorLocal, value);
1208 profile_->GetPrefs()->SetString(prefs::kShelfAutoHideBehavior, value);
1209 }
1167 } 1210 }
1168 1211
1169 void ChromeLauncherController::ShelfItemAdded(int index) { 1212 void ChromeLauncherController::ShelfItemAdded(int index) {
1170 // The app list launcher can get added to the shelf after we applied the 1213 // The app list launcher can get added to the shelf after we applied the
1171 // preferences. In that case the item might be at the wrong spot. As such we 1214 // preferences. In that case the item might be at the wrong spot. As such we
1172 // call the function again. 1215 // call the function again.
1173 if (model_->items()[index].type == ash::TYPE_APP_LIST) 1216 if (model_->items()[index].type == ash::TYPE_APP_LIST)
1174 UpdateAppLaunchersFromPref(); 1217 UpdateAppLaunchersFromPref();
1175 } 1218 }
1176 1219
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1210 // When coming here, the active user has already be changed so that we can 1253 // When coming here, the active user has already be changed so that we can
1211 // set it as active. 1254 // set it as active.
1212 AttachProfile(ProfileManager::GetActiveUserProfile()); 1255 AttachProfile(ProfileManager::GetActiveUserProfile());
1213 // Update the V1 applications. 1256 // Update the V1 applications.
1214 browser_status_monitor_->ActiveUserChanged(user_email); 1257 browser_status_monitor_->ActiveUserChanged(user_email);
1215 // Switch the running applications to the new user. 1258 // Switch the running applications to the new user.
1216 for (auto& controller : app_window_controllers_) 1259 for (auto& controller : app_window_controllers_)
1217 controller->ActiveUserChanged(user_email); 1260 controller->ActiveUserChanged(user_email);
1218 // Update the user specific shell properties from the new user profile. 1261 // Update the user specific shell properties from the new user profile.
1219 UpdateAppLaunchersFromPref(); 1262 UpdateAppLaunchersFromPref();
1220 SetShelfAlignmentFromPrefs();
1221 SetShelfAutoHideBehaviorFromPrefs();
1222 SetShelfBehaviorsFromPrefs(); 1263 SetShelfBehaviorsFromPrefs();
1223 #if defined(OS_CHROMEOS) 1264 #if defined(OS_CHROMEOS)
1224 SetVirtualKeyboardBehaviorFromPrefs(); 1265 SetVirtualKeyboardBehaviorFromPrefs();
1225 #endif // defined(OS_CHROMEOS) 1266 #endif // defined(OS_CHROMEOS)
1226 // Restore the order of running, but unpinned applications for the activated 1267 // Restore the order of running, but unpinned applications for the activated
1227 // user. 1268 // user.
1228 RestoreUnpinnedRunningApplicationOrder(user_email); 1269 RestoreUnpinnedRunningApplicationOrder(user_email);
1229 // Inform the system tray of the change. 1270 // Inform the system tray of the change.
1230 ash::Shell::GetInstance()->system_tray_delegate()->ActiveUserWasChanged(); 1271 ash::Shell::GetInstance()->system_tray_delegate()->ActiveUserWasChanged();
1231 // Force on-screen keyboard to reset. 1272 // Force on-screen keyboard to reset.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1275 1316
1276 if (IsAppPinned(app_id)) { 1317 if (IsAppPinned(app_id)) {
1277 if (profile == profile_) 1318 if (profile == profile_)
1278 DoUnpinAppWithID(app_id); 1319 DoUnpinAppWithID(app_id);
1279 AppIconLoader* app_icon_loader = GetAppIconLoaderForApp(app_id); 1320 AppIconLoader* app_icon_loader = GetAppIconLoaderForApp(app_id);
1280 if (app_icon_loader) 1321 if (app_icon_loader)
1281 app_icon_loader->ClearImage(app_id); 1322 app_icon_loader->ClearImage(app_id);
1282 } 1323 }
1283 } 1324 }
1284 1325
1285 void ChromeLauncherController::OnShelfAlignmentChanged(
1286 aura::Window* root_window) {
1287 const char* pref_value = NULL;
1288 switch (ash::Shell::GetInstance()->GetShelfAlignment(root_window)) {
1289 case ash::SHELF_ALIGNMENT_BOTTOM:
1290 pref_value = ash::kShelfAlignmentBottom;
1291 break;
1292 case ash::SHELF_ALIGNMENT_LEFT:
1293 pref_value = ash::kShelfAlignmentLeft;
1294 break;
1295 case ash::SHELF_ALIGNMENT_RIGHT:
1296 pref_value = ash::kShelfAlignmentRight;
1297 break;
1298 }
1299
1300 UpdatePerDisplayPref(
1301 profile_->GetPrefs(), root_window, prefs::kShelfAlignment, pref_value);
1302
1303 if (root_window == ash::Shell::GetPrimaryRootWindow()) {
1304 // See comment in |kShelfAlignment| about why we have two prefs here.
1305 profile_->GetPrefs()->SetString(prefs::kShelfAlignmentLocal, pref_value);
1306 profile_->GetPrefs()->SetString(prefs::kShelfAlignment, pref_value);
1307 }
1308 }
1309
1310 void ChromeLauncherController::OnDisplayConfigurationChanged() { 1326 void ChromeLauncherController::OnDisplayConfigurationChanged() {
1311 SetShelfBehaviorsFromPrefs(); 1327 SetShelfBehaviorsFromPrefs();
1312 } 1328 }
1313 1329
1314 void ChromeLauncherController::OnIsSyncingChanged() { 1330 void ChromeLauncherController::OnIsSyncingChanged() {
1315 syncable_prefs::PrefServiceSyncable* prefs = 1331 syncable_prefs::PrefServiceSyncable* prefs =
1316 PrefServiceSyncableFromProfile(profile_); 1332 PrefServiceSyncableFromProfile(profile_);
1317 MaybePropagatePrefToLocal(prefs, 1333 MaybePropagatePrefToLocal(prefs,
1318 prefs::kShelfAlignmentLocal, 1334 prefs::kShelfAlignmentLocal,
1319 prefs::kShelfAlignment); 1335 prefs::kShelfAlignment);
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
1784 if (app_list_index != -1 && target_index <= app_list_index) 1800 if (app_list_index != -1 && target_index <= app_list_index)
1785 ++app_list_index; 1801 ++app_list_index;
1786 } else { 1802 } else {
1787 int target_index = FindInsertionPoint(is_app_list); 1803 int target_index = FindInsertionPoint(is_app_list);
1788 MoveChromeOrApplistToFinalPosition( 1804 MoveChromeOrApplistToFinalPosition(
1789 is_chrome, is_app_list, target_index, &chrome_index, &app_list_index); 1805 is_chrome, is_app_list, target_index, &chrome_index, &app_list_index);
1790 } 1806 }
1791 } 1807 }
1792 } 1808 }
1793 1809
1794 void ChromeLauncherController::SetShelfAutoHideBehaviorPrefs(
1795 ash::ShelfAutoHideBehavior behavior,
1796 aura::Window* root_window) {
1797 const char* value = NULL;
1798 switch (behavior) {
1799 case ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS:
1800 value = ash::kShelfAutoHideBehaviorAlways;
1801 break;
1802 case ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER:
1803 value = ash::kShelfAutoHideBehaviorNever;
1804 break;
1805 case ash::SHELF_AUTO_HIDE_ALWAYS_HIDDEN:
1806 // This one should not be a valid preference option for now. We only want
1807 // to completely hide it when we run in app mode - or while we temporarily
1808 // hide the shelf as part of an animation (e.g. the multi user change).
1809 return;
1810 }
1811
1812 UpdatePerDisplayPref(
1813 profile_->GetPrefs(), root_window, prefs::kShelfAutoHideBehavior, value);
1814
1815 if (root_window == ash::Shell::GetPrimaryRootWindow()) {
1816 // See comment in |kShelfAlignment| about why we have two prefs here.
1817 profile_->GetPrefs()->SetString(prefs::kShelfAutoHideBehaviorLocal, value);
1818 profile_->GetPrefs()->SetString(prefs::kShelfAutoHideBehavior, value);
1819 }
1820 }
1821
1822 void ChromeLauncherController::SetShelfAutoHideBehaviorFromPrefs() { 1810 void ChromeLauncherController::SetShelfAutoHideBehaviorFromPrefs() {
1823 aura::Window::Windows root_windows = ash::Shell::GetAllRootWindows(); 1811 for (auto* window : ash::Shell::GetAllRootWindows()) {
1824 for (auto i = root_windows.begin(); i != root_windows.end(); ++i) { 1812 ash::Shelf* shelf = ash::Shelf::ForWindow(window);
1825 ash::Shell::GetInstance()->SetShelfAutoHideBehavior( 1813 if (shelf) {
1826 GetShelfAutoHideBehaviorFromPrefs(profile_, *i), *i); 1814 shelf->SetAutoHideBehavior(
1815 GetShelfAutoHideBehaviorFromPrefs(profile_, window));
1816 }
1827 } 1817 }
1828 } 1818 }
1829 1819
1830 void ChromeLauncherController::SetShelfAlignmentFromPrefs() { 1820 void ChromeLauncherController::SetShelfAlignmentFromPrefs() {
1831 if (!ash::ShelfWidget::ShelfAlignmentAllowed()) 1821 if (!ash::ShelfWidget::ShelfAlignmentAllowed())
1832 return; 1822 return;
1833 1823
1834 aura::Window::Windows root_windows = ash::Shell::GetAllRootWindows(); 1824 for (auto* window : ash::Shell::GetAllRootWindows()) {
1835 for (auto i = root_windows.begin(); i != root_windows.end(); ++i) { 1825 ash::Shelf* shelf = ash::Shelf::ForWindow(window);
1836 ash::Shell::GetInstance()->SetShelfAlignment( 1826 if (shelf)
1837 GetShelfAlignmentFromPrefs(profile_, *i), *i); 1827 shelf->SetAlignment(GetShelfAlignmentFromPrefs(profile_, window));
1838 } 1828 }
1839 } 1829 }
1840 1830
1841 void ChromeLauncherController::SetShelfBehaviorsFromPrefs() { 1831 void ChromeLauncherController::SetShelfBehaviorsFromPrefs() {
1842 SetShelfAutoHideBehaviorFromPrefs(); 1832 SetShelfAutoHideBehaviorFromPrefs();
1843 SetShelfAlignmentFromPrefs(); 1833 SetShelfAlignmentFromPrefs();
1844 } 1834 }
1845 1835
1846 #if defined(OS_CHROMEOS) 1836 #if defined(OS_CHROMEOS)
1847 void ChromeLauncherController::SetVirtualKeyboardBehaviorFromPrefs() { 1837 void ChromeLauncherController::SetVirtualKeyboardBehaviorFromPrefs() {
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
2238 2228
2239 AppIconLoader* ChromeLauncherController::GetAppIconLoaderForApp( 2229 AppIconLoader* ChromeLauncherController::GetAppIconLoaderForApp(
2240 const std::string& app_id) { 2230 const std::string& app_id) {
2241 for (const auto& app_icon_loader : app_icon_loaders_) { 2231 for (const auto& app_icon_loader : app_icon_loaders_) {
2242 if (app_icon_loader->CanLoadImageForApp(app_id)) 2232 if (app_icon_loader->CanLoadImageForApp(app_id))
2243 return app_icon_loader.get(); 2233 return app_icon_loader.get();
2244 } 2234 }
2245 2235
2246 return nullptr; 2236 return nullptr;
2247 } 2237 }
OLDNEW
« ash/shelf/shelf.cc ('K') | « chrome/browser/ui/ash/launcher/chrome_launcher_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698