| 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 | 246 |
| 247 // If the installation succeeds, we reach this point as a result of | 247 // If the installation succeeds, we reach this point as a result of |
| 248 // chrome::NOTIFICATION_EXTENSION_INSTALLED, but this is broadcasted before | 248 // chrome::NOTIFICATION_EXTENSION_INSTALLED, but this is broadcasted before |
| 249 // ExtensionService has added the extension to its list of installed | 249 // ExtensionService has added the extension to its list of installed |
| 250 // extensions and is too early to launch the app. Instead, we will launch at | 250 // extensions and is too early to launch the app. Instead, we will launch at |
| 251 // EphemeralAppLauncher::OnExtensionLoaded(). | 251 // EphemeralAppLauncher::OnExtensionLoaded(). |
| 252 // TODO(tmdiep): Refactor extensions/WebstoreInstaller or | 252 // TODO(tmdiep): Refactor extensions/WebstoreInstaller or |
| 253 // WebstoreStandaloneInstaller to support this cleanly. | 253 // WebstoreStandaloneInstaller to support this cleanly. |
| 254 } | 254 } |
| 255 | 255 |
| 256 void EphemeralAppLauncher::WebContentsDestroyed( | 256 void EphemeralAppLauncher::WebContentsDestroyed() { |
| 257 content::WebContents* web_contents) { | |
| 258 AbortInstall(); | 257 AbortInstall(); |
| 259 } | 258 } |
| 260 | 259 |
| 261 void EphemeralAppLauncher::OnExtensionLoaded( | 260 void EphemeralAppLauncher::OnExtensionLoaded( |
| 262 content::BrowserContext* browser_context, | 261 content::BrowserContext* browser_context, |
| 263 const Extension* extension) { | 262 const Extension* extension) { |
| 264 DCHECK(extension); | 263 DCHECK(extension); |
| 265 if (extension->id() == id()) { | 264 if (extension->id() == id()) { |
| 266 LaunchApp(extension); | 265 LaunchApp(extension); |
| 267 WebstoreStandaloneInstaller::CompleteInstall(std::string()); | 266 WebstoreStandaloneInstaller::CompleteInstall(std::string()); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 278 LaunchApp(extension); | 277 LaunchApp(extension); |
| 279 WebstoreStandaloneInstaller::CompleteInstall(std::string()); | 278 WebstoreStandaloneInstaller::CompleteInstall(std::string()); |
| 280 } else { | 279 } else { |
| 281 WebstoreStandaloneInstaller::CompleteInstall(kLaunchAbortedError); | 280 WebstoreStandaloneInstaller::CompleteInstall(kLaunchAbortedError); |
| 282 } | 281 } |
| 283 } | 282 } |
| 284 | 283 |
| 285 void EphemeralAppLauncher::ExtensionEnableFlowAborted(bool user_initiated) { | 284 void EphemeralAppLauncher::ExtensionEnableFlowAborted(bool user_initiated) { |
| 286 WebstoreStandaloneInstaller::CompleteInstall(kLaunchAbortedError); | 285 WebstoreStandaloneInstaller::CompleteInstall(kLaunchAbortedError); |
| 287 } | 286 } |
| OLD | NEW |