OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/apps/ephemeral_app_launcher.h" | 5 #include "chrome/browser/apps/ephemeral_app_launcher.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/extensions/extension_install_checker.h" | 9 #include "chrome/browser/extensions/extension_install_checker.h" |
10 #include "chrome/browser/extensions/extension_install_prompt.h" | 10 #include "chrome/browser/extensions/extension_install_prompt.h" |
11 #include "chrome/browser/extensions/extension_util.h" | 11 #include "chrome/browser/extensions/extension_util.h" |
12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/ui/browser_navigator.h" | 13 #include "chrome/browser/ui/browser_navigator.h" |
14 #include "chrome/browser/ui/extensions/app_launch_params.h" | |
15 #include "chrome/browser/ui/extensions/application_launch.h" | 14 #include "chrome/browser/ui/extensions/application_launch.h" |
16 #include "chrome/browser/ui/extensions/extension_enable_flow.h" | 15 #include "chrome/browser/ui/extensions/extension_enable_flow.h" |
17 #include "chrome/browser/ui/native_window_tracker.h" | 16 #include "chrome/browser/ui/native_window_tracker.h" |
18 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" | 17 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" |
19 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
20 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" | 19 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" |
21 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
22 #include "extensions/browser/extension_prefs.h" | 21 #include "extensions/browser/extension_prefs.h" |
23 #include "extensions/browser/extension_registry.h" | 22 #include "extensions/browser/extension_registry.h" |
24 #include "extensions/browser/extension_system.h" | 23 #include "extensions/browser/extension_system.h" |
25 #include "extensions/browser/management_policy.h" | 24 #include "extensions/browser/management_policy.h" |
26 #include "extensions/common/constants.h" | |
27 #include "extensions/common/permissions/permissions_data.h" | 25 #include "extensions/common/permissions/permissions_data.h" |
28 | 26 |
29 using content::WebContents; | 27 using content::WebContents; |
30 using extensions::Extension; | 28 using extensions::Extension; |
31 using extensions::ExtensionInstallChecker; | 29 using extensions::ExtensionInstallChecker; |
32 using extensions::ExtensionPrefs; | 30 using extensions::ExtensionPrefs; |
33 using extensions::ExtensionRegistry; | 31 using extensions::ExtensionRegistry; |
34 using extensions::ExtensionSystem; | 32 using extensions::ExtensionSystem; |
35 using extensions::ManagementPolicy; | 33 using extensions::ManagementPolicy; |
36 using extensions::WebstoreInstaller; | 34 using extensions::WebstoreInstaller; |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 } | 272 } |
275 | 273 |
276 InvokeCallback(result, error); | 274 InvokeCallback(result, error); |
277 } | 275 } |
278 | 276 |
279 void EphemeralAppLauncher::LaunchApp(const Extension* extension) const { | 277 void EphemeralAppLauncher::LaunchApp(const Extension* extension) const { |
280 DCHECK(extension && extension->is_app() && | 278 DCHECK(extension && extension->is_app() && |
281 ExtensionRegistry::Get(profile()) | 279 ExtensionRegistry::Get(profile()) |
282 ->GetExtensionById(extension->id(), ExtensionRegistry::ENABLED)); | 280 ->GetExtensionById(extension->id(), ExtensionRegistry::ENABLED)); |
283 | 281 |
284 AppLaunchParams params(profile(), extension, NEW_FOREGROUND_TAB, | 282 AppLaunchParams params(profile(), extension, NEW_FOREGROUND_TAB); |
285 extensions::SOURCE_EPHEMERAL_APP); | |
286 params.desktop_type = | 283 params.desktop_type = |
287 chrome::GetHostDesktopTypeForNativeWindow(parent_window_); | 284 chrome::GetHostDesktopTypeForNativeWindow(parent_window_); |
288 OpenApplication(params); | 285 OpenApplication(params); |
289 } | 286 } |
290 | 287 |
291 bool EphemeralAppLauncher::LaunchHostedApp(const Extension* extension) const { | 288 bool EphemeralAppLauncher::LaunchHostedApp(const Extension* extension) const { |
292 GURL launch_url = extensions::AppLaunchInfo::GetLaunchWebURL(extension); | 289 GURL launch_url = extensions::AppLaunchInfo::GetLaunchWebURL(extension); |
293 if (!launch_url.is_valid()) | 290 if (!launch_url.is_valid()) |
294 return false; | 291 return false; |
295 | 292 |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 | 465 |
469 // CompleteInstall will call Release. | 466 // CompleteInstall will call Release. |
470 WebstoreStandaloneInstaller::CompleteInstall(webstore_install::SUCCESS, | 467 WebstoreStandaloneInstaller::CompleteInstall(webstore_install::SUCCESS, |
471 std::string()); | 468 std::string()); |
472 } | 469 } |
473 | 470 |
474 void EphemeralAppLauncher::ExtensionEnableFlowAborted(bool user_initiated) { | 471 void EphemeralAppLauncher::ExtensionEnableFlowAborted(bool user_initiated) { |
475 // CompleteInstall will call Release. | 472 // CompleteInstall will call Release. |
476 CompleteInstall(webstore_install::USER_CANCELLED, kUserCancelledError); | 473 CompleteInstall(webstore_install::USER_CANCELLED, kUserCancelledError); |
477 } | 474 } |
OLD | NEW |