| 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/extensions/extension_install_prompt.h" | 7 #include "chrome/browser/extensions/extension_install_prompt.h" |
| 8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
| 9 #include "chrome/browser/extensions/extension_util.h" | 9 #include "chrome/browser/extensions/extension_util.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 WebstoreStandaloneInstaller::CreateApproval(); | 235 WebstoreStandaloneInstaller::CreateApproval(); |
| 236 approval->is_ephemeral = true; | 236 approval->is_ephemeral = true; |
| 237 return approval.Pass(); | 237 return approval.Pass(); |
| 238 } | 238 } |
| 239 | 239 |
| 240 void EphemeralAppLauncher::CompleteInstall(const std::string& error) { | 240 void EphemeralAppLauncher::CompleteInstall(const std::string& error) { |
| 241 if (!error.empty()) | 241 if (!error.empty()) |
| 242 WebstoreStandaloneInstaller::CompleteInstall(error); | 242 WebstoreStandaloneInstaller::CompleteInstall(error); |
| 243 | 243 |
| 244 // If the installation succeeds, we reach this point as a result of | 244 // If the installation succeeds, we reach this point as a result of |
| 245 // chrome::NOTIFICATION_EXTENSION_INSTALLED, but this is broadcasted before | 245 // chrome::NOTIFICATION_EXTENSION_INSTALLED_DEPRECATED, but this is |
| 246 // broadcasted before |
| 246 // ExtensionService has added the extension to its list of installed | 247 // ExtensionService has added the extension to its list of installed |
| 247 // extensions and is too early to launch the app. Instead, we will launch at | 248 // extensions and is too early to launch the app. Instead, we will launch at |
| 248 // EphemeralAppLauncher::OnExtensionLoaded(). | 249 // EphemeralAppLauncher::OnExtensionLoaded(). |
| 249 // TODO(tmdiep): Refactor extensions/WebstoreInstaller or | 250 // TODO(tmdiep): Refactor extensions/WebstoreInstaller or |
| 250 // WebstoreStandaloneInstaller to support this cleanly. | 251 // WebstoreStandaloneInstaller to support this cleanly. |
| 251 } | 252 } |
| 252 | 253 |
| 253 void EphemeralAppLauncher::WebContentsDestroyed() { | 254 void EphemeralAppLauncher::WebContentsDestroyed() { |
| 254 AbortInstall(); | 255 AbortInstall(); |
| 255 } | 256 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 273 LaunchApp(extension); | 274 LaunchApp(extension); |
| 274 WebstoreStandaloneInstaller::CompleteInstall(std::string()); | 275 WebstoreStandaloneInstaller::CompleteInstall(std::string()); |
| 275 } else { | 276 } else { |
| 276 WebstoreStandaloneInstaller::CompleteInstall(kLaunchAbortedError); | 277 WebstoreStandaloneInstaller::CompleteInstall(kLaunchAbortedError); |
| 277 } | 278 } |
| 278 } | 279 } |
| 279 | 280 |
| 280 void EphemeralAppLauncher::ExtensionEnableFlowAborted(bool user_initiated) { | 281 void EphemeralAppLauncher::ExtensionEnableFlowAborted(bool user_initiated) { |
| 281 WebstoreStandaloneInstaller::CompleteInstall(kLaunchAbortedError); | 282 WebstoreStandaloneInstaller::CompleteInstall(kLaunchAbortedError); |
| 282 } | 283 } |
| OLD | NEW |