OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_per_browser.
h" | 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_browser.
h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/launcher/launcher_model.h" | 9 #include "ash/launcher/launcher_model.h" |
10 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 ash::LauncherItem item = model_->items()[index]; | 638 ash::LauncherItem item = model_->items()[index]; |
639 item.image = image; | 639 item.image = image; |
640 model_->Set(index, item); | 640 model_->Set(index, item); |
641 // It's possible we're waiting on more than one item, so don't break. | 641 // It's possible we're waiting on more than one item, so don't break. |
642 } | 642 } |
643 } | 643 } |
644 | 644 |
645 void ChromeLauncherControllerPerBrowser::OnAutoHideBehaviorChanged( | 645 void ChromeLauncherControllerPerBrowser::OnAutoHideBehaviorChanged( |
646 ash::ShelfAutoHideBehavior new_behavior) { | 646 ash::ShelfAutoHideBehavior new_behavior) { |
647 std::string behavior_string; | 647 std::string behavior_string; |
648 ash::Shell::RootWindowList root_windows; | 648 ash::Shell::RootWindowList root_windows = ash::Shell::GetAllRootWindows(); |
649 if (ash::Shell::IsLauncherPerDisplayEnabled()) | |
650 root_windows = ash::Shell::GetAllRootWindows(); | |
651 else | |
652 root_windows.push_back(ash::Shell::GetPrimaryRootWindow()); | |
653 | 649 |
654 for (ash::Shell::RootWindowList::const_iterator iter = | 650 for (ash::Shell::RootWindowList::const_iterator iter = |
655 root_windows.begin(); | 651 root_windows.begin(); |
656 iter != root_windows.end(); ++iter) { | 652 iter != root_windows.end(); ++iter) { |
657 SetShelfAutoHideBehaviorPrefs(new_behavior, *iter); | 653 SetShelfAutoHideBehaviorPrefs(new_behavior, *iter); |
658 } | 654 } |
659 } | 655 } |
660 | 656 |
661 void ChromeLauncherControllerPerBrowser::SetLauncherItemImage( | 657 void ChromeLauncherControllerPerBrowser::SetLauncherItemImage( |
662 ash::LauncherID launcher_id, | 658 ash::LauncherID launcher_id, |
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1265 profile_->GetPrefs(), root_window, prefs::kShelfAutoHideBehavior, value); | 1261 profile_->GetPrefs(), root_window, prefs::kShelfAutoHideBehavior, value); |
1266 | 1262 |
1267 if (root_window == ash::Shell::GetPrimaryRootWindow()) { | 1263 if (root_window == ash::Shell::GetPrimaryRootWindow()) { |
1268 // See comment in |kShelfAlignment| about why we have two prefs here. | 1264 // See comment in |kShelfAlignment| about why we have two prefs here. |
1269 profile_->GetPrefs()->SetString(prefs::kShelfAutoHideBehaviorLocal, value); | 1265 profile_->GetPrefs()->SetString(prefs::kShelfAutoHideBehaviorLocal, value); |
1270 profile_->GetPrefs()->SetString(prefs::kShelfAutoHideBehavior, value); | 1266 profile_->GetPrefs()->SetString(prefs::kShelfAutoHideBehavior, value); |
1271 } | 1267 } |
1272 } | 1268 } |
1273 | 1269 |
1274 void ChromeLauncherControllerPerBrowser::SetShelfAutoHideBehaviorFromPrefs() { | 1270 void ChromeLauncherControllerPerBrowser::SetShelfAutoHideBehaviorFromPrefs() { |
1275 ash::Shell::RootWindowList root_windows; | 1271 ash::Shell::RootWindowList root_windows = ash::Shell::GetAllRootWindows(); |
1276 if (ash::Shell::IsLauncherPerDisplayEnabled()) | |
1277 root_windows = ash::Shell::GetAllRootWindows(); | |
1278 else | |
1279 root_windows.push_back(ash::Shell::GetPrimaryRootWindow()); | |
1280 | 1272 |
1281 for (ash::Shell::RootWindowList::const_iterator iter = root_windows.begin(); | 1273 for (ash::Shell::RootWindowList::const_iterator iter = root_windows.begin(); |
1282 iter != root_windows.end(); ++iter) { | 1274 iter != root_windows.end(); ++iter) { |
1283 ash::Shell::GetInstance()->SetShelfAutoHideBehavior( | 1275 ash::Shell::GetInstance()->SetShelfAutoHideBehavior( |
1284 GetShelfAutoHideBehavior(*iter), *iter); | 1276 GetShelfAutoHideBehavior(*iter), *iter); |
1285 } | 1277 } |
1286 } | 1278 } |
1287 | 1279 |
1288 void ChromeLauncherControllerPerBrowser::SetShelfAlignmentFromPrefs() { | 1280 void ChromeLauncherControllerPerBrowser::SetShelfAlignmentFromPrefs() { |
1289 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 1281 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
1290 switches::kShowLauncherAlignmentMenu)) | 1282 switches::kShowLauncherAlignmentMenu)) |
1291 return; | 1283 return; |
1292 | 1284 |
1293 ash::Shell::RootWindowList root_windows; | 1285 ash::Shell::RootWindowList root_windows = ash::Shell::GetAllRootWindows(); |
1294 if (ash::Shell::IsLauncherPerDisplayEnabled()) | |
1295 root_windows = ash::Shell::GetAllRootWindows(); | |
1296 else | |
1297 root_windows.push_back(ash::Shell::GetPrimaryRootWindow()); | |
1298 | 1286 |
1299 for (ash::Shell::RootWindowList::const_iterator iter = root_windows.begin(); | 1287 for (ash::Shell::RootWindowList::const_iterator iter = root_windows.begin(); |
1300 iter != root_windows.end(); ++iter) { | 1288 iter != root_windows.end(); ++iter) { |
1301 // See comment in |kShelfAlignment| as to why we consider two prefs. | 1289 // See comment in |kShelfAlignment| as to why we consider two prefs. |
1302 const std::string alignment_value( | 1290 const std::string alignment_value( |
1303 GetPrefForRootWindow(profile_->GetPrefs(), | 1291 GetPrefForRootWindow(profile_->GetPrefs(), |
1304 *iter, | 1292 *iter, |
1305 prefs::kShelfAlignmentLocal, | 1293 prefs::kShelfAlignmentLocal, |
1306 prefs::kShelfAlignment)); | 1294 prefs::kShelfAlignment)); |
1307 ash::ShelfAlignment alignment = ash::SHELF_ALIGNMENT_BOTTOM; | 1295 ash::ShelfAlignment alignment = ash::SHELF_ALIGNMENT_BOTTOM; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1389 void ChromeLauncherControllerPerBrowser::SetAppIconLoaderForTest( | 1377 void ChromeLauncherControllerPerBrowser::SetAppIconLoaderForTest( |
1390 extensions::AppIconLoader* loader) { | 1378 extensions::AppIconLoader* loader) { |
1391 app_icon_loader_.reset(loader); | 1379 app_icon_loader_.reset(loader); |
1392 } | 1380 } |
1393 | 1381 |
1394 const std::string& | 1382 const std::string& |
1395 ChromeLauncherControllerPerBrowser::GetAppIdFromLauncherIdForTest( | 1383 ChromeLauncherControllerPerBrowser::GetAppIdFromLauncherIdForTest( |
1396 ash::LauncherID id) { | 1384 ash::LauncherID id) { |
1397 return id_to_item_controller_map_[id]->app_id(); | 1385 return id_to_item_controller_map_[id]->app_id(); |
1398 } | 1386 } |
OLD | NEW |