| 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_throttle.h" | 5 #include "chrome/browser/apps/ephemeral_app_throttle.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/browser/apps/ephemeral_app_launcher.h" | 8 #include "chrome/browser/apps/ephemeral_app_launcher.h" |
| 9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 DCHECK(service); | 45 DCHECK(service); |
| 46 const Extension* extension = service->GetInstalledExtension(app_id); | 46 const Extension* extension = service->GetInstalledExtension(app_id); |
| 47 | 47 |
| 48 // Only launch apps. | 48 // Only launch apps. |
| 49 if (extension && !extension->is_app()) | 49 if (extension && !extension->is_app()) |
| 50 return false; | 50 return false; |
| 51 | 51 |
| 52 // The EphemeralAppLauncher will handle launching of an existing app or | 52 // The EphemeralAppLauncher will handle launching of an existing app or |
| 53 // installing and launching a new ephemeral app. | 53 // installing and launching a new ephemeral app. |
| 54 scoped_refptr<EphemeralAppLauncher> installer = | 54 scoped_refptr<EphemeralAppLauncher> installer = |
| 55 EphemeralAppLauncher::CreateForLink(app_id, source); | 55 EphemeralAppLauncher::CreateForWebContents( |
| 56 app_id, source, EphemeralAppLauncher::LaunchCallback()); |
| 56 installer->Start(); | 57 installer->Start(); |
| 57 return true; | 58 return true; |
| 58 } | 59 } |
| 59 | 60 |
| 60 } // namespace | 61 } // namespace |
| 61 | 62 |
| 62 // static | 63 // static |
| 63 content::ResourceThrottle* | 64 content::ResourceThrottle* |
| 64 EphemeralAppThrottle::MaybeCreateThrottleForLaunch( | 65 EphemeralAppThrottle::MaybeCreateThrottleForLaunch( |
| 65 net::URLRequest* request, | 66 net::URLRequest* request, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 90 return NULL; | 91 return NULL; |
| 91 | 92 |
| 92 std::string app_id(request->url().ExtractFileName()); | 93 std::string app_id(request->url().ExtractFileName()); |
| 93 if (!Extension::IdIsValid(app_id)) | 94 if (!Extension::IdIsValid(app_id)) |
| 94 return NULL; | 95 return NULL; |
| 95 | 96 |
| 96 return new navigation_interception::InterceptNavigationResourceThrottle( | 97 return new navigation_interception::InterceptNavigationResourceThrottle( |
| 97 request, | 98 request, |
| 98 base::Bind(&LaunchEphemeralApp, app_id)); | 99 base::Bind(&LaunchEphemeralApp, app_id)); |
| 99 } | 100 } |
| OLD | NEW |