| 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/extensions/application_launch.h" | 5 #include "chrome/browser/ui/extensions/application_launch.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "apps/launcher.h" | 9 #include "apps/launcher.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 return web_contents; | 221 return web_contents; |
| 222 } | 222 } |
| 223 | 223 |
| 224 WebContents* OpenApplicationTab(const AppLaunchParams& launch_params, | 224 WebContents* OpenApplicationTab(const AppLaunchParams& launch_params, |
| 225 const GURL& url) { | 225 const GURL& url) { |
| 226 const Extension* extension = GetExtension(launch_params); | 226 const Extension* extension = GetExtension(launch_params); |
| 227 CHECK(extension); | 227 CHECK(extension); |
| 228 Profile* const profile = launch_params.profile; | 228 Profile* const profile = launch_params.profile; |
| 229 WindowOpenDisposition disposition = launch_params.disposition; | 229 WindowOpenDisposition disposition = launch_params.disposition; |
| 230 | 230 |
| 231 Browser* browser = chrome::FindTabbedBrowser(profile, false); | 231 Browser* browser = chrome::FindTabbedBrowserOnDisplay( |
| 232 profile, false, launch_params.display_id); |
| 232 WebContents* contents = NULL; | 233 WebContents* contents = NULL; |
| 233 if (!browser) { | 234 if (!browser) { |
| 234 // No browser for this profile, need to open a new one. | 235 // No browser for this profile, need to open a new one. |
| 235 // | 236 // |
| 236 // TODO(erg): AppLaunchParams should pass user_gesture from the extension | 237 // TODO(erg): AppLaunchParams should pass user_gesture from the extension |
| 237 // system to here. | 238 // system to here. |
| 238 browser = | 239 browser = |
| 239 new Browser(Browser::CreateParams(Browser::TYPE_TABBED, profile, true)); | 240 new Browser(Browser::CreateParams(Browser::TYPE_TABBED, profile, true)); |
| 240 browser->window()->Show(); | 241 browser->window()->Show(); |
| 241 // There's no current tab in this browser window, so add a new one. | 242 // There's no current tab in this browser window, so add a new one. |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 extensions::TabHelper::FromWebContents(tab)->UpdateShortcutOnLoadComplete(); | 417 extensions::TabHelper::FromWebContents(tab)->UpdateShortcutOnLoadComplete(); |
| 417 | 418 |
| 418 return tab; | 419 return tab; |
| 419 } | 420 } |
| 420 | 421 |
| 421 bool CanLaunchViaEvent(const extensions::Extension* extension) { | 422 bool CanLaunchViaEvent(const extensions::Extension* extension) { |
| 422 const extensions::Feature* feature = | 423 const extensions::Feature* feature = |
| 423 extensions::FeatureProvider::GetAPIFeature("app.runtime"); | 424 extensions::FeatureProvider::GetAPIFeature("app.runtime"); |
| 424 return feature && feature->IsAvailableToExtension(extension).is_available(); | 425 return feature && feature->IsAvailableToExtension(extension).is_available(); |
| 425 } | 426 } |
| OLD | NEW |