Index: android_webview/browser/aw_browser_context.cc |
diff --git a/android_webview/browser/aw_browser_context.cc b/android_webview/browser/aw_browser_context.cc |
index 8a9230c49ee1ee3c69e739d497075ba28d986d41..5d13152076f2ccd5197441c607ff88b491eadb0c 100644 |
--- a/android_webview/browser/aw_browser_context.cc |
+++ b/android_webview/browser/aw_browser_context.cc |
@@ -5,6 +5,9 @@ |
#include "android_webview/browser/aw_browser_context.h" |
#include "android_webview/browser/net/aw_url_request_context_getter.h" |
+#include "components/visitedlink/browser/visitedlink_master.h" |
+ |
+using content::BrowserContext; |
namespace android_webview { |
@@ -18,11 +21,23 @@ AwBrowserContext::AwBrowserContext( |
AwBrowserContext::~AwBrowserContext() { |
} |
+// static |
+AwBrowserContext* AwBrowserContext::FromBrowserContext( |
+ BrowserContext* browser_context) { |
+ // This is safe; this is the only implementation of the browser context. |
+ return static_cast<AwBrowserContext*>(browser_context); |
+} |
+ |
void AwBrowserContext::InitializeBeforeThreadCreation() { |
DCHECK(!url_request_context_getter_); |
url_request_context_getter_ = new AwURLRequestContextGetter(this); |
} |
+void AwBrowserContext::PreMainMessageLoopRun() { |
+ visitedlink_master_.reset(new components::VisitedLinkMaster(this, this)); |
+ visitedlink_master_->Init(); |
+} |
+ |
FilePath AwBrowserContext::GetPath() { |
return context_storage_path_; |
} |
@@ -96,4 +111,36 @@ quota::SpecialStoragePolicy* AwBrowserContext::GetSpecialStoragePolicy() { |
return NULL; |
} |
+void AwBrowserContext::AddVisitedURL(const GURL& url) { |
+ DCHECK(visitedlink_master_); |
+ visitedlink_master_->AddURL(url); |
+} |
+ |
+void AwBrowserContext::AddVisitedURLs(const std::vector<GURL>& urls) { |
+ DCHECK(visitedlink_master_); |
+ visitedlink_master_->AddURLs(urls); |
+} |
+ |
+bool AwBrowserContext::PersistToDisk() const { |
+ // Persistence of VisitedLink database is handled by the embedding app and |
+ // passed to us through WebChromeClient.getVisitedHistory. |
+ return false; |
+} |
+ |
+bool AwBrowserContext::AreEquivalentContexts( |
+ BrowserContext* context1, |
+ BrowserContext* context2) { |
+ // Raw pointer comparison since Android WebView does not have sub-contexts |
+ // like incognito. |
+ return context1 == context2; |
+} |
+ |
+void AwBrowserContext::RebuildTable( |
+ const scoped_refptr<URLEnumerator>& enumerator) { |
+ // Android WebView rebuilds from WebChromeClient.getVisitedHistory. The client |
+ // can change in the lifetime of this WebView and may not yet be set here. |
+ // Therefore this initialization path is not used. |
+ enumerator->OnComplete(true); |
+} |
+ |
} // namespace android_webview |