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 993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1021 DCHECK(contents); | 1020 DCHECK(contents); |
1022 | 1021 |
1023 std::string app_id = app_tab_helper_->GetAppID(contents); | 1022 std::string app_id = app_tab_helper_->GetAppID(contents); |
1024 | 1023 |
1025 if (app_id.empty() && ContentCanBeHandledByGmailApp(contents)) | 1024 if (app_id.empty() && ContentCanBeHandledByGmailApp(contents)) |
1026 app_id = kGmailAppId; | 1025 app_id = kGmailAppId; |
1027 | 1026 |
1028 ash::LauncherID id = GetLauncherIDForAppID(app_id); | 1027 ash::LauncherID id = GetLauncherIDForAppID(app_id); |
1029 | 1028 |
1030 if (app_id.empty() || !id) { | 1029 if (app_id.empty() || !id) { |
1031 int browser_index = | 1030 int browser_index = model_->GetItemIndexForType(ash::TYPE_BROWSER_SHORTCUT); |
1032 ash::GetShelfItemIndexForType(ash::TYPE_BROWSER_SHORTCUT, *model_); | |
1033 return model_->items()[browser_index].id; | 1031 return model_->items()[browser_index].id; |
1034 } | 1032 } |
1035 | 1033 |
1036 return id; | 1034 return id; |
1037 } | 1035 } |
1038 | 1036 |
1039 void ChromeLauncherController::SetRefocusURLPatternForTest(ash::LauncherID id, | 1037 void ChromeLauncherController::SetRefocusURLPatternForTest(ash::LauncherID id, |
1040 const GURL& url) { | 1038 const GURL& url) { |
1041 DCHECK(HasItemController(id)); | 1039 DCHECK(HasItemController(id)); |
1042 LauncherItemController* controller = id_to_item_controller_map_[id]; | 1040 LauncherItemController* controller = id_to_item_controller_map_[id]; |
(...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2013 } | 2011 } |
2014 | 2012 |
2015 void ChromeLauncherController::ReleaseProfile() { | 2013 void ChromeLauncherController::ReleaseProfile() { |
2016 if (app_sync_ui_state_) | 2014 if (app_sync_ui_state_) |
2017 app_sync_ui_state_->RemoveObserver(this); | 2015 app_sync_ui_state_->RemoveObserver(this); |
2018 | 2016 |
2019 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this); | 2017 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this); |
2020 | 2018 |
2021 pref_change_registrar_.RemoveAll(); | 2019 pref_change_registrar_.RemoveAll(); |
2022 } | 2020 } |
OLD | NEW |