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_app.h" | 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
10 #include "ash/launcher/launcher.h" | 10 #include "ash/launcher/launcher.h" |
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 continue; | 606 continue; |
607 ash::LauncherItem item = model_->items()[index]; | 607 ash::LauncherItem item = model_->items()[index]; |
608 item.image = image; | 608 item.image = image; |
609 model_->Set(index, item); | 609 model_->Set(index, item); |
610 // It's possible we're waiting on more than one item, so don't break. | 610 // It's possible we're waiting on more than one item, so don't break. |
611 } | 611 } |
612 } | 612 } |
613 | 613 |
614 void ChromeLauncherControllerPerApp::OnAutoHideBehaviorChanged( | 614 void ChromeLauncherControllerPerApp::OnAutoHideBehaviorChanged( |
615 ash::ShelfAutoHideBehavior new_behavior) { | 615 ash::ShelfAutoHideBehavior new_behavior) { |
616 ash::Shell::RootWindowList root_windows; | 616 ash::Shell::RootWindowList root_windows = ash::Shell::GetAllRootWindows(); |
617 if (ash::Shell::IsLauncherPerDisplayEnabled()) | |
618 root_windows = ash::Shell::GetAllRootWindows(); | |
619 else | |
620 root_windows.push_back(ash::Shell::GetPrimaryRootWindow()); | |
621 | 617 |
622 for (ash::Shell::RootWindowList::const_iterator iter = | 618 for (ash::Shell::RootWindowList::const_iterator iter = |
623 root_windows.begin(); | 619 root_windows.begin(); |
624 iter != root_windows.end(); ++iter) { | 620 iter != root_windows.end(); ++iter) { |
625 SetShelfAutoHideBehaviorPrefs(new_behavior, *iter); | 621 SetShelfAutoHideBehaviorPrefs(new_behavior, *iter); |
626 } | 622 } |
627 } | 623 } |
628 | 624 |
629 void ChromeLauncherControllerPerApp::SetLauncherItemImage( | 625 void ChromeLauncherControllerPerApp::SetLauncherItemImage( |
630 ash::LauncherID launcher_id, | 626 ash::LauncherID launcher_id, |
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1493 profile_->GetPrefs(), root_window, prefs::kShelfAutoHideBehavior, value); | 1489 profile_->GetPrefs(), root_window, prefs::kShelfAutoHideBehavior, value); |
1494 | 1490 |
1495 if (root_window == ash::Shell::GetPrimaryRootWindow()) { | 1491 if (root_window == ash::Shell::GetPrimaryRootWindow()) { |
1496 // See comment in |kShelfAlignment| about why we have two prefs here. | 1492 // See comment in |kShelfAlignment| about why we have two prefs here. |
1497 profile_->GetPrefs()->SetString(prefs::kShelfAutoHideBehaviorLocal, value); | 1493 profile_->GetPrefs()->SetString(prefs::kShelfAutoHideBehaviorLocal, value); |
1498 profile_->GetPrefs()->SetString(prefs::kShelfAutoHideBehavior, value); | 1494 profile_->GetPrefs()->SetString(prefs::kShelfAutoHideBehavior, value); |
1499 } | 1495 } |
1500 } | 1496 } |
1501 | 1497 |
1502 void ChromeLauncherControllerPerApp::SetShelfAutoHideBehaviorFromPrefs() { | 1498 void ChromeLauncherControllerPerApp::SetShelfAutoHideBehaviorFromPrefs() { |
1503 ash::Shell::RootWindowList root_windows; | 1499 ash::Shell::RootWindowList root_windows = ash::Shell::GetAllRootWindows(); |
1504 if (ash::Shell::IsLauncherPerDisplayEnabled()) | |
1505 root_windows = ash::Shell::GetAllRootWindows(); | |
1506 else | |
1507 root_windows.push_back(ash::Shell::GetPrimaryRootWindow()); | |
1508 | 1500 |
1509 for (ash::Shell::RootWindowList::const_iterator iter = root_windows.begin(); | 1501 for (ash::Shell::RootWindowList::const_iterator iter = root_windows.begin(); |
1510 iter != root_windows.end(); ++iter) { | 1502 iter != root_windows.end(); ++iter) { |
1511 ash::Shell::GetInstance()->SetShelfAutoHideBehavior( | 1503 ash::Shell::GetInstance()->SetShelfAutoHideBehavior( |
1512 GetShelfAutoHideBehavior(*iter), *iter); | 1504 GetShelfAutoHideBehavior(*iter), *iter); |
1513 } | 1505 } |
1514 } | 1506 } |
1515 | 1507 |
1516 void ChromeLauncherControllerPerApp::SetShelfAlignmentFromPrefs() { | 1508 void ChromeLauncherControllerPerApp::SetShelfAlignmentFromPrefs() { |
1517 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 1509 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
1518 switches::kShowLauncherAlignmentMenu)) | 1510 switches::kShowLauncherAlignmentMenu)) |
1519 return; | 1511 return; |
1520 | 1512 |
1521 ash::Shell::RootWindowList root_windows; | 1513 ash::Shell::RootWindowList root_windows = ash::Shell::GetAllRootWindows(); |
1522 if (ash::Shell::IsLauncherPerDisplayEnabled()) | 1514 |
1523 root_windows = ash::Shell::GetAllRootWindows(); | |
1524 else | |
1525 root_windows.push_back(ash::Shell::GetPrimaryRootWindow()); | |
1526 for (ash::Shell::RootWindowList::const_iterator iter = root_windows.begin(); | 1515 for (ash::Shell::RootWindowList::const_iterator iter = root_windows.begin(); |
1527 iter != root_windows.end(); ++iter) { | 1516 iter != root_windows.end(); ++iter) { |
1528 // See comment in |kShelfAlignment| as to why we consider two prefs. | 1517 // See comment in |kShelfAlignment| as to why we consider two prefs. |
1529 const std::string alignment_value( | 1518 const std::string alignment_value( |
1530 GetPrefForRootWindow(profile_->GetPrefs(), | 1519 GetPrefForRootWindow(profile_->GetPrefs(), |
1531 *iter, | 1520 *iter, |
1532 prefs::kShelfAlignmentLocal, | 1521 prefs::kShelfAlignmentLocal, |
1533 prefs::kShelfAlignment)); | 1522 prefs::kShelfAlignment)); |
1534 ash::ShelfAlignment alignment = ash::SHELF_ALIGNMENT_BOTTOM; | 1523 ash::ShelfAlignment alignment = ash::SHELF_ALIGNMENT_BOTTOM; |
1535 if (alignment_value == ash::kShelfAlignmentLeft) | 1524 if (alignment_value == ash::kShelfAlignmentLeft) |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1717 browser = chrome::FindTabbedBrowser( | 1706 browser = chrome::FindTabbedBrowser( |
1718 GetProfileForNewWindows(), true, chrome::HOST_DESKTOP_TYPE_ASH); | 1707 GetProfileForNewWindows(), true, chrome::HOST_DESKTOP_TYPE_ASH); |
1719 if (!browser || !IsBrowserRepresentedInBrowserList(browser)) | 1708 if (!browser || !IsBrowserRepresentedInBrowserList(browser)) |
1720 browser = items[0]; | 1709 browser = items[0]; |
1721 } | 1710 } |
1722 } | 1711 } |
1723 DCHECK(browser); | 1712 DCHECK(browser); |
1724 browser->window()->Show(); | 1713 browser->window()->Show(); |
1725 browser->window()->Activate(); | 1714 browser->window()->Activate(); |
1726 } | 1715 } |
OLD | NEW |