Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(223)

Side by Side Diff: chrome/browser/ui/ash/launcher/app_shortcut_launcher_item_controller.cc

Issue 14241002: Move the parsing of app.launch related keys out of Extension class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_launcher_info.h"
21 #include "content/public/browser/web_contents.h" 22 #include "content/public/browser/web_contents.h"
22 #include "ui/aura/window.h" 23 #include "ui/aura/window.h"
23 24
24 using extensions::Extension; 25 using extensions::Extension;
25 26
26 // Item controller for an app shortcut. Shortcuts track app and launcher ids, 27 // Item controller for an app shortcut. Shortcuts track app and launcher ids,
27 // but do not have any associated windows (opening a shortcut will replace the 28 // but do not have any associated windows (opening a shortcut will replace the
28 // item with the appropriate LauncherItemController type). 29 // item with the appropriate LauncherItemController type).
29 AppShortcutLauncherItemController::AppShortcutLauncherItemController( 30 AppShortcutLauncherItemController::AppShortcutLauncherItemController(
30 const std::string& app_id, 31 const std::string& app_id,
31 ChromeLauncherControllerPerApp* controller) 32 ChromeLauncherControllerPerApp* controller)
32 : LauncherItemController(TYPE_SHORTCUT, app_id, controller), 33 : LauncherItemController(TYPE_SHORTCUT, app_id, controller),
33 app_controller_(controller) { 34 app_controller_(controller) {
34 // To detect V1 applications we use their domain and match them against the 35 // To detect V1 applications we use their domain and match them against the
35 // used URL. This will also work with applications like Google Drive. 36 // used URL. This will also work with applications like Google Drive.
36 const Extension* extension = 37 const Extension* extension =
37 launcher_controller()->GetExtensionForAppID(app_id); 38 launcher_controller()->GetExtensionForAppID(app_id);
38 // Some unit tests have no real extension and will set their 39 // Some unit tests have no real extension.
39 if (extension) 40 if (extension) {
40 set_refocus_url(GURL(extension->launch_web_url() + "*")); 41 set_refocus_url(
42 GURL(extensions::AppLauncherInfo::GetLaunchWebURL(extension) + "*"));
43 }
41 } 44 }
42 45
43 AppShortcutLauncherItemController::~AppShortcutLauncherItemController() { 46 AppShortcutLauncherItemController::~AppShortcutLauncherItemController() {
44 } 47 }
45 48
46 string16 AppShortcutLauncherItemController::GetTitle() { 49 string16 AppShortcutLauncherItemController::GetTitle() {
47 return GetAppTitle(); 50 return GetAppTitle();
48 } 51 }
49 52
50 bool AppShortcutLauncherItemController::HasWindow(aura::Window* window) const { 53 bool AppShortcutLauncherItemController::HasWindow(aura::Window* window) const {
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 // - The refocus pattern is matched (needed for apps like drive). 224 // - The refocus pattern is matched (needed for apps like drive).
222 // - The extension's origin + extent gets matched. 225 // - The extension's origin + extent gets matched.
223 // - The launcher controller knows that the tab got created for this app. 226 // - The launcher controller knows that the tab got created for this app.
224 return ((!refocus_pattern.match_all_urls() && 227 return ((!refocus_pattern.match_all_urls() &&
225 refocus_pattern.MatchesURL(tab_url)) || 228 refocus_pattern.MatchesURL(tab_url)) ||
226 (extension->OverlapsWithOrigin(tab_url) && 229 (extension->OverlapsWithOrigin(tab_url) &&
227 extension->web_extent().MatchesURL(tab_url)) || 230 extension->web_extent().MatchesURL(tab_url)) ||
228 launcher_controller()->GetPerAppInterface()-> 231 launcher_controller()->GetPerAppInterface()->
229 IsWebContentHandledByApplication(web_contents, app_id())); 232 IsWebContentHandledByApplication(web_contents, app_id()));
230 } 233 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698