Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(204)

Side by Side Diff: headless/lib/browser/headless_browser_context_impl.h

Issue 2886693002: initial version of the headless download manager delegate
Patch Set: initial version of the headless download manager delegate Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « headless/BUILD.gn ('k') | headless/lib/browser/headless_browser_context_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_IMPL_H_ 5 #ifndef HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_CONTEXT_IMPL_H_
6 #define HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_CONTEXT_IMPL_H_ 6 #define HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_CONTEXT_IMPL_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <unordered_map> 10 #include <unordered_map>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
14 #include "content/public/browser/browser_context.h" 14 #include "content/public/browser/browser_context.h"
15 #include "content/public/browser/content_browser_client.h" 15 #include "content/public/browser/content_browser_client.h"
16 #include "content/public/browser/resource_context.h" 16 #include "content/public/browser/resource_context.h"
17 #include "headless/lib/browser/headless_browser_context_options.h" 17 #include "headless/lib/browser/headless_browser_context_options.h"
18 #include "headless/lib/browser/headless_url_request_context_getter.h" 18 #include "headless/lib/browser/headless_url_request_context_getter.h"
19 #include "headless/public/headless_browser.h" 19 #include "headless/public/headless_browser.h"
20 #include "headless/public/headless_browser_context.h" 20 #include "headless/public/headless_browser_context.h"
21 #include "headless/public/headless_export.h"
21 22
22 namespace headless { 23 namespace headless {
23 class HeadlessBrowserImpl; 24 class HeadlessBrowserImpl;
25 class HeadlessDownloadManagerDelegate;
24 class HeadlessResourceContext; 26 class HeadlessResourceContext;
25 class HeadlessWebContentsImpl; 27 class HeadlessWebContentsImpl;
26 28
27 class HeadlessBrowserContextImpl : public HeadlessBrowserContext, 29 class HEADLESS_EXPORT HeadlessBrowserContextImpl
28 public content::BrowserContext { 30 : public HeadlessBrowserContext,
31 public content::BrowserContext {
29 public: 32 public:
30 ~HeadlessBrowserContextImpl() override; 33 ~HeadlessBrowserContextImpl() override;
31 34
32 static HeadlessBrowserContextImpl* From( 35 static HeadlessBrowserContextImpl* From(
33 HeadlessBrowserContext* browser_context); 36 HeadlessBrowserContext* browser_context);
34 static HeadlessBrowserContextImpl* From( 37 static HeadlessBrowserContextImpl* From(
35 content::BrowserContext* browser_context); 38 content::BrowserContext* browser_context);
36 39
37 static std::unique_ptr<HeadlessBrowserContextImpl> Create( 40 static std::unique_ptr<HeadlessBrowserContextImpl> Create(
38 HeadlessBrowserContext::Builder* builder); 41 HeadlessBrowserContext::Builder* builder);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 HeadlessBrowserImpl* browser, 101 HeadlessBrowserImpl* browser,
99 std::unique_ptr<HeadlessBrowserContextOptions> context_options); 102 std::unique_ptr<HeadlessBrowserContextOptions> context_options);
100 103
101 // Performs initialization of the HeadlessBrowserContextImpl while IO is still 104 // Performs initialization of the HeadlessBrowserContextImpl while IO is still
102 // allowed on the current thread. 105 // allowed on the current thread.
103 void InitWhileIOAllowed(); 106 void InitWhileIOAllowed();
104 107
105 HeadlessBrowserImpl* browser_; // Not owned. 108 HeadlessBrowserImpl* browser_; // Not owned.
106 std::unique_ptr<HeadlessBrowserContextOptions> context_options_; 109 std::unique_ptr<HeadlessBrowserContextOptions> context_options_;
107 std::unique_ptr<HeadlessResourceContext> resource_context_; 110 std::unique_ptr<HeadlessResourceContext> resource_context_;
111 std::unique_ptr<HeadlessDownloadManagerDelegate> download_manager_delegate_;
108 base::FilePath path_; 112 base::FilePath path_;
109 113
110 std::unordered_map<std::string, std::unique_ptr<HeadlessWebContents>> 114 std::unordered_map<std::string, std::unique_ptr<HeadlessWebContents>>
111 web_contents_map_; 115 web_contents_map_;
112 116
113 // Guards |frame_tree_node_map_| from being concurrently written on the UI 117 // Guards |frame_tree_node_map_| from being concurrently written on the UI
114 // thread and read on the IO thread. 118 // thread and read on the IO thread.
115 // TODO(alexclarke): Remove if we can add FrameTreeNode ID to 119 // TODO(alexclarke): Remove if we can add FrameTreeNode ID to
116 // URLRequestUserData. See https://crbug.com/715541 120 // URLRequestUserData. See https://crbug.com/715541
117 mutable base::Lock frame_tree_node_map_lock_; 121 mutable base::Lock frame_tree_node_map_lock_;
118 std::map<std::pair<int, int>, int> frame_tree_node_map_; 122 std::map<std::pair<int, int>, int> frame_tree_node_map_;
119 123
120 std::unique_ptr<content::PermissionManager> permission_manager_; 124 std::unique_ptr<content::PermissionManager> permission_manager_;
121 125
122 std::string id_; 126 std::string id_;
123 127
124 DISALLOW_COPY_AND_ASSIGN(HeadlessBrowserContextImpl); 128 DISALLOW_COPY_AND_ASSIGN(HeadlessBrowserContextImpl);
125 }; 129 };
126 130
127 } // namespace headless 131 } // namespace headless
128 132
129 #endif // HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_CONTEXT_IMPL_H_ 133 #endif // HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_CONTEXT_IMPL_H_
OLDNEW
« no previous file with comments | « headless/BUILD.gn ('k') | headless/lib/browser/headless_browser_context_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698