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/launcher/launcher_model.h" | 9 #include "ash/launcher/launcher_model.h" |
10 #include "ash/launcher/launcher_util.h" | 10 #include "ash/launcher/launcher_util.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "chrome/browser/ui/ash/launcher/launcher_app_tab_helper.h" | 32 #include "chrome/browser/ui/ash/launcher/launcher_app_tab_helper.h" |
33 #include "chrome/browser/ui/ash/launcher/launcher_application_menu_item_model.h" | 33 #include "chrome/browser/ui/ash/launcher/launcher_application_menu_item_model.h" |
34 #include "chrome/browser/ui/ash/launcher/launcher_context_menu.h" | 34 #include "chrome/browser/ui/ash/launcher/launcher_context_menu.h" |
35 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h" | 35 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h" |
36 #include "chrome/browser/ui/ash/launcher/shell_window_launcher_controller.h" | 36 #include "chrome/browser/ui/ash/launcher/shell_window_launcher_controller.h" |
37 #include "chrome/browser/ui/ash/launcher/shell_window_launcher_item_controller.h
" | 37 #include "chrome/browser/ui/ash/launcher/shell_window_launcher_item_controller.h
" |
38 #include "chrome/browser/ui/browser.h" | 38 #include "chrome/browser/ui/browser.h" |
39 #include "chrome/browser/ui/browser_commands.h" | 39 #include "chrome/browser/ui/browser_commands.h" |
40 #include "chrome/browser/ui/browser_finder.h" | 40 #include "chrome/browser/ui/browser_finder.h" |
41 #include "chrome/browser/ui/browser_list.h" | 41 #include "chrome/browser/ui/browser_list.h" |
| 42 #include "chrome/browser/ui/browser_list_impl.h" |
42 #include "chrome/browser/ui/browser_tabstrip.h" | 43 #include "chrome/browser/ui/browser_tabstrip.h" |
43 #include "chrome/browser/ui/browser_window.h" | 44 #include "chrome/browser/ui/browser_window.h" |
44 #include "chrome/browser/ui/extensions/application_launch.h" | 45 #include "chrome/browser/ui/extensions/application_launch.h" |
45 #include "chrome/browser/ui/extensions/extension_enable_flow.h" | 46 #include "chrome/browser/ui/extensions/extension_enable_flow.h" |
| 47 #include "chrome/browser/ui/host_desktop.h" |
46 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 48 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
47 #include "chrome/browser/web_applications/web_app.h" | 49 #include "chrome/browser/web_applications/web_app.h" |
48 #include "chrome/common/chrome_notification_types.h" | 50 #include "chrome/common/chrome_notification_types.h" |
49 #include "chrome/common/chrome_switches.h" | 51 #include "chrome/common/chrome_switches.h" |
50 #include "chrome/common/extensions/extension.h" | 52 #include "chrome/common/extensions/extension.h" |
51 #include "chrome/common/extensions/extension_resource.h" | 53 #include "chrome/common/extensions/extension_resource.h" |
52 #include "chrome/common/pref_names.h" | 54 #include "chrome/common/pref_names.h" |
53 #include "chrome/common/url_constants.h" | 55 #include "chrome/common/url_constants.h" |
54 #include "content/public/browser/navigation_entry.h" | 56 #include "content/public/browser/navigation_entry.h" |
55 #include "content/public/browser/notification_service.h" | 57 #include "content/public/browser/notification_service.h" |
(...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1091 void ChromeLauncherControllerPerApp::UpdateBrowserItemStatus() { | 1093 void ChromeLauncherControllerPerApp::UpdateBrowserItemStatus() { |
1092 // Determine the new browser's active state and change if necessary. | 1094 // Determine the new browser's active state and change if necessary. |
1093 int browser_index = ash::launcher::GetBrowserItemIndex(*model_); | 1095 int browser_index = ash::launcher::GetBrowserItemIndex(*model_); |
1094 DCHECK(browser_index >= 0); | 1096 DCHECK(browser_index >= 0); |
1095 ash::LauncherItem browser_item = model_->items()[browser_index]; | 1097 ash::LauncherItem browser_item = model_->items()[browser_index]; |
1096 ash::LauncherItemStatus browser_status = browser_item.status; | 1098 ash::LauncherItemStatus browser_status = browser_item.status; |
1097 // See if the active window is a browser. | 1099 // See if the active window is a browser. |
1098 aura::Window* window = ash::wm::GetActiveWindow(); | 1100 aura::Window* window = ash::wm::GetActiveWindow(); |
1099 if (window && chrome::FindBrowserWithWindow(window)) { | 1101 if (window && chrome::FindBrowserWithWindow(window)) { |
1100 browser_status = ash::STATUS_ACTIVE; | 1102 browser_status = ash::STATUS_ACTIVE; |
1101 } else if (!BrowserList::empty()) { | 1103 } else if (!chrome::BrowserListImpl::GetInstance( |
| 1104 chrome::HOST_DESKTOP_TYPE_ASH)->empty()) { |
1102 browser_status = ash::STATUS_RUNNING; | 1105 browser_status = ash::STATUS_RUNNING; |
1103 } else { | 1106 } else { |
1104 browser_status = ash::STATUS_CLOSED; | 1107 browser_status = ash::STATUS_CLOSED; |
1105 } | 1108 } |
1106 if (browser_status != browser_item.status) { | 1109 if (browser_status != browser_item.status) { |
1107 browser_item.status = browser_status; | 1110 browser_item.status = browser_status; |
1108 model_->Set(browser_index, browser_item); | 1111 model_->Set(browser_index, browser_item); |
1109 } | 1112 } |
1110 } | 1113 } |
1111 | 1114 |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1383 web_contents->GetTitle(), | 1386 web_contents->GetTitle(), |
1384 app_icon.IsEmpty() ? NULL : &app_icon, | 1387 app_icon.IsEmpty() ? NULL : &app_icon, |
1385 browser)); | 1388 browser)); |
1386 } | 1389 } |
1387 // If only windowed applications are open, we return an empty list to | 1390 // If only windowed applications are open, we return an empty list to |
1388 // enforce the creation of a new browser. | 1391 // enforce the creation of a new browser. |
1389 if (!found_tabbed_browser) | 1392 if (!found_tabbed_browser) |
1390 items.clear(); | 1393 items.clear(); |
1391 return items.Pass(); | 1394 return items.Pass(); |
1392 } | 1395 } |
OLD | NEW |