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 "chrome/browser/chrome_notification_types.h" | 7 #include "chrome/browser/chrome_notification_types.h" |
8 #include "chrome/browser/extensions/extension_install_prompt.h" | 8 #include "chrome/browser/extensions/extension_install_prompt.h" |
9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
10 #include "chrome/browser/extensions/extension_util.h" | 10 #include "chrome/browser/extensions/extension_util.h" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/ui/extensions/application_launch.h" | 12 #include "chrome/browser/ui/extensions/application_launch.h" |
13 #include "chrome/browser/ui/extensions/extension_enable_flow.h" | 13 #include "chrome/browser/ui/extensions/extension_enable_flow.h" |
14 #include "content/public/browser/browser_thread.h" | |
15 #include "content/public/browser/notification_details.h" | 14 #include "content/public/browser/notification_details.h" |
16 #include "content/public/browser/notification_source.h" | 15 #include "content/public/browser/notification_source.h" |
17 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
18 #include "content/public/browser/web_contents_view.h" | 17 #include "content/public/browser/web_contents_view.h" |
19 #include "extensions/browser/extension_system.h" | 18 #include "extensions/browser/extension_system.h" |
20 #include "extensions/common/permissions/permissions_data.h" | 19 #include "extensions/common/permissions/permissions_data.h" |
21 | 20 |
22 using content::WebContents; | 21 using content::WebContents; |
23 using extensions::Extension; | 22 using extensions::Extension; |
24 using extensions::ExtensionSystem; | 23 using extensions::ExtensionSystem; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 // more permissions. In this case we should always prompt before | 92 // more permissions. In this case we should always prompt before |
94 // launching. | 93 // launching. |
95 extension_enable_flow_.reset( | 94 extension_enable_flow_.reset( |
96 new ExtensionEnableFlow(profile(), extension->id(), this)); | 95 new ExtensionEnableFlow(profile(), extension->id(), this)); |
97 if (web_contents()) | 96 if (web_contents()) |
98 extension_enable_flow_->StartForWebContents(web_contents()); | 97 extension_enable_flow_->StartForWebContents(web_contents()); |
99 else | 98 else |
100 extension_enable_flow_->StartForNativeWindow(parent_window_); | 99 extension_enable_flow_->StartForNativeWindow(parent_window_); |
101 | 100 |
102 // Keep this object alive until the enable flow is complete. | 101 // Keep this object alive until the enable flow is complete. |
103 AddRef(); // Balanced in WebstoreStandaloneInstaller::CompleteInstall. | 102 AddRef(); // Balanced in WebstoreStandaloneInstaller::CompleteInstall. |
104 return; | 103 return; |
105 } | 104 } |
106 | 105 |
107 // Fetch the app from the webstore. | 106 // Fetch the app from the webstore. |
108 StartObserving(); | 107 StartObserving(); |
109 BeginInstall(); | 108 BeginInstall(); |
110 } | 109 } |
111 | 110 |
112 EphemeralAppLauncher::EphemeralAppLauncher( | 111 EphemeralAppLauncher::EphemeralAppLauncher( |
113 const std::string& webstore_item_id, | 112 const std::string& webstore_item_id, |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 LaunchApp(extension); | 295 LaunchApp(extension); |
297 WebstoreStandaloneInstaller::CompleteInstall(std::string()); | 296 WebstoreStandaloneInstaller::CompleteInstall(std::string()); |
298 } else { | 297 } else { |
299 WebstoreStandaloneInstaller::CompleteInstall(kLaunchAbortedError); | 298 WebstoreStandaloneInstaller::CompleteInstall(kLaunchAbortedError); |
300 } | 299 } |
301 } | 300 } |
302 | 301 |
303 void EphemeralAppLauncher::ExtensionEnableFlowAborted(bool user_initiated) { | 302 void EphemeralAppLauncher::ExtensionEnableFlowAborted(bool user_initiated) { |
304 WebstoreStandaloneInstaller::CompleteInstall(kLaunchAbortedError); | 303 WebstoreStandaloneInstaller::CompleteInstall(kLaunchAbortedError); |
305 } | 304 } |
OLD | NEW |