Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef MOJO_SERVICES_NETWORK_NETWORK_CONTEXT_H_ | 5 #ifndef MOJO_SERVICES_NETWORK_NETWORK_CONTEXT_H_ |
| 6 #define MOJO_SERVICES_NETWORK_NETWORK_CONTEXT_H_ | 6 #define MOJO_SERVICES_NETWORK_NETWORK_CONTEXT_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/callback.h" | |
| 10 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | |
| 11 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/task_runner.h" | |
| 12 | 15 |
| 13 namespace base { | 16 namespace base { |
| 14 class FilePath; | 17 class FilePath; |
| 15 } | 18 } |
| 16 | 19 |
| 17 namespace net { | 20 namespace net { |
| 18 class URLRequestContext; | 21 class URLRequestContext; |
| 19 } | 22 } |
| 20 | 23 |
| 21 namespace mojo { | 24 namespace mojo { |
| 22 class URLLoader; | 25 class URLLoader; |
| 23 class URLLoaderImpl; | 26 class URLLoaderImpl; |
| 24 | 27 |
| 25 class NetworkContext { | 28 class NetworkContext { |
| 26 public: | 29 public: |
| 30 // Cleares the cached content. The actual deletion will be performed using the | |
| 31 // given task runner, but cache appears as cleared immediately after the | |
| 32 // function returns. | |
| 33 static void ClearCache(const base::FilePath& base_path, | |
| 34 scoped_refptr<base::TaskRunner> task_runner, | |
| 35 base::Closure clear_finished_callback); | |
|
qsr
2015/09/16 14:23:19
const base::Closure&
ppi
2015/09/16 14:29:16
Done.
| |
| 36 | |
| 27 explicit NetworkContext( | 37 explicit NetworkContext( |
| 28 scoped_ptr<net::URLRequestContext> url_request_context); | 38 scoped_ptr<net::URLRequestContext> url_request_context); |
| 29 explicit NetworkContext(const base::FilePath& base_path); | 39 explicit NetworkContext(const base::FilePath& base_path); |
| 30 ~NetworkContext(); | 40 ~NetworkContext(); |
| 31 | 41 |
| 32 net::URLRequestContext* url_request_context() { | 42 net::URLRequestContext* url_request_context() { |
| 33 return url_request_context_.get(); | 43 return url_request_context_.get(); |
| 34 } | 44 } |
| 35 | 45 |
| 36 // These are called by individual url loaders as they are being created and | 46 // These are called by individual url loaders as they are being created and |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 58 // Set when entering the destructor, in order to avoid manipulations of the | 68 // Set when entering the destructor, in order to avoid manipulations of the |
| 59 // |url_loaders_| (as a url_loader might delete itself in Cleanup()). | 69 // |url_loaders_| (as a url_loader might delete itself in Cleanup()). |
| 60 bool in_shutdown_; | 70 bool in_shutdown_; |
| 61 | 71 |
| 62 DISALLOW_COPY_AND_ASSIGN(NetworkContext); | 72 DISALLOW_COPY_AND_ASSIGN(NetworkContext); |
| 63 }; | 73 }; |
| 64 | 74 |
| 65 } // namespace mojo | 75 } // namespace mojo |
| 66 | 76 |
| 67 #endif // MOJO_SERVICES_NETWORK_NETWORK_CONTEXT_H_ | 77 #endif // MOJO_SERVICES_NETWORK_NETWORK_CONTEXT_H_ |
| OLD | NEW |