| 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" |
| 9 #include "content/public/browser/web_contents.h" |
| 8 | 10 |
| 9 namespace android_webview { | 11 namespace android_webview { |
| 10 | 12 |
| 11 AwBrowserContext::AwBrowserContext( | 13 AwBrowserContext::AwBrowserContext( |
| 12 const FilePath path, | 14 const FilePath path, |
| 13 GeolocationPermissionFactoryFn* geolocation_permission_factory) | 15 GeolocationPermissionFactoryFn* geolocation_permission_factory) |
| 14 : context_storage_path_(path), | 16 : context_storage_path_(path), |
| 15 geolocation_permission_factory_(geolocation_permission_factory) { | 17 geolocation_permission_factory_(geolocation_permission_factory) { |
| 16 } | 18 } |
| 17 | 19 |
| 18 AwBrowserContext::~AwBrowserContext() { | 20 AwBrowserContext::~AwBrowserContext() { |
| 19 } | 21 } |
| 20 | 22 |
| 23 // static |
| 24 AwBrowserContext* AwBrowserContext::FromWebContents( |
| 25 content::WebContents* web_contents) { |
| 26 // This is safe; this is the only implementation of the browser context. |
| 27 return static_cast<AwBrowserContext*>(web_contents->GetBrowserContext()); |
| 28 } |
| 29 |
| 21 void AwBrowserContext::InitializeBeforeThreadCreation() { | 30 void AwBrowserContext::InitializeBeforeThreadCreation() { |
| 22 DCHECK(!url_request_context_getter_); | 31 DCHECK(!url_request_context_getter_); |
| 23 url_request_context_getter_ = new AwURLRequestContextGetter(this); | 32 url_request_context_getter_ = new AwURLRequestContextGetter(this); |
| 24 } | 33 } |
| 25 | 34 |
| 35 void AwBrowserContext::PreMainMessageLoopRun() { |
| 36 visitedlink_master_.reset( |
| 37 new components::VisitedLinkMaster(this, this, false)); |
| 38 visitedlink_master_->Init(); |
| 39 } |
| 40 |
| 41 void AwBrowserContext::AddVisitedURL(const GURL& url) { |
| 42 DCHECK(visitedlink_master_); |
| 43 visitedlink_master_->AddURL(url); |
| 44 } |
| 45 |
| 46 void AwBrowserContext::AddVisitedURLs(const std::vector<GURL>& urls) { |
| 47 DCHECK(visitedlink_master_); |
| 48 visitedlink_master_->AddURLs(urls); |
| 49 } |
| 50 |
| 26 FilePath AwBrowserContext::GetPath() { | 51 FilePath AwBrowserContext::GetPath() { |
| 27 return context_storage_path_; | 52 return context_storage_path_; |
| 28 } | 53 } |
| 29 | 54 |
| 30 bool AwBrowserContext::IsOffTheRecord() const { | 55 bool AwBrowserContext::IsOffTheRecord() const { |
| 31 // Android WebView does not support off the record profile yet. | 56 // Android WebView does not support off the record profile yet. |
| 32 return false; | 57 return false; |
| 33 } | 58 } |
| 34 | 59 |
| 35 net::URLRequestContextGetter* AwBrowserContext::GetRequestContext() { | 60 net::URLRequestContextGetter* AwBrowserContext::GetRequestContext() { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 // By default allows profanities in speech recognition if return NULL. | 114 // By default allows profanities in speech recognition if return NULL. |
| 90 return NULL; | 115 return NULL; |
| 91 } | 116 } |
| 92 | 117 |
| 93 quota::SpecialStoragePolicy* AwBrowserContext::GetSpecialStoragePolicy() { | 118 quota::SpecialStoragePolicy* AwBrowserContext::GetSpecialStoragePolicy() { |
| 94 // TODO(boliu): Implement this so we are not relying on default behavior. | 119 // TODO(boliu): Implement this so we are not relying on default behavior. |
| 95 NOTIMPLEMENTED(); | 120 NOTIMPLEMENTED(); |
| 96 return NULL; | 121 return NULL; |
| 97 } | 122 } |
| 98 | 123 |
| 124 void AwBrowserContext::RebuildTable( |
| 125 const scoped_refptr<URLEnumerator>& enumerator) { |
| 126 // Android WebView rebuilds from WebChromeClient.getVisitedHistory. The client |
| 127 // can change in the lifetime of this WebView and may not yet be set here. |
| 128 // Therefore this initialization path is not used. |
| 129 enumerator->OnComplete(true); |
| 130 } |
| 131 |
| 99 } // namespace android_webview | 132 } // namespace android_webview |
| OLD | NEW |