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

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

Issue 1430673002: Headless demo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Better javascript Created 5 years 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/app/headless_shell.cc ('k') | headless/lib/browser/headless_browser_context.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_CONTEXT_H_
6 #define HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_CONTEXT_H_
7
8 #include "content/public/browser/browser_context.h"
9 #include "content/public/browser/content_browser_client.h"
10 #include "content/public/browser/resource_context.h"
11 #include "headless/lib/browser/headless_url_request_context_getter.h"
12 #include "base/files/file_path.h"
13
14 namespace headless {
15
16 class HeadlessBrowserContext : public content::BrowserContext {
17 public:
18 HeadlessBrowserContext();
19 ~HeadlessBrowserContext() override;
20
21 // BrowserContext implementation
22 scoped_ptr<content::ZoomLevelDelegate> CreateZoomLevelDelegate(
23 const base::FilePath& partition_path) override;
24 base::FilePath GetPath() const override;
25 bool IsOffTheRecord() const override;
26 net::URLRequestContextGetter* GetRequestContext() override;
27 net::URLRequestContextGetter* GetRequestContextForRenderProcess(
28 int renderer_child_id) override;
29 net::URLRequestContextGetter* GetMediaRequestContext() override;
30 net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess(
31 int renderer_child_id) override;
32 net::URLRequestContextGetter* GetMediaRequestContextForStoragePartition(
33 const base::FilePath& partition_path,
34 bool in_memory) override;
35 content::ResourceContext* GetResourceContext() override;
36 content::DownloadManagerDelegate* GetDownloadManagerDelegate() override;
37 content::BrowserPluginGuestManager* GetGuestManager() override;
38 storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override;
39 content::PushMessagingService* GetPushMessagingService() override;
40 content::SSLHostStateDelegate* GetSSLHostStateDelegate() override;
41 content::PermissionManager* GetPermissionManager() override;
42 content::BackgroundSyncController* GetBackgroundSyncController() override;
43
44
45 net::URLRequestContextGetter* CreateRequestContext(
46 content::ProtocolHandlerMap* protocol_handlers,
47 content::URLRequestInterceptorScopedVector request_interceptors);
48 private:
49 // Contains URLRequestContextGetter required for resource loading.
50 class HeadlessResourceContext : public content::ResourceContext {
51 public:
52 HeadlessResourceContext();
53 ~HeadlessResourceContext() override;
54
55 // ResourceContext implementation:
56 net::HostResolver* GetHostResolver() override;
57 net::URLRequestContext* GetRequestContext() override;
58
59 void set_url_request_context_getter(HeadlessURLRequestContex tGetter* getter) {
60 getter_ = getter;
61 }
62
63 private:
64 HeadlessURLRequestContextGetter* getter_;
65
66 DISALLOW_COPY_AND_ASSIGN(HeadlessResourceContext);
67 };
68
69 // Used by HeadlessBrowserContext to initiate and set different types of
70 // URLRequestContextGetter.
71 virtual HeadlessURLRequestContextGetter* CreateURLRequestContextGetter(
72 content::ProtocolHandlerMap* protocol_handlers,
73 content::URLRequestInterceptorScopedVector request_interceptors);
74
75 void set_url_request_context_getter(HeadlessURLRequestContextGetter* getter) {
76 url_request_getter_ = getter;
77 }
78
79 // Performs initialization of the ShellBrowserContext while IO is still
80 // allowed on the current thread.
81 void InitWhileIOAllowed();
82
83 base::FilePath path_;
84 scoped_ptr<HeadlessResourceContext> resource_context_;
85 scoped_refptr<HeadlessURLRequestContextGetter> url_request_gette r_;
86
87 DISALLOW_COPY_AND_ASSIGN(HeadlessBrowserContext);
88 };
89
90 } // namespace headless
91
92 #endif // HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_CONTEXT_H_
OLDNEW
« no previous file with comments | « headless/app/headless_shell.cc ('k') | headless/lib/browser/headless_browser_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698