| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 return true; | 59 return true; |
| 60 } | 60 } |
| 61 | 61 |
| 62 } // namespace | 62 } // namespace |
| 63 | 63 |
| 64 // static | 64 // static |
| 65 content::ResourceThrottle* | 65 content::ResourceThrottle* |
| 66 EphemeralAppThrottle::MaybeCreateThrottleForLaunch( | 66 EphemeralAppThrottle::MaybeCreateThrottleForLaunch( |
| 67 net::URLRequest* request, | 67 net::URLRequest* request, |
| 68 ProfileIOData* profile_io_data) { | 68 ProfileIOData* profile_io_data) { |
| 69 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 69 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 70 switches::kEnableLinkableEphemeralApps)) | 70 switches::kEnableLinkableEphemeralApps)) |
| 71 return NULL; | 71 return NULL; |
| 72 | 72 |
| 73 if (request->method() != "GET" || !request->url().SchemeIsHTTPOrHTTPS()) | 73 if (request->method() != "GET" || !request->url().SchemeIsHTTPOrHTTPS()) |
| 74 return NULL; | 74 return NULL; |
| 75 | 75 |
| 76 // Not supported for incognito profiles. | 76 // Not supported for incognito profiles. |
| 77 if (profile_io_data->IsOffTheRecord()) | 77 if (profile_io_data->IsOffTheRecord()) |
| 78 return NULL; | 78 return NULL; |
| 79 | 79 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 92 return NULL; | 92 return NULL; |
| 93 | 93 |
| 94 std::string app_id(request->url().ExtractFileName()); | 94 std::string app_id(request->url().ExtractFileName()); |
| 95 if (!crx_file::id_util::IdIsValid(app_id)) | 95 if (!crx_file::id_util::IdIsValid(app_id)) |
| 96 return NULL; | 96 return NULL; |
| 97 | 97 |
| 98 return new navigation_interception::InterceptNavigationResourceThrottle( | 98 return new navigation_interception::InterceptNavigationResourceThrottle( |
| 99 request, | 99 request, |
| 100 base::Bind(&LaunchEphemeralApp, app_id)); | 100 base::Bind(&LaunchEphemeralApp, app_id)); |
| 101 } | 101 } |
| OLD | NEW |