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

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

Issue 27369004: Change GetBrowserItemIndex() to GetLauncherItemIndexForType() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix clang error Created 7 years, 2 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 <vector> 7 #include <vector>
8 8
9 #include "ash/ash_switches.h" 9 #include "ash/ash_switches.h"
10 #include "ash/desktop_background/desktop_background_controller.h" 10 #include "ash/desktop_background/desktop_background_controller.h"
11 #include "ash/launcher/launcher.h" 11 #include "ash/launcher/launcher.h"
12 #include "ash/launcher/launcher_item_delegate_manager.h" 12 #include "ash/launcher/launcher_item_delegate_manager.h"
13 #include "ash/launcher/launcher_model.h" 13 #include "ash/launcher/launcher_model.h"
14 #include "ash/launcher/launcher_model_util.h"
14 #include "ash/root_window_controller.h" 15 #include "ash/root_window_controller.h"
15 #include "ash/shelf/shelf_layout_manager.h" 16 #include "ash/shelf/shelf_layout_manager.h"
16 #include "ash/shelf/shelf_util.h"
17 #include "ash/shelf/shelf_widget.h" 17 #include "ash/shelf/shelf_widget.h"
18 #include "ash/shell.h" 18 #include "ash/shell.h"
19 #include "ash/wm/window_util.h" 19 #include "ash/wm/window_util.h"
20 #include "base/command_line.h" 20 #include "base/command_line.h"
21 #include "base/strings/string_number_conversions.h" 21 #include "base/strings/string_number_conversions.h"
22 #include "base/strings/utf_string_conversions.h" 22 #include "base/strings/utf_string_conversions.h"
23 #include "base/values.h" 23 #include "base/values.h"
24 #include "chrome/browser/app_mode/app_mode_utils.h" 24 #include "chrome/browser/app_mode/app_mode_utils.h"
25 #include "chrome/browser/chrome_notification_types.h" 25 #include "chrome/browser/chrome_notification_types.h"
26 #include "chrome/browser/defaults.h" 26 #include "chrome/browser/defaults.h"
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 } else { 955 } else {
956 window->Minimize(); 956 window->Minimize();
957 } 957 }
958 } else { 958 } else {
959 window->Show(); 959 window->Show();
960 window->Activate(); 960 window->Activate();
961 } 961 }
962 } 962 }
963 963
964 ash::LauncherID ChromeLauncherController::GetIDByWindow(aura::Window* window) { 964 ash::LauncherID ChromeLauncherController::GetIDByWindow(aura::Window* window) {
965 int browser_index = ash::GetBrowserItemIndex(*model_); 965 int browser_index =
966 ash::GetLauncherItemIndexForType(ash::TYPE_BROWSER_SHORTCUT, *model_);
966 DCHECK_GE(browser_index, 0); 967 DCHECK_GE(browser_index, 0);
967 ash::LauncherID browser_id = model_->items()[browser_index].id; 968 ash::LauncherID browser_id = model_->items()[browser_index].id;
968 969
969 IDToItemControllerMap::const_iterator i = id_to_item_controller_map_.begin(); 970 IDToItemControllerMap::const_iterator i = id_to_item_controller_map_.begin();
970 for (; i != id_to_item_controller_map_.end(); ++i) { 971 for (; i != id_to_item_controller_map_.end(); ++i) {
971 // Since a |window| can be used by multiple applications, an explicit 972 // Since a |window| can be used by multiple applications, an explicit
972 // application always gets chosen over the generic browser. 973 // application always gets chosen over the generic browser.
973 if (i->first != browser_id && i->second->IsCurrentlyShownInWindow(window)) 974 if (i->first != browser_id && i->second->IsCurrentlyShownInWindow(window))
974 return i->first; 975 return i->first;
975 } 976 }
(...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after
1879 } 1880 }
1880 1881
1881 void ChromeLauncherController::ReleaseProfile() { 1882 void ChromeLauncherController::ReleaseProfile() {
1882 if (app_sync_ui_state_) 1883 if (app_sync_ui_state_)
1883 app_sync_ui_state_->RemoveObserver(this); 1884 app_sync_ui_state_->RemoveObserver(this);
1884 1885
1885 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this); 1886 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this);
1886 1887
1887 pref_change_registrar_.RemoveAll(); 1888 pref_change_registrar_.RemoveAll();
1888 } 1889 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698