OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/in_process_renderer/in_process_view_renderer.h
" | 5 #include "android_webview/browser/in_process_renderer/in_process_view_renderer.h
" |
6 | 6 |
7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
8 | 8 |
9 #include "android_webview/public/browser/draw_gl.h" | 9 #include "android_webview/public/browser/draw_gl.h" |
10 #include "android_webview/public/browser/draw_sw.h" | 10 #include "android_webview/public/browser/draw_sw.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 return true; | 103 return true; |
104 } | 104 } |
105 | 105 |
106 } // namespace | 106 } // namespace |
107 | 107 |
108 InProcessViewRenderer::InProcessViewRenderer( | 108 InProcessViewRenderer::InProcessViewRenderer( |
109 BrowserViewRenderer::Client* client, | 109 BrowserViewRenderer::Client* client, |
110 JavaHelper* java_helper) | 110 JavaHelper* java_helper) |
111 : client_(client), | 111 : client_(client), |
112 java_helper_(java_helper), | 112 java_helper_(java_helper), |
| 113 content_view_core_(NULL), |
113 web_contents_(NULL), | 114 web_contents_(NULL), |
114 compositor_(NULL), | 115 compositor_(NULL), |
115 view_visible_(false), | 116 view_visible_(false), |
116 continuous_invalidate_(false), | 117 continuous_invalidate_(false), |
117 continuous_invalidate_task_pending_(false), | 118 continuous_invalidate_task_pending_(false), |
118 width_(0), | 119 width_(0), |
119 height_(0), | 120 height_(0), |
120 attached_to_window_(false), | 121 attached_to_window_(false), |
121 hardware_initialized_(false), | 122 hardware_initialized_(false), |
122 hardware_failed_(false), | 123 hardware_failed_(false), |
(...skipping 30 matching lines...) Expand all Loading... |
153 compositor_->SetClient(NULL); | 154 compositor_->SetClient(NULL); |
154 compositor_ = compositor; | 155 compositor_ = compositor; |
155 hardware_initialized_ = false; | 156 hardware_initialized_ = false; |
156 hardware_failed_ = false; | 157 hardware_failed_ = false; |
157 compositor_->SetClient(this); | 158 compositor_->SetClient(this); |
158 | 159 |
159 if (attached_to_window_) | 160 if (attached_to_window_) |
160 client_->RequestProcessMode(); | 161 client_->RequestProcessMode(); |
161 } | 162 } |
162 | 163 |
| 164 void InProcessViewRenderer::BindSynchronousInputEventFilter( |
| 165 content::SynchronousInputEventFilter* input_event_filter) { |
| 166 input_event_filter_ = input_event_filter; |
| 167 if (content_view_core_) |
| 168 content_view_core_->SetInputEventFilter(input_event_filter_); |
| 169 } |
| 170 |
163 void InProcessViewRenderer::SetContents( | 171 void InProcessViewRenderer::SetContents( |
164 content::ContentViewCore* content_view_core) { | 172 content::ContentViewCore* content_view_core) { |
165 // First remove association from the prior ContentViewCore / WebContents. | 173 // First remove association from the prior ContentViewCore / WebContents. |
| 174 if (content_view_core_) |
| 175 content_view_core_->SetInputEventFilter(NULL); |
| 176 |
166 if (web_contents_) { | 177 if (web_contents_) { |
167 web_contents_->SetUserData(kUserDataKey, NULL); | 178 web_contents_->SetUserData(kUserDataKey, NULL); |
168 DCHECK(!web_contents_); // WebContentsGone should have been called. | 179 DCHECK(!web_contents_); // WebContentsGone should have been called. |
169 } | 180 } |
170 | 181 |
171 if (!content_view_core) | 182 if (!content_view_core) |
172 return; | 183 return; |
173 | 184 |
| 185 content_view_core_->SetInputEventFilter(input_event_filter_); |
| 186 |
174 web_contents_ = content_view_core->GetWebContents(); | 187 web_contents_ = content_view_core->GetWebContents(); |
175 web_contents_->SetUserData(kUserDataKey, new UserData(this)); | 188 web_contents_->SetUserData(kUserDataKey, new UserData(this)); |
176 } | 189 } |
177 | 190 |
178 void InProcessViewRenderer::WebContentsGone() { | 191 void InProcessViewRenderer::WebContentsGone() { |
179 web_contents_ = NULL; | 192 web_contents_ = NULL; |
180 } | 193 } |
181 | 194 |
182 bool InProcessViewRenderer::PrepareDrawGL(int x, int y) { | 195 bool InProcessViewRenderer::PrepareDrawGL(int x, int y) { |
183 // No harm in updating |hw_rendering_scroll_| even if we return false. | 196 // No harm in updating |hw_rendering_scroll_| even if we return false. |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 // TODO(joth): BrowserViewRendererImpl had a bunch of logic for dpi and page | 436 // TODO(joth): BrowserViewRendererImpl had a bunch of logic for dpi and page |
424 // scale here. Determine what if any needs bringing over to this class. | 437 // scale here. Determine what if any needs bringing over to this class. |
425 return CompositeSW(canvas); | 438 return CompositeSW(canvas); |
426 } | 439 } |
427 | 440 |
428 bool InProcessViewRenderer::CompositeSW(SkCanvas* canvas) { | 441 bool InProcessViewRenderer::CompositeSW(SkCanvas* canvas) { |
429 return compositor_ && compositor_->DemandDrawSw(canvas); | 442 return compositor_ && compositor_->DemandDrawSw(canvas); |
430 } | 443 } |
431 | 444 |
432 } // namespace android_webview | 445 } // namespace android_webview |
OLD | NEW |