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/renderer_host/aw_render_view_host_ext.h" | 5 #include "android_webview/browser/renderer_host/aw_render_view_host_ext.h" |
6 | 6 |
7 #include "android_webview/browser/aw_browser_context.h" | 7 #include "android_webview/browser/aw_browser_context.h" |
8 #include "android_webview/browser/scoped_allow_wait_for_legacy_web_view_api.h" | 8 #include "android_webview/browser/scoped_allow_wait_for_legacy_web_view_api.h" |
9 #include "android_webview/common/aw_switches.h" | 9 #include "android_webview/common/aw_switches.h" |
10 #include "android_webview/common/render_view_messages.h" | 10 #include "android_webview/common/render_view_messages.h" |
11 #include "base/android/scoped_java_ref.h" | 11 #include "base/android/scoped_java_ref.h" |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "content/public/browser/android/content_view_core.h" | 15 #include "content/public/browser/android/content_view_core.h" |
16 #include "content/public/browser/render_process_host.h" | 16 #include "content/public/browser/render_process_host.h" |
17 #include "content/public/browser/render_view_host.h" | 17 #include "content/public/browser/render_view_host.h" |
18 #include "content/public/browser/user_metrics.h" | 18 #include "content/public/browser/user_metrics.h" |
19 #include "content/public/browser/web_contents.h" | 19 #include "content/public/browser/web_contents.h" |
20 #include "content/public/common/frame_navigate_params.h" | 20 #include "content/public/common/frame_navigate_params.h" |
21 | 21 |
22 namespace android_webview { | 22 namespace android_webview { |
23 | 23 |
24 AwRenderViewHostExt::AwRenderViewHostExt( | 24 AwRenderViewHostExt::AwRenderViewHostExt( |
25 AwRenderViewHostExtClient* client, content::WebContents* contents) | 25 AwRenderViewHostExtClient* client, content::WebContents* contents) |
26 : content::WebContentsObserver(contents), | 26 : content::WebContentsObserver(contents), |
27 client_(client), | 27 client_(client), |
28 background_color_(SK_ColorWHITE), | |
28 has_new_hit_test_data_(false) { | 29 has_new_hit_test_data_(false) { |
29 DCHECK(client_); | 30 DCHECK(client_); |
30 } | 31 } |
31 | 32 |
32 AwRenderViewHostExt::~AwRenderViewHostExt() {} | 33 AwRenderViewHostExt::~AwRenderViewHostExt() {} |
33 | 34 |
34 void AwRenderViewHostExt::DocumentHasImages(DocumentHasImagesResult result) { | 35 void AwRenderViewHostExt::DocumentHasImages(DocumentHasImagesResult result) { |
35 DCHECK(CalledOnValidThread()); | 36 DCHECK(CalledOnValidThread()); |
36 if (!web_contents()->GetRenderViewHost()) { | 37 if (!web_contents()->GetRenderViewHost()) { |
37 result.Run(false); | 38 result.Run(false); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
78 DCHECK(CalledOnValidThread()); | 79 DCHECK(CalledOnValidThread()); |
79 Send(new AwViewMsg_ResetScrollAndScaleState(web_contents()->GetRoutingID())); | 80 Send(new AwViewMsg_ResetScrollAndScaleState(web_contents()->GetRoutingID())); |
80 } | 81 } |
81 | 82 |
82 void AwRenderViewHostExt::SetInitialPageScale(double page_scale_factor) { | 83 void AwRenderViewHostExt::SetInitialPageScale(double page_scale_factor) { |
83 DCHECK(CalledOnValidThread()); | 84 DCHECK(CalledOnValidThread()); |
84 Send(new AwViewMsg_SetInitialPageScale(web_contents()->GetRoutingID(), | 85 Send(new AwViewMsg_SetInitialPageScale(web_contents()->GetRoutingID(), |
85 page_scale_factor)); | 86 page_scale_factor)); |
86 } | 87 } |
87 | 88 |
89 void AwRenderViewHostExt::SetBackgroundColor(SkColor c) { | |
mkosiba (inactive)
2013/07/23 11:14:40
why not put it in AwSettings? There's already logi
joth
2013/07/23 17:38:59
I feel AwSettings is the upstream (native) impleme
| |
90 if (background_color_ == c) | |
91 return; | |
92 background_color_ = c; | |
93 Send(new AwViewMsg_SetBackgroundColor(web_contents()->GetRoutingID(), | |
94 background_color_)); | |
95 } | |
96 | |
97 void AwRenderViewHostExt::RenderViewReady() { | |
98 Send(new AwViewMsg_SetBackgroundColor(web_contents()->GetRoutingID(), | |
99 background_color_)); | |
100 } | |
101 | |
88 void AwRenderViewHostExt::RenderProcessGone(base::TerminationStatus status) { | 102 void AwRenderViewHostExt::RenderProcessGone(base::TerminationStatus status) { |
89 DCHECK(CalledOnValidThread()); | 103 DCHECK(CalledOnValidThread()); |
90 for (std::map<int, DocumentHasImagesResult>::iterator pending_req = | 104 for (std::map<int, DocumentHasImagesResult>::iterator pending_req = |
91 pending_document_has_images_requests_.begin(); | 105 pending_document_has_images_requests_.begin(); |
92 pending_req != pending_document_has_images_requests_.end(); | 106 pending_req != pending_document_has_images_requests_.end(); |
93 ++pending_req) { | 107 ++pending_req) { |
94 pending_req->second.Run(false); | 108 pending_req->second.Run(false); |
95 } | 109 } |
96 } | 110 } |
97 | 111 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
137 DCHECK(CalledOnValidThread()); | 151 DCHECK(CalledOnValidThread()); |
138 last_hit_test_data_ = hit_test_data; | 152 last_hit_test_data_ = hit_test_data; |
139 has_new_hit_test_data_ = true; | 153 has_new_hit_test_data_ = true; |
140 } | 154 } |
141 | 155 |
142 void AwRenderViewHostExt::OnPageScaleFactorChanged(float page_scale_factor) { | 156 void AwRenderViewHostExt::OnPageScaleFactorChanged(float page_scale_factor) { |
143 client_->OnWebLayoutPageScaleFactorChanged(page_scale_factor); | 157 client_->OnWebLayoutPageScaleFactorChanged(page_scale_factor); |
144 } | 158 } |
145 | 159 |
146 } // namespace android_webview | 160 } // namespace android_webview |
OLD | NEW |