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 BLIMP_ENGINE_COMMON_BLIMP_BROWSER_CONTEXT_H_ | 5 #ifndef BLIMP_ENGINE_COMMON_BLIMP_BROWSER_CONTEXT_H_ |
6 #define BLIMP_ENGINE_COMMON_BLIMP_BROWSER_CONTEXT_H_ | 6 #define BLIMP_ENGINE_COMMON_BLIMP_BROWSER_CONTEXT_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 "base/macros.h" | 11 #include "base/macros.h" |
12 #include "blimp/engine/app/blimp_metrics_service_client.h" | |
12 #include "blimp/engine/app/blimp_system_url_request_context_getter.h" | 13 #include "blimp/engine/app/blimp_system_url_request_context_getter.h" |
13 #include "blimp/engine/app/blimp_url_request_context_getter.h" | 14 #include "blimp/engine/app/blimp_url_request_context_getter.h" |
14 #include "content/public/browser/browser_context.h" | 15 #include "content/public/browser/browser_context.h" |
15 #include "content/public/browser/content_browser_client.h" | 16 #include "content/public/browser/content_browser_client.h" |
16 #include "content/public/browser/resource_context.h" | 17 #include "content/public/browser/resource_context.h" |
17 #include "net/url_request/url_request_job_factory.h" | 18 #include "net/url_request/url_request_job_factory.h" |
18 | 19 |
20 class PerfService; | |
Bernhard Bauer
2016/04/25 08:21:36
PrefService :) But the fact that this doesn't caus
Jess
2016/04/26 00:01:25
Cleaned up.
| |
21 | |
19 namespace net { | 22 namespace net { |
20 class NetLog; | 23 class NetLog; |
21 } | 24 } |
22 | 25 |
23 namespace blimp { | 26 namespace blimp { |
24 namespace engine { | 27 namespace engine { |
25 | 28 |
26 class BlimpResourceContext; | 29 class BlimpResourceContext; |
27 class PermissionManager; | 30 class PermissionManager; |
28 | 31 |
29 class BlimpBrowserContext : public content::BrowserContext { | 32 class BlimpBrowserContext : public content::BrowserContext { |
30 public: | 33 public: |
31 // Caller owns |net_log| and ensures it out-lives this browser context. | 34 // Caller owns |net_log| and ensures it out-lives this browser context. |
32 BlimpBrowserContext(bool off_the_record, net::NetLog* net_log); | 35 BlimpBrowserContext(bool off_the_record, net::NetLog* net_log); |
33 ~BlimpBrowserContext() override; | 36 ~BlimpBrowserContext() override; |
34 | 37 |
38 // These map to BrowserMainParts::Pre/PostMainMessageLoopRun. | |
39 void Initialize(); | |
40 void Finalize(); | |
41 | |
35 // content::BrowserContext implementation. | 42 // content::BrowserContext implementation. |
36 std::unique_ptr<content::ZoomLevelDelegate> CreateZoomLevelDelegate( | 43 std::unique_ptr<content::ZoomLevelDelegate> CreateZoomLevelDelegate( |
37 const base::FilePath& partition_path) override; | 44 const base::FilePath& partition_path) override; |
38 base::FilePath GetPath() const override; | 45 base::FilePath GetPath() const override; |
39 bool IsOffTheRecord() const override; | 46 bool IsOffTheRecord() const override; |
40 content::ResourceContext* GetResourceContext() override; | 47 content::ResourceContext* GetResourceContext() override; |
41 content::DownloadManagerDelegate* GetDownloadManagerDelegate() override; | 48 content::DownloadManagerDelegate* GetDownloadManagerDelegate() override; |
42 content::BrowserPluginGuestManager* GetGuestManager() override; | 49 content::BrowserPluginGuestManager* GetGuestManager() override; |
43 storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override; | 50 storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override; |
44 content::PushMessagingService* GetPushMessagingService() override; | 51 content::PushMessagingService* GetPushMessagingService() override; |
(...skipping 14 matching lines...) Expand all Loading... | |
59 bool in_memory) override; | 66 bool in_memory) override; |
60 | 67 |
61 // Provides a URLRequestContextGetter for system requests (e.g. metrics | 68 // Provides a URLRequestContextGetter for system requests (e.g. metrics |
62 // uploads). | 69 // uploads). |
63 net::URLRequestContextGetter* GetSystemRequestContextGetter(); | 70 net::URLRequestContextGetter* GetSystemRequestContextGetter(); |
64 | 71 |
65 private: | 72 private: |
66 // Performs initialization of the BlimpBrowserContext while IO is still | 73 // Performs initialization of the BlimpBrowserContext while IO is still |
67 // allowed on the current thread. | 74 // allowed on the current thread. |
68 void InitWhileIOAllowed(); | 75 void InitWhileIOAllowed(); |
76 void InitPrefService(); | |
69 | 77 |
78 // Used by metrics service to persist logs and other information. | |
79 scoped_ptr<PrefService> pref_service_; | |
70 std::unique_ptr<BlimpResourceContext> resource_context_; | 80 std::unique_ptr<BlimpResourceContext> resource_context_; |
71 scoped_refptr<BlimpSystemURLRequestContextGetter> system_context_getter_; | 81 scoped_refptr<BlimpSystemURLRequestContextGetter> system_context_getter_; |
72 bool ignore_certificate_errors_; | 82 bool ignore_certificate_errors_; |
73 std::unique_ptr<content::PermissionManager> permission_manager_; | 83 std::unique_ptr<content::PermissionManager> permission_manager_; |
74 bool off_the_record_; | 84 bool off_the_record_; |
75 net::NetLog* net_log_; | 85 net::NetLog* net_log_; |
76 base::FilePath path_; | 86 base::FilePath path_; |
77 | 87 |
78 DISALLOW_COPY_AND_ASSIGN(BlimpBrowserContext); | 88 DISALLOW_COPY_AND_ASSIGN(BlimpBrowserContext); |
79 }; | 89 }; |
80 | 90 |
81 } // namespace engine | 91 } // namespace engine |
82 } // namespace blimp | 92 } // namespace blimp |
83 | 93 |
84 #endif // BLIMP_ENGINE_COMMON_BLIMP_BROWSER_CONTEXT_H_ | 94 #endif // BLIMP_ENGINE_COMMON_BLIMP_BROWSER_CONTEXT_H_ |
OLD | NEW |