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 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 content::URLRequestInterceptorScopedVector request_interceptors) override; | 56 content::URLRequestInterceptorScopedVector request_interceptors) override; |
56 net::URLRequestContextGetter* CreateMediaRequestContext() override; | 57 net::URLRequestContextGetter* CreateMediaRequestContext() override; |
57 net::URLRequestContextGetter* CreateMediaRequestContextForStoragePartition( | 58 net::URLRequestContextGetter* CreateMediaRequestContextForStoragePartition( |
58 const base::FilePath& partition_path, | 59 const base::FilePath& partition_path, |
59 bool in_memory) override; | 60 bool in_memory) override; |
60 | 61 |
61 // Provides a URLRequestContextGetter for system requests (e.g. metrics | 62 // Provides a URLRequestContextGetter for system requests (e.g. metrics |
62 // uploads). | 63 // uploads). |
63 net::URLRequestContextGetter* GetSystemRequestContextGetter(); | 64 net::URLRequestContextGetter* GetSystemRequestContextGetter(); |
64 | 65 |
| 66 PrefService* GetPrefService() { return pref_service_.get(); } |
| 67 |
65 private: | 68 private: |
66 // Performs initialization of the BlimpBrowserContext while IO is still | 69 // Performs initialization of the BlimpBrowserContext while IO is still |
67 // allowed on the current thread. | 70 // allowed on the current thread. |
68 void InitWhileIOAllowed(); | 71 void InitWhileIOAllowed(); |
69 | 72 |
| 73 // Helper function for PrefService initialization. |
| 74 void InitPrefService(); |
| 75 |
| 76 // Used in metrics initialization to get a PrefService to store logs |
| 77 // temporarily. Must stay alive for lifetime of metrics_service_client_. |
| 78 std::unique_ptr<PrefService> pref_service_; |
| 79 |
| 80 // Used for metrics recording and reporting. |
| 81 std::unique_ptr<BlimpMetricsServiceClient> metrics_service_client_; |
| 82 |
70 std::unique_ptr<BlimpResourceContext> resource_context_; | 83 std::unique_ptr<BlimpResourceContext> resource_context_; |
71 scoped_refptr<BlimpSystemURLRequestContextGetter> system_context_getter_; | 84 scoped_refptr<BlimpSystemURLRequestContextGetter> system_context_getter_; |
72 bool ignore_certificate_errors_; | 85 bool ignore_certificate_errors_; |
73 std::unique_ptr<content::PermissionManager> permission_manager_; | 86 std::unique_ptr<content::PermissionManager> permission_manager_; |
74 bool off_the_record_; | 87 bool off_the_record_; |
75 net::NetLog* net_log_; | 88 net::NetLog* net_log_; |
76 base::FilePath path_; | 89 base::FilePath path_; |
77 | 90 |
78 DISALLOW_COPY_AND_ASSIGN(BlimpBrowserContext); | 91 DISALLOW_COPY_AND_ASSIGN(BlimpBrowserContext); |
79 }; | 92 }; |
80 | 93 |
81 } // namespace engine | 94 } // namespace engine |
82 } // namespace blimp | 95 } // namespace blimp |
83 | 96 |
84 #endif // BLIMP_ENGINE_COMMON_BLIMP_BROWSER_CONTEXT_H_ | 97 #endif // BLIMP_ENGINE_COMMON_BLIMP_BROWSER_CONTEXT_H_ |
OLD | NEW |