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

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

Issue 22007003: ash: Rename "Autohide launcher" item. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: just shelf Created 7 years, 4 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 | Annotate | Revision Log
OLDNEW
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 1378 matching lines...) Expand 10 before | Expand all | Expand 10 after
1389 } 1389 }
1390 1390
1391 // Walk the model and |pinned_apps| from the pref lockstep, adding and 1391 // Walk the model and |pinned_apps| from the pref lockstep, adding and
1392 // removing items as necessary. NB: This code uses plain old indexing instead 1392 // removing items as necessary. NB: This code uses plain old indexing instead
1393 // of iterators because of model mutations as part of the loop. 1393 // of iterators because of model mutations as part of the loop.
1394 std::vector<std::string>::const_iterator pref_app_id(pinned_apps.begin()); 1394 std::vector<std::string>::const_iterator pref_app_id(pinned_apps.begin());
1395 int index = 0; 1395 int index = 0;
1396 int max_index = model_->item_count(); 1396 int max_index = model_->item_count();
1397 // Using the alternate shelf layout the App Icon should be the first item in 1397 // Using the alternate shelf layout the App Icon should be the first item in
1398 // the list thus start adding items at slot 1 (instead of slot 0). 1398 // the list thus start adding items at slot 1 (instead of slot 0).
1399 if(ash::switches::UseAlternateShelfLayout()) { 1399 if (ash::switches::UseAlternateShelfLayout()) {
1400 ++index; 1400 ++index;
1401 ++max_index; 1401 ++max_index;
1402 } 1402 }
1403 for (; index < max_index && pref_app_id != pinned_apps.end(); ++index) { 1403 for (; index < max_index && pref_app_id != pinned_apps.end(); ++index) {
1404 // If the next app launcher according to the pref is present in the model, 1404 // If the next app launcher according to the pref is present in the model,
1405 // delete all app launcher entries in between. 1405 // delete all app launcher entries in between.
1406 if (*pref_app_id == extension_misc::kChromeAppId || 1406 if (*pref_app_id == extension_misc::kChromeAppId ||
1407 IsAppPinned(*pref_app_id)) { 1407 IsAppPinned(*pref_app_id)) {
1408 for (; index < max_index; ++index) { 1408 for (; index < max_index; ++index) {
1409 const ash::LauncherItem& item(model_->items()[index]); 1409 const ash::LauncherItem& item(model_->items()[index]);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1494 1494
1495 for (ash::Shell::RootWindowList::const_iterator iter = root_windows.begin(); 1495 for (ash::Shell::RootWindowList::const_iterator iter = root_windows.begin();
1496 iter != root_windows.end(); ++iter) { 1496 iter != root_windows.end(); ++iter) {
1497 ash::Shell::GetInstance()->SetShelfAutoHideBehavior( 1497 ash::Shell::GetInstance()->SetShelfAutoHideBehavior(
1498 GetShelfAutoHideBehavior(*iter), *iter); 1498 GetShelfAutoHideBehavior(*iter), *iter);
1499 } 1499 }
1500 } 1500 }
1501 1501
1502 void ChromeLauncherControllerPerApp::SetShelfAlignmentFromPrefs() { 1502 void ChromeLauncherControllerPerApp::SetShelfAlignmentFromPrefs() {
1503 if (!CommandLine::ForCurrentProcess()->HasSwitch( 1503 if (!CommandLine::ForCurrentProcess()->HasSwitch(
1504 switches::kShowLauncherAlignmentMenu)) 1504 switches::kShowShelfAlignmentMenu))
1505 return; 1505 return;
1506 1506
1507 ash::Shell::RootWindowList root_windows = ash::Shell::GetAllRootWindows(); 1507 ash::Shell::RootWindowList root_windows = ash::Shell::GetAllRootWindows();
1508 1508
1509 for (ash::Shell::RootWindowList::const_iterator iter = root_windows.begin(); 1509 for (ash::Shell::RootWindowList::const_iterator iter = root_windows.begin();
1510 iter != root_windows.end(); ++iter) { 1510 iter != root_windows.end(); ++iter) {
1511 // See comment in |kShelfAlignment| as to why we consider two prefs. 1511 // See comment in |kShelfAlignment| as to why we consider two prefs.
1512 const std::string alignment_value( 1512 const std::string alignment_value(
1513 GetPrefForRootWindow(profile_->GetPrefs(), 1513 GetPrefForRootWindow(profile_->GetPrefs(),
1514 *iter, 1514 *iter,
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
1680 browser_to_close.pop_back(); 1680 browser_to_close.pop_back();
1681 } 1681 }
1682 } 1682 }
1683 1683
1684 void 1684 void
1685 ChromeLauncherControllerPerApp::MoveItemWithoutPinnedStateChangeNotification( 1685 ChromeLauncherControllerPerApp::MoveItemWithoutPinnedStateChangeNotification(
1686 int source_index, int target_index) { 1686 int source_index, int target_index) {
1687 base::AutoReset<bool> auto_reset(&ignore_persist_pinned_state_change_, true); 1687 base::AutoReset<bool> auto_reset(&ignore_persist_pinned_state_change_, true);
1688 model_->Move(source_index, target_index); 1688 model_->Move(source_index, target_index);
1689 } 1689 }
OLDNEW
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_browser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698