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 "cc/resources/single_release_callback.h" | 5 #include "extensions/browser/extension_url_request_context_getter.h" |
6 | 6 |
7 #include "base/callback_helpers.h" | 7 #include "content/public/browser/resource_request_info.h" |
8 #include "base/logging.h" | 8 #include "extensions/browser/extension_network_delegate.h" |
9 | 9 |
10 namespace cc { | 10 namespace extensions { |
11 | 11 |
12 SingleReleaseCallback::SingleReleaseCallback(const ReleaseCallback& callback) | 12 ExtensionURLRequestContextGetter::ExtensionURLRequestContextGetter( |
13 : has_been_run_(false), callback_(callback) { | 13 bool ignore_certificate_errors, |
14 DCHECK(!callback_.is_null()) | 14 const base::FilePath& base_path, |
15 << "Use a NULL SingleReleaseCallback for an empty callback."; | 15 base::MessageLoop* io_loop, |
| 16 base::MessageLoop* file_loop, |
| 17 content::ProtocolHandlerMap* protocol_handlers, |
| 18 content::URLRequestInterceptorScopedVector request_interceptors, |
| 19 net::NetLog* net_log) |
| 20 : ShellURLRequestContextGetter( |
| 21 ignore_certificate_errors, |
| 22 base_path, |
| 23 io_loop, |
| 24 file_loop, |
| 25 protocol_handlers, |
| 26 request_interceptors.Pass(), |
| 27 net_log) { |
16 } | 28 } |
17 | 29 |
18 SingleReleaseCallback::~SingleReleaseCallback() { | 30 ExtensionURLRequestContextGetter::~ExtensionURLRequestContextGetter() { |
19 DCHECK(callback_.is_null() || has_been_run_) | |
20 << "SingleReleaseCallback was never run."; | |
21 } | 31 } |
22 | 32 |
23 void SingleReleaseCallback::Run(uint32 sync_point, bool is_lost) { | 33 net::NetworkDelegate* |
24 DCHECK(!has_been_run_) << "SingleReleaseCallback was run more than once."; | 34 ExtensionURLRequestContextGetter::CreateNetworkDelegate() { |
25 has_been_run_ = true; | 35 return new ExtensionNetworkDelegate(); |
26 callback_.Run(sync_point, is_lost); | |
27 } | 36 } |
28 | 37 |
29 } // namespace cc | 38 } // namespace extensions |
OLD | NEW |