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