| 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/app_shortcut_launcher_item_controller.h
" | 5 #include "chrome/browser/ui/ash/launcher/app_shortcut_launcher_item_controller.h
" |
| 6 | 6 |
| 7 #include "ash/wm/window_util.h" | 7 #include "ash/wm/window_util.h" |
| 8 #include "chrome/browser/favicon/favicon_tab_helper.h" | 8 #include "chrome/browser/favicon/favicon_tab_helper.h" |
| 9 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item.h" | 9 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item.h" |
| 10 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_tab.h" | 10 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_tab.h" |
| 11 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 11 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| 12 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app.h" | 12 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app.h" |
| 13 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h" | 13 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h" |
| 14 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
| 15 #include "chrome/browser/ui/browser_finder.h" | 15 #include "chrome/browser/ui/browser_finder.h" |
| 16 #include "chrome/browser/ui/browser_list.h" | 16 #include "chrome/browser/ui/browser_list.h" |
| 17 #include "chrome/browser/ui/browser_window.h" | 17 #include "chrome/browser/ui/browser_window.h" |
| 18 #include "chrome/browser/ui/extensions/native_app_window.h" | 18 #include "chrome/browser/ui/extensions/native_app_window.h" |
| 19 #include "chrome/browser/ui/host_desktop.h" | 19 #include "chrome/browser/ui/host_desktop.h" |
| 20 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 20 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 21 #include "chrome/common/extensions/app_launch_manifest_handler.h" |
| 21 #include "content/public/browser/web_contents.h" | 22 #include "content/public/browser/web_contents.h" |
| 22 | 23 |
| 23 using extensions::Extension; | 24 using extensions::Extension; |
| 24 | 25 |
| 25 // Item controller for an app shortcut. Shortcuts track app and launcher ids, | 26 // Item controller for an app shortcut. Shortcuts track app and launcher ids, |
| 26 // but do not have any associated windows (opening a shortcut will replace the | 27 // but do not have any associated windows (opening a shortcut will replace the |
| 27 // item with the appropriate LauncherItemController type). | 28 // item with the appropriate LauncherItemController type). |
| 28 AppShortcutLauncherItemController::AppShortcutLauncherItemController( | 29 AppShortcutLauncherItemController::AppShortcutLauncherItemController( |
| 29 const std::string& app_id, | 30 const std::string& app_id, |
| 30 ChromeLauncherControllerPerApp* controller) | 31 ChromeLauncherControllerPerApp* controller) |
| 31 : LauncherItemController(TYPE_SHORTCUT, app_id, controller), | 32 : LauncherItemController(TYPE_SHORTCUT, app_id, controller), |
| 32 app_controller_(controller) { | 33 app_controller_(controller) { |
| 33 // To detect V1 applications we use their domain and match them against the | 34 // To detect V1 applications we use their domain and match them against the |
| 34 // used URL. This will also work with applications like Google Drive. | 35 // used URL. This will also work with applications like Google Drive. |
| 35 const Extension* extension = | 36 const Extension* extension = |
| 36 launcher_controller()->GetExtensionForAppID(app_id); | 37 launcher_controller()->GetExtensionForAppID(app_id); |
| 37 // Some unit tests have no real extension and will set their | 38 // Some unit tests have no real extension. |
| 38 if (extension) | 39 if (extension) { |
| 39 refocus_url_ = GURL(extension->launch_web_url() + "*"); | 40 refocus_url_ = |
| 41 GURL(extensions::AppLaunchInfo::GetLaunchWebUrl(extension) + "*"); |
| 42 } |
| 40 } | 43 } |
| 41 | 44 |
| 42 AppShortcutLauncherItemController::~AppShortcutLauncherItemController() { | 45 AppShortcutLauncherItemController::~AppShortcutLauncherItemController() { |
| 43 } | 46 } |
| 44 | 47 |
| 45 string16 AppShortcutLauncherItemController::GetTitle() { | 48 string16 AppShortcutLauncherItemController::GetTitle() { |
| 46 return GetAppTitle(); | 49 return GetAppTitle(); |
| 47 } | 50 } |
| 48 | 51 |
| 49 bool AppShortcutLauncherItemController::HasWindow(aura::Window* window) const { | 52 bool AppShortcutLauncherItemController::HasWindow(aura::Window* window) const { |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 refocus_pattern.MatchesURL(tab_url)) || | 174 refocus_pattern.MatchesURL(tab_url)) || |
| 172 (extension->OverlapsWithOrigin(tab_url) && | 175 (extension->OverlapsWithOrigin(tab_url) && |
| 173 extension->web_extent().MatchesURL(tab_url)) || | 176 extension->web_extent().MatchesURL(tab_url)) || |
| 174 launcher_controller()->GetPerAppInterface()-> | 177 launcher_controller()->GetPerAppInterface()-> |
| 175 IsWebContentHandledByApplication(web_contents, app_id())) | 178 IsWebContentHandledByApplication(web_contents, app_id())) |
| 176 items.push_back(web_contents); | 179 items.push_back(web_contents); |
| 177 } | 180 } |
| 178 } | 181 } |
| 179 return items; | 182 return items; |
| 180 } | 183 } |
| OLD | NEW |