OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "android_webview/browser/aw_browser_context.h" | 5 #include "android_webview/browser/aw_browser_context.h" |
6 | 6 |
7 #include "android_webview/browser/net/aw_url_request_context_getter.h" | 7 #include "android_webview/browser/net/aw_url_request_context_getter.h" |
8 #include "components/visitedlink/browser/visitedlink_master.h" | 8 #include "components/visitedlink/browser/visitedlink_master.h" |
9 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
10 #include "content/public/browser/resource_context.h" | 10 #include "content/public/browser/resource_context.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 | 34 |
35 private: | 35 private: |
36 net::URLRequestContextGetter* getter_; | 36 net::URLRequestContextGetter* getter_; |
37 | 37 |
38 DISALLOW_COPY_AND_ASSIGN(AwResourceContext); | 38 DISALLOW_COPY_AND_ASSIGN(AwResourceContext); |
39 }; | 39 }; |
40 | 40 |
41 } // namespace | 41 } // namespace |
42 | 42 |
43 AwBrowserContext::AwBrowserContext( | 43 AwBrowserContext::AwBrowserContext( |
44 const FilePath path, | 44 const base::FilePath path, |
45 GeolocationPermissionFactoryFn* geolocation_permission_factory) | 45 GeolocationPermissionFactoryFn* geolocation_permission_factory) |
46 : context_storage_path_(path), | 46 : context_storage_path_(path), |
47 geolocation_permission_factory_(geolocation_permission_factory) { | 47 geolocation_permission_factory_(geolocation_permission_factory) { |
48 } | 48 } |
49 | 49 |
50 AwBrowserContext::~AwBrowserContext() { | 50 AwBrowserContext::~AwBrowserContext() { |
51 } | 51 } |
52 | 52 |
53 // static | 53 // static |
54 AwBrowserContext* AwBrowserContext::FromWebContents( | 54 AwBrowserContext* AwBrowserContext::FromWebContents( |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 CHECK(url_request_context_getter_); | 87 CHECK(url_request_context_getter_); |
88 url_request_context_getter_->SetProtocolHandlers( | 88 url_request_context_getter_->SetProtocolHandlers( |
89 blob_protocol_handler.Pass(), file_system_protocol_handler.Pass(), | 89 blob_protocol_handler.Pass(), file_system_protocol_handler.Pass(), |
90 developer_protocol_handler.Pass(), chrome_protocol_handler.Pass(), | 90 developer_protocol_handler.Pass(), chrome_protocol_handler.Pass(), |
91 chrome_devtools_protocol_handler.Pass()); | 91 chrome_devtools_protocol_handler.Pass()); |
92 return url_request_context_getter_.get(); | 92 return url_request_context_getter_.get(); |
93 } | 93 } |
94 | 94 |
95 net::URLRequestContextGetter* | 95 net::URLRequestContextGetter* |
96 AwBrowserContext::CreateRequestContextForStoragePartition( | 96 AwBrowserContext::CreateRequestContextForStoragePartition( |
97 const FilePath& partition_path, | 97 const base::FilePath& partition_path, |
98 bool in_memory, | 98 bool in_memory, |
99 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 99 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
100 blob_protocol_handler, | 100 blob_protocol_handler, |
101 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 101 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
102 file_system_protocol_handler, | 102 file_system_protocol_handler, |
103 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 103 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
104 developer_protocol_handler, | 104 developer_protocol_handler, |
105 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 105 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
106 chrome_protocol_handler, | 106 chrome_protocol_handler, |
107 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 107 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
108 chrome_devtools_protocol_handler) { | 108 chrome_devtools_protocol_handler) { |
109 CHECK(url_request_context_getter_); | 109 CHECK(url_request_context_getter_); |
110 return url_request_context_getter_.get(); | 110 return url_request_context_getter_.get(); |
111 } | 111 } |
112 | 112 |
113 FilePath AwBrowserContext::GetPath() { | 113 base::FilePath AwBrowserContext::GetPath() { |
114 return context_storage_path_; | 114 return context_storage_path_; |
115 } | 115 } |
116 | 116 |
117 bool AwBrowserContext::IsOffTheRecord() const { | 117 bool AwBrowserContext::IsOffTheRecord() const { |
118 // Android WebView does not support off the record profile yet. | 118 // Android WebView does not support off the record profile yet. |
119 return false; | 119 return false; |
120 } | 120 } |
121 | 121 |
122 net::URLRequestContextGetter* AwBrowserContext::GetRequestContext() { | 122 net::URLRequestContextGetter* AwBrowserContext::GetRequestContext() { |
123 return GetDefaultStoragePartition(this)->GetURLRequestContext(); | 123 return GetDefaultStoragePartition(this)->GetURLRequestContext(); |
(...skipping 10 matching lines...) Expand all Loading... |
134 } | 134 } |
135 | 135 |
136 net::URLRequestContextGetter* | 136 net::URLRequestContextGetter* |
137 AwBrowserContext::GetMediaRequestContextForRenderProcess( | 137 AwBrowserContext::GetMediaRequestContextForRenderProcess( |
138 int renderer_child_id) { | 138 int renderer_child_id) { |
139 return GetRequestContext(); | 139 return GetRequestContext(); |
140 } | 140 } |
141 | 141 |
142 net::URLRequestContextGetter* | 142 net::URLRequestContextGetter* |
143 AwBrowserContext::GetMediaRequestContextForStoragePartition( | 143 AwBrowserContext::GetMediaRequestContextForStoragePartition( |
144 const FilePath& partition_path, | 144 const base::FilePath& partition_path, |
145 bool in_memory) { | 145 bool in_memory) { |
146 return GetRequestContext(); | 146 return GetRequestContext(); |
147 } | 147 } |
148 | 148 |
149 content::ResourceContext* AwBrowserContext::GetResourceContext() { | 149 content::ResourceContext* AwBrowserContext::GetResourceContext() { |
150 if (!resource_context_) { | 150 if (!resource_context_) { |
151 CHECK(url_request_context_getter_); | 151 CHECK(url_request_context_getter_); |
152 resource_context_.reset(new AwResourceContext( | 152 resource_context_.reset(new AwResourceContext( |
153 url_request_context_getter_.get())); | 153 url_request_context_getter_.get())); |
154 } | 154 } |
(...skipping 27 matching lines...) Expand all Loading... |
182 | 182 |
183 void AwBrowserContext::RebuildTable( | 183 void AwBrowserContext::RebuildTable( |
184 const scoped_refptr<URLEnumerator>& enumerator) { | 184 const scoped_refptr<URLEnumerator>& enumerator) { |
185 // Android WebView rebuilds from WebChromeClient.getVisitedHistory. The client | 185 // Android WebView rebuilds from WebChromeClient.getVisitedHistory. The client |
186 // can change in the lifetime of this WebView and may not yet be set here. | 186 // can change in the lifetime of this WebView and may not yet be set here. |
187 // Therefore this initialization path is not used. | 187 // Therefore this initialization path is not used. |
188 enumerator->OnComplete(true); | 188 enumerator->OnComplete(true); |
189 } | 189 } |
190 | 190 |
191 } // namespace android_webview | 191 } // namespace android_webview |
OLD | NEW |