| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/browser_shortcut_launcher_item_controll
er.h" | 5 #include "chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controll
er.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "ash/shelf/shelf.h" | 9 #include "ash/shelf/shelf.h" |
| 10 #include "ash/shelf/shelf_model.h" | 10 #include "ash/shelf/shelf_model.h" |
| 11 #include "ash/shelf/shelf_util.h" | 11 #include "ash/shelf/shelf_util.h" |
| 12 #include "ash/shell.h" | 12 #include "ash/shell.h" |
| 13 #include "ash/wm/window_util.h" | 13 #include "ash/wm/window_util.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item.h" | 15 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item.h" |
| 16 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_browser.h
" | 16 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_browser.h
" |
| 17 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_tab.h" | 17 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_tab.h" |
| 18 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 18 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| 19 #include "chrome/browser/ui/ash/launcher/launcher_application_menu_item_model.h" | 19 #include "chrome/browser/ui/ash/launcher/launcher_application_menu_item_model.h" |
| 20 #include "chrome/browser/ui/ash/launcher/launcher_context_menu.h" | 20 #include "chrome/browser/ui/ash/launcher/launcher_context_menu.h" |
| 21 #include "chrome/browser/ui/browser.h" | 21 #include "chrome/browser/ui/browser.h" |
| 22 #include "chrome/browser/ui/browser_finder.h" | 22 #include "chrome/browser/ui/browser_finder.h" |
| 23 #include "chrome/browser/ui/browser_list.h" | 23 #include "chrome/browser/ui/browser_list.h" |
| 24 #include "chrome/browser/ui/browser_window.h" | 24 #include "chrome/browser/ui/browser_window.h" |
| 25 #include "chrome/browser/ui/chrome_pages.h" | |
| 26 #include "chrome/browser/ui/settings_window_manager.h" | 25 #include "chrome/browser/ui/settings_window_manager.h" |
| 27 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 26 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 28 #include "chrome/browser/web_applications/web_app.h" | 27 #include "chrome/browser/web_applications/web_app.h" |
| 29 #include "chrome/common/extensions/extension_constants.h" | 28 #include "chrome/common/extensions/extension_constants.h" |
| 30 #include "chrome/grit/chromium_strings.h" | 29 #include "chrome/grit/chromium_strings.h" |
| 31 #include "chrome/grit/generated_resources.h" | 30 #include "chrome/grit/generated_resources.h" |
| 32 #include "content/public/browser/web_contents.h" | 31 #include "content/public/browser/web_contents.h" |
| 33 #include "content/public/common/url_constants.h" | 32 #include "content/public/common/url_constants.h" |
| 34 #include "grit/ash_resources.h" | 33 #include "grit/ash_resources.h" |
| 35 #include "ui/aura/window.h" | 34 #include "ui/aura/window.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 } | 101 } |
| 103 | 102 |
| 104 void BrowserShortcutLauncherItemController::SetShelfIDForBrowserWindowContents( | 103 void BrowserShortcutLauncherItemController::SetShelfIDForBrowserWindowContents( |
| 105 Browser* browser, | 104 Browser* browser, |
| 106 content::WebContents* web_contents) { | 105 content::WebContents* web_contents) { |
| 107 // We need to call SetShelfIDForWindow for V1 applications since they are | 106 // We need to call SetShelfIDForWindow for V1 applications since they are |
| 108 // content which might change and as such change the application type. | 107 // content which might change and as such change the application type. |
| 109 if (!browser || | 108 if (!browser || |
| 110 !launcher_controller()->IsBrowserFromActiveUser(browser) || | 109 !launcher_controller()->IsBrowserFromActiveUser(browser) || |
| 111 browser->host_desktop_type() != chrome::HOST_DESKTOP_TYPE_ASH || | 110 browser->host_desktop_type() != chrome::HOST_DESKTOP_TYPE_ASH || |
| 112 chrome::IsTrustedPopupWindowWithScheme(browser, content::kChromeUIScheme)) | 111 chrome::SettingsWindowManager::GetInstance()->IsSettingsBrowser(browser)) |
| 113 return; | 112 return; |
| 114 | 113 |
| 115 ash::SetShelfIDForWindow( | 114 ash::SetShelfIDForWindow( |
| 116 launcher_controller()->GetShelfIDForWebContents(web_contents), | 115 launcher_controller()->GetShelfIDForWebContents(web_contents), |
| 117 browser->window()->GetNativeWindow()); | 116 browser->window()->GetNativeWindow()); |
| 118 } | 117 } |
| 119 | 118 |
| 120 bool BrowserShortcutLauncherItemController::IsOpen() const { | 119 bool BrowserShortcutLauncherItemController::IsOpen() const { |
| 121 const BrowserList* ash_browser_list = | 120 const BrowserList* ash_browser_list = |
| 122 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH); | 121 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH); |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 browser->host_desktop_type() != chrome::HOST_DESKTOP_TYPE_ASH) | 341 browser->host_desktop_type() != chrome::HOST_DESKTOP_TYPE_ASH) |
| 343 return false; | 342 return false; |
| 344 | 343 |
| 345 // v1 App popup windows with a valid app id have their own icon. | 344 // v1 App popup windows with a valid app id have their own icon. |
| 346 if (browser->is_app() && | 345 if (browser->is_app() && |
| 347 browser->is_type_popup() && | 346 browser->is_type_popup() && |
| 348 launcher_controller()->GetShelfIDForAppID( | 347 launcher_controller()->GetShelfIDForAppID( |
| 349 web_app::GetExtensionIdFromApplicationName(browser->app_name())) > 0) | 348 web_app::GetExtensionIdFromApplicationName(browser->app_name())) > 0) |
| 350 return false; | 349 return false; |
| 351 | 350 |
| 352 // Stand-alone chrome:// windows (e.g. settings) have their own icon. | 351 // Settings windows have their own icon. |
| 353 if (chrome::IsTrustedPopupWindowWithScheme(browser, content::kChromeUIScheme)) | 352 if (chrome::SettingsWindowManager::GetInstance()->IsSettingsBrowser(browser)) |
| 354 return false; | 353 return false; |
| 355 | 354 |
| 356 // Tabbed browser and other popup windows are all represented. | 355 // Tabbed browser and other popup windows are all represented. |
| 357 return true; | 356 return true; |
| 358 } | 357 } |
| OLD | NEW |