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

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

Issue 2092773002: headless: Allow per-context protocol handlers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed comments Created 4 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 9
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "content/public/browser/browser_context.h" 11 #include "content/public/browser/browser_context.h"
12 #include "content/public/browser/content_browser_client.h" 12 #include "content/public/browser/content_browser_client.h"
13 #include "content/public/browser/resource_context.h" 13 #include "content/public/browser/resource_context.h"
14 #include "headless/lib/browser/headless_url_request_context_getter.h" 14 #include "headless/lib/browser/headless_url_request_context_getter.h"
15 #include "headless/public/headless_browser.h" 15 #include "headless/public/headless_browser.h"
16 #include "headless/public/headless_browser_context.h" 16 #include "headless/public/headless_browser_context.h"
17 17
18 namespace headless { 18 namespace headless {
19 class HeadlessResourceContext; 19 class HeadlessResourceContext;
20 20
21 class HeadlessBrowserContextImpl : public HeadlessBrowserContext, 21 class HeadlessBrowserContextImpl : public HeadlessBrowserContext,
22 public content::BrowserContext { 22 public content::BrowserContext {
23 public: 23 public:
24 explicit HeadlessBrowserContextImpl(HeadlessBrowser::Options* options); 24 explicit HeadlessBrowserContextImpl(ProtocolHandlerMap protocol_handlers,
25 HeadlessBrowser::Options* options);
25 ~HeadlessBrowserContextImpl() override; 26 ~HeadlessBrowserContextImpl() override;
26 27
27 static HeadlessBrowserContextImpl* From( 28 static HeadlessBrowserContextImpl* From(
28 HeadlessBrowserContext* browser_context); 29 HeadlessBrowserContext* browser_context);
29 30
30 // BrowserContext implementation: 31 // BrowserContext implementation:
31 std::unique_ptr<content::ZoomLevelDelegate> CreateZoomLevelDelegate( 32 std::unique_ptr<content::ZoomLevelDelegate> CreateZoomLevelDelegate(
32 const base::FilePath& partition_path) override; 33 const base::FilePath& partition_path) override;
33 base::FilePath GetPath() const override; 34 base::FilePath GetPath() const override;
34 bool IsOffTheRecord() const override; 35 bool IsOffTheRecord() const override;
(...skipping 19 matching lines...) Expand all
54 bool in_memory) override; 55 bool in_memory) override;
55 56
56 HeadlessBrowser::Options* options() const { return options_; } 57 HeadlessBrowser::Options* options() const { return options_; }
57 void SetOptionsForTesting(HeadlessBrowser::Options* options); 58 void SetOptionsForTesting(HeadlessBrowser::Options* options);
58 59
59 private: 60 private:
60 // Performs initialization of the HeadlessBrowserContextImpl while IO is still 61 // Performs initialization of the HeadlessBrowserContextImpl while IO is still
61 // allowed on the current thread. 62 // allowed on the current thread.
62 void InitWhileIOAllowed(); 63 void InitWhileIOAllowed();
63 64
65 ProtocolHandlerMap protocol_handlers_;
66 HeadlessBrowser::Options* options_; // Not owned.
67 std::unique_ptr<HeadlessResourceContext> resource_context_;
64 base::FilePath path_; 68 base::FilePath path_;
65 std::unique_ptr<HeadlessResourceContext> resource_context_;
66 HeadlessBrowser::Options* options_; // Not owned.
67 69
68 DISALLOW_COPY_AND_ASSIGN(HeadlessBrowserContextImpl); 70 DISALLOW_COPY_AND_ASSIGN(HeadlessBrowserContextImpl);
69 }; 71 };
70 72
71 } // namespace headless 73 } // namespace headless
72 74
73 #endif // HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_CONTEXT_IMPL_H_ 75 #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