Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(177)

Side by Side Diff: android_webview/renderer/aw_content_renderer_client.cc

Issue 11860014: Android WebView visited link highlighting implementation part 1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to pass no_disk parameter instead of using delegate. Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « android_webview/renderer/aw_content_renderer_client.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/renderer/aw_content_renderer_client.h" 5 #include "android_webview/renderer/aw_content_renderer_client.h"
6 6
7 #include "android_webview/common/aw_resource.h" 7 #include "android_webview/common/aw_resource.h"
8 #include "android_webview/common/url_constants.h" 8 #include "android_webview/common/url_constants.h"
9 #include "android_webview/renderer/aw_render_view_ext.h" 9 #include "android_webview/renderer/aw_render_view_ext.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "components/visitedlink/renderer/visitedlink_slave.h"
11 #include "content/public/renderer/render_thread.h" 12 #include "content/public/renderer/render_thread.h"
12 #include "googleurl/src/gurl.h" 13 #include "googleurl/src/gurl.h"
13 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h" 14 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h"
14 #include "third_party/WebKit/Source/Platform/chromium/public/WebURL.h" 15 #include "third_party/WebKit/Source/Platform/chromium/public/WebURL.h"
15 #include "third_party/WebKit/Source/Platform/chromium/public/WebURLError.h" 16 #include "third_party/WebKit/Source/Platform/chromium/public/WebURLError.h"
16 #include "third_party/WebKit/Source/Platform/chromium/public/WebURLRequest.h" 17 #include "third_party/WebKit/Source/Platform/chromium/public/WebURLRequest.h"
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.h" 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.h"
18 19
19 namespace android_webview { 20 namespace android_webview {
20 21
21 AwContentRendererClient::AwContentRendererClient() { 22 AwContentRendererClient::AwContentRendererClient() {
22 } 23 }
23 24
24 AwContentRendererClient::~AwContentRendererClient() { 25 AwContentRendererClient::~AwContentRendererClient() {
25 } 26 }
26 27
27 void AwContentRendererClient::RenderThreadStarted() { 28 void AwContentRendererClient::RenderThreadStarted() {
28 WebKit::WebString content_scheme( 29 WebKit::WebString content_scheme(
29 ASCIIToUTF16(android_webview::kContentScheme)); 30 ASCIIToUTF16(android_webview::kContentScheme));
30 WebKit::WebSecurityPolicy::registerURLSchemeAsLocal(content_scheme); 31 WebKit::WebSecurityPolicy::registerURLSchemeAsLocal(content_scheme);
31 32
33 content::RenderThread* thread = content::RenderThread::Get();
34
32 aw_render_process_observer_.reset(new AwRenderProcessObserver); 35 aw_render_process_observer_.reset(new AwRenderProcessObserver);
33 content::RenderThread::Get()->AddObserver( 36 thread->AddObserver(aw_render_process_observer_.get());
34 aw_render_process_observer_.get()); 37
38 visited_link_slave_.reset(new components::VisitedLinkSlave);
39 thread->AddObserver(visited_link_slave_.get());
35 } 40 }
36 41
37 void AwContentRendererClient::RenderViewCreated( 42 void AwContentRendererClient::RenderViewCreated(
38 content::RenderView* render_view) { 43 content::RenderView* render_view) {
39 AwRenderViewExt::RenderViewCreated(render_view); 44 AwRenderViewExt::RenderViewCreated(render_view);
40 } 45 }
41 46
42 std::string AwContentRendererClient::GetDefaultEncoding() { 47 std::string AwContentRendererClient::GetDefaultEncoding() {
43 return AwResource::GetDefaultTextEncoding(); 48 return AwResource::GetDefaultTextEncoding();
44 } 49 }
(...skipping 21 matching lines...) Expand all
66 71
67 ReplaceSubstringsAfterOffset(&contents, 0, "%s", 72 ReplaceSubstringsAfterOffset(&contents, 0, "%s",
68 error_url.possibly_invalid_spec()); 73 error_url.possibly_invalid_spec());
69 *error_html = contents; 74 *error_html = contents;
70 } 75 }
71 } 76 }
72 77
73 unsigned long long AwContentRendererClient::VisitedLinkHash( 78 unsigned long long AwContentRendererClient::VisitedLinkHash(
74 const char* canonical_url, 79 const char* canonical_url,
75 size_t length) { 80 size_t length) {
76 // TODO(boliu): Implement a visited link solution for Android WebView. 81 return visited_link_slave_->ComputeURLFingerprint(canonical_url, length);
77 // Perhaps componentize chrome implementation or move to content/?
78 return 0LL;
79 } 82 }
80 83
81 bool AwContentRendererClient::IsLinkVisited(unsigned long long link_hash) { 84 bool AwContentRendererClient::IsLinkVisited(unsigned long long link_hash) {
82 // TODO(boliu): Implement a visited link solution for Android WebView. 85 return visited_link_slave_->IsVisited(link_hash);
83 // Perhaps componentize chrome implementation or move to content/?
84 return false;
85 } 86 }
86 87
87 void AwContentRendererClient::PrefetchHostName(const char* hostname, 88 void AwContentRendererClient::PrefetchHostName(const char* hostname,
88 size_t length) { 89 size_t length) {
89 // TODO(boliu): Implement hostname prefetch for Android WebView. 90 // TODO(boliu): Implement hostname prefetch for Android WebView.
90 // Perhaps componentize chrome implementation or move to content/? 91 // Perhaps componentize chrome implementation or move to content/?
91 } 92 }
92 93
93 } // namespace android_webview 94 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/renderer/aw_content_renderer_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698