OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_CONTEXT_H_ | 5 #ifndef HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_CONTEXT_H_ |
6 #define HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_CONTEXT_H_ | 6 #define HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_CONTEXT_H_ |
7 | 7 |
| 8 #include <memory> |
| 9 |
8 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
9 #include "content/public/browser/browser_context.h" | 11 #include "content/public/browser/browser_context.h" |
10 #include "content/public/browser/content_browser_client.h" | 12 #include "content/public/browser/content_browser_client.h" |
11 #include "content/public/browser/resource_context.h" | 13 #include "content/public/browser/resource_context.h" |
12 #include "headless/lib/browser/headless_url_request_context_getter.h" | 14 #include "headless/lib/browser/headless_url_request_context_getter.h" |
13 #include "headless/public/headless_browser.h" | 15 #include "headless/public/headless_browser.h" |
14 | 16 |
15 namespace headless { | 17 namespace headless { |
16 class HeadlessResourceContext; | 18 class HeadlessResourceContext; |
17 | 19 |
18 class HeadlessBrowserContext : public content::BrowserContext { | 20 class HeadlessBrowserContext : public content::BrowserContext { |
19 public: | 21 public: |
20 explicit HeadlessBrowserContext(const HeadlessBrowser::Options& options); | 22 explicit HeadlessBrowserContext(const HeadlessBrowser::Options& options); |
21 ~HeadlessBrowserContext() override; | 23 ~HeadlessBrowserContext() override; |
22 | 24 |
23 // BrowserContext implementation: | 25 // BrowserContext implementation: |
24 scoped_ptr<content::ZoomLevelDelegate> CreateZoomLevelDelegate( | 26 std::unique_ptr<content::ZoomLevelDelegate> CreateZoomLevelDelegate( |
25 const base::FilePath& partition_path) override; | 27 const base::FilePath& partition_path) override; |
26 base::FilePath GetPath() const override; | 28 base::FilePath GetPath() const override; |
27 bool IsOffTheRecord() const override; | 29 bool IsOffTheRecord() const override; |
28 net::URLRequestContextGetter* GetRequestContext() override; | 30 net::URLRequestContextGetter* GetRequestContext() override; |
29 net::URLRequestContextGetter* GetMediaRequestContext() override; | 31 net::URLRequestContextGetter* GetMediaRequestContext() override; |
30 net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess( | 32 net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess( |
31 int renderer_child_id) override; | 33 int renderer_child_id) override; |
32 net::URLRequestContextGetter* GetMediaRequestContextForStoragePartition( | 34 net::URLRequestContextGetter* GetMediaRequestContextForStoragePartition( |
33 const base::FilePath& partition_path, | 35 const base::FilePath& partition_path, |
34 bool in_memory) override; | 36 bool in_memory) override; |
(...skipping 13 matching lines...) Expand all Loading... |
48 // requests in this browser instance. | 50 // requests in this browser instance. |
49 void SetURLRequestContextGetter( | 51 void SetURLRequestContextGetter( |
50 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter); | 52 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter); |
51 | 53 |
52 private: | 54 private: |
53 // Performs initialization of the HeadlessBrowserContext while IO is still | 55 // Performs initialization of the HeadlessBrowserContext while IO is still |
54 // allowed on the current thread. | 56 // allowed on the current thread. |
55 void InitWhileIOAllowed(); | 57 void InitWhileIOAllowed(); |
56 | 58 |
57 base::FilePath path_; | 59 base::FilePath path_; |
58 scoped_ptr<HeadlessResourceContext> resource_context_; | 60 std::unique_ptr<HeadlessResourceContext> resource_context_; |
59 HeadlessBrowser::Options options_; | 61 HeadlessBrowser::Options options_; |
60 | 62 |
61 DISALLOW_COPY_AND_ASSIGN(HeadlessBrowserContext); | 63 DISALLOW_COPY_AND_ASSIGN(HeadlessBrowserContext); |
62 }; | 64 }; |
63 | 65 |
64 } // namespace headless | 66 } // namespace headless |
65 | 67 |
66 #endif // HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_CONTEXT_H_ | 68 #endif // HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_CONTEXT_H_ |
OLD | NEW |