OLD | NEW |
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/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_layout_manager.h" | 15 #include "ash/shelf/shelf_layout_manager.h" |
16 #include "ash/shelf/shelf_model.h" | 16 #include "ash/shelf/shelf_model.h" |
17 #include "ash/shelf/shelf_model_util.h" | |
18 #include "ash/shelf/shelf_widget.h" | 17 #include "ash/shelf/shelf_widget.h" |
19 #include "ash/shell.h" | 18 #include "ash/shell.h" |
20 #include "ash/wm/window_util.h" | 19 #include "ash/wm/window_util.h" |
21 #include "base/command_line.h" | 20 #include "base/command_line.h" |
22 #include "base/prefs/scoped_user_pref_update.h" | 21 #include "base/prefs/scoped_user_pref_update.h" |
23 #include "base/strings/string_number_conversions.h" | 22 #include "base/strings/string_number_conversions.h" |
24 #include "base/strings/utf_string_conversions.h" | 23 #include "base/strings/utf_string_conversions.h" |
25 #include "base/values.h" | 24 #include "base/values.h" |
26 #include "chrome/browser/app_mode/app_mode_utils.h" | 25 #include "chrome/browser/app_mode/app_mode_utils.h" |
27 #include "chrome/browser/chrome_notification_types.h" | 26 #include "chrome/browser/chrome_notification_types.h" |
(...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1073 } else { | 1072 } else { |
1074 window->Minimize(); | 1073 window->Minimize(); |
1075 } | 1074 } |
1076 } else { | 1075 } else { |
1077 window->Show(); | 1076 window->Show(); |
1078 window->Activate(); | 1077 window->Activate(); |
1079 } | 1078 } |
1080 } | 1079 } |
1081 | 1080 |
1082 ash::LauncherID ChromeLauncherController::GetIDByWindow(aura::Window* window) { | 1081 ash::LauncherID ChromeLauncherController::GetIDByWindow(aura::Window* window) { |
1083 int browser_index = | 1082 int browser_index = model_->GetItemIndexForType(ash::TYPE_BROWSER_SHORTCUT); |
1084 ash::GetShelfItemIndexForType(ash::TYPE_BROWSER_SHORTCUT, *model_); | |
1085 DCHECK_GE(browser_index, 0); | 1083 DCHECK_GE(browser_index, 0); |
1086 ash::LauncherID browser_id = model_->items()[browser_index].id; | 1084 ash::LauncherID browser_id = model_->items()[browser_index].id; |
1087 | 1085 |
1088 IDToItemControllerMap::const_iterator i = id_to_item_controller_map_.begin(); | 1086 IDToItemControllerMap::const_iterator i = id_to_item_controller_map_.begin(); |
1089 for (; i != id_to_item_controller_map_.end(); ++i) { | 1087 for (; i != id_to_item_controller_map_.end(); ++i) { |
1090 // Since a |window| can be used by multiple applications, an explicit | 1088 // Since a |window| can be used by multiple applications, an explicit |
1091 // application always gets chosen over the generic browser. | 1089 // application always gets chosen over the generic browser. |
1092 if (i->first != browser_id && i->second->IsCurrentlyShownInWindow(window)) | 1090 if (i->first != browser_id && i->second->IsCurrentlyShownInWindow(window)) |
1093 return i->first; | 1091 return i->first; |
1094 } | 1092 } |
(...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2015 } | 2013 } |
2016 | 2014 |
2017 void ChromeLauncherController::ReleaseProfile() { | 2015 void ChromeLauncherController::ReleaseProfile() { |
2018 if (app_sync_ui_state_) | 2016 if (app_sync_ui_state_) |
2019 app_sync_ui_state_->RemoveObserver(this); | 2017 app_sync_ui_state_->RemoveObserver(this); |
2020 | 2018 |
2021 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this); | 2019 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this); |
2022 | 2020 |
2023 pref_change_registrar_.RemoveAll(); | 2021 pref_change_registrar_.RemoveAll(); |
2024 } | 2022 } |
OLD | NEW |