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 |
19 namespace net { | 20 namespace net { |
20 class NetLog; | 21 class NetLog; |
21 } | 22 } |
22 | 23 |
23 namespace blimp { | 24 namespace blimp { |
24 namespace engine { | 25 namespace engine { |
25 | 26 |
26 class BlimpResourceContext; | 27 class BlimpResourceContext; |
27 class PermissionManager; | 28 class PermissionManager; |
28 | 29 |
29 class BlimpBrowserContext : public content::BrowserContext { | 30 class BlimpBrowserContext : public content::BrowserContext { |
30 public: | 31 public: |
31 // Caller owns |net_log| and ensures it out-lives this browser context. | 32 // Caller owns |net_log| and ensures it out-lives this browser context. |
32 BlimpBrowserContext(bool off_the_record, net::NetLog* net_log); | 33 BlimpBrowserContext(bool off_the_record, net::NetLog* net_log); |
33 ~BlimpBrowserContext() override; | 34 ~BlimpBrowserContext() override; |
34 | 35 |
36 // These map to BrowserMainParts::Pre/PostMainMessageLoopRun respectively. | |
Kevin M
2016/05/02 21:50:52
This comment is kind of unclear. What does "map" m
Jess
2016/05/02 23:00:24
Rewritten.
| |
37 void Initialize(); | |
38 void Finalize(); | |
39 | |
35 // content::BrowserContext implementation. | 40 // content::BrowserContext implementation. |
36 std::unique_ptr<content::ZoomLevelDelegate> CreateZoomLevelDelegate( | 41 std::unique_ptr<content::ZoomLevelDelegate> CreateZoomLevelDelegate( |
37 const base::FilePath& partition_path) override; | 42 const base::FilePath& partition_path) override; |
38 base::FilePath GetPath() const override; | 43 base::FilePath GetPath() const override; |
39 bool IsOffTheRecord() const override; | 44 bool IsOffTheRecord() const override; |
40 content::ResourceContext* GetResourceContext() override; | 45 content::ResourceContext* GetResourceContext() override; |
41 content::DownloadManagerDelegate* GetDownloadManagerDelegate() override; | 46 content::DownloadManagerDelegate* GetDownloadManagerDelegate() override; |
42 content::BrowserPluginGuestManager* GetGuestManager() override; | 47 content::BrowserPluginGuestManager* GetGuestManager() override; |
43 storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override; | 48 storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override; |
44 content::PushMessagingService* GetPushMessagingService() override; | 49 content::PushMessagingService* GetPushMessagingService() override; |
(...skipping 15 matching lines...) Expand all Loading... | |
60 | 65 |
61 // Provides a URLRequestContextGetter for system requests (e.g. metrics | 66 // Provides a URLRequestContextGetter for system requests (e.g. metrics |
62 // uploads). | 67 // uploads). |
63 net::URLRequestContextGetter* GetSystemRequestContextGetter(); | 68 net::URLRequestContextGetter* GetSystemRequestContextGetter(); |
64 | 69 |
65 private: | 70 private: |
66 // Performs initialization of the BlimpBrowserContext while IO is still | 71 // Performs initialization of the BlimpBrowserContext while IO is still |
67 // allowed on the current thread. | 72 // allowed on the current thread. |
68 void InitWhileIOAllowed(); | 73 void InitWhileIOAllowed(); |
69 | 74 |
75 // Used in metrics initialization to get a PrefService to store logs | |
76 // temporarily. | |
77 std::unique_ptr<PrefService> GetPrefService(); | |
78 | |
70 std::unique_ptr<BlimpResourceContext> resource_context_; | 79 std::unique_ptr<BlimpResourceContext> resource_context_; |
71 scoped_refptr<BlimpSystemURLRequestContextGetter> system_context_getter_; | 80 scoped_refptr<BlimpSystemURLRequestContextGetter> system_context_getter_; |
72 bool ignore_certificate_errors_; | 81 bool ignore_certificate_errors_; |
73 std::unique_ptr<content::PermissionManager> permission_manager_; | 82 std::unique_ptr<content::PermissionManager> permission_manager_; |
74 bool off_the_record_; | 83 bool off_the_record_; |
75 net::NetLog* net_log_; | 84 net::NetLog* net_log_; |
76 base::FilePath path_; | 85 base::FilePath path_; |
77 | 86 |
78 DISALLOW_COPY_AND_ASSIGN(BlimpBrowserContext); | 87 DISALLOW_COPY_AND_ASSIGN(BlimpBrowserContext); |
79 }; | 88 }; |
80 | 89 |
81 } // namespace engine | 90 } // namespace engine |
82 } // namespace blimp | 91 } // namespace blimp |
83 | 92 |
84 #endif // BLIMP_ENGINE_COMMON_BLIMP_BROWSER_CONTEXT_H_ | 93 #endif // BLIMP_ENGINE_COMMON_BLIMP_BROWSER_CONTEXT_H_ |
OLD | NEW |