Chromium Code Reviews| 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 "content/browser/renderer_host/render_widget_host_view_base.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "content/browser/accessibility/browser_accessibility_manager.h" | 9 #include "content/browser/accessibility/browser_accessibility_manager.h" |
| 10 #include "content/browser/gpu/gpu_data_manager_impl.h" | 10 #include "content/browser/gpu/gpu_data_manager_impl.h" |
| 11 #include "content/browser/renderer_host/input/synthetic_gesture_target_base.h" | 11 #include "content/browser/renderer_host/input/synthetic_gesture_target_base.h" |
| 12 #include "content/browser/renderer_host/render_process_host_impl.h" | 12 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 13 #include "content/browser/renderer_host/render_widget_host_delegate.h" | 13 #include "content/browser/renderer_host/render_widget_host_delegate.h" |
| 14 #include "content/browser/renderer_host/render_widget_host_impl.h" | 14 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 15 #include "content/browser/renderer_host/render_widget_host_view_base_observer.h" | 15 #include "content/browser/renderer_host/render_widget_host_view_base_observer.h" |
| 16 #include "content/browser/renderer_host/text_input_manager.h" | 16 #include "content/browser/renderer_host/text_input_manager.h" |
| 17 #include "content/common/content_switches_internal.h" | 17 #include "content/common/content_switches_internal.h" |
| 18 #include "content/common/view_messages.h" | |
| 18 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" | 19 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" |
| 20 #include "content/public/common/form_field_data.h" | |
| 19 #include "ui/display/display.h" | 21 #include "ui/display/display.h" |
| 20 #include "ui/display/screen.h" | 22 #include "ui/display/screen.h" |
| 21 #include "ui/gfx/geometry/point_conversions.h" | 23 #include "ui/gfx/geometry/point_conversions.h" |
| 22 #include "ui/gfx/geometry/size_conversions.h" | 24 #include "ui/gfx/geometry/size_conversions.h" |
| 23 #include "ui/gfx/geometry/size_f.h" | 25 #include "ui/gfx/geometry/size_f.h" |
| 24 | 26 |
| 25 namespace content { | 27 namespace content { |
| 26 | 28 |
| 27 namespace { | 29 namespace { |
| 28 | 30 |
| 29 // How many microseconds apart input events should be flushed. | 31 // How many microseconds apart input events should be flushed. |
| 30 const int kFlushInputRateInUs = 16666; | 32 const int kFlushInputRateInUs = 16666; |
| 31 | 33 |
| 34 // For tracking requests for form field data. | |
| 35 int next_request_id_ = 0; | |
| 32 } | 36 } |
| 33 | 37 |
| 34 RenderWidgetHostViewBase::RenderWidgetHostViewBase() | 38 RenderWidgetHostViewBase::RenderWidgetHostViewBase() |
| 35 : is_fullscreen_(false), | 39 : is_fullscreen_(false), |
| 36 popup_type_(blink::WebPopupTypeNone), | 40 popup_type_(blink::WebPopupTypeNone), |
| 37 background_color_(SK_ColorWHITE), | 41 background_color_(SK_ColorWHITE), |
| 38 mouse_locked_(false), | 42 mouse_locked_(false), |
| 39 showing_context_menu_(false), | 43 showing_context_menu_(false), |
| 40 #if !defined(USE_AURA) | 44 #if !defined(USE_AURA) |
| 41 selection_text_offset_(0), | 45 selection_text_offset_(0), |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 150 | 154 |
| 151 gfx::Size RenderWidgetHostViewBase::GetRequestedRendererSize() const { | 155 gfx::Size RenderWidgetHostViewBase::GetRequestedRendererSize() const { |
| 152 return GetViewBounds().size(); | 156 return GetViewBounds().size(); |
| 153 } | 157 } |
| 154 | 158 |
| 155 ui::TextInputClient* RenderWidgetHostViewBase::GetTextInputClient() { | 159 ui::TextInputClient* RenderWidgetHostViewBase::GetTextInputClient() { |
| 156 NOTREACHED(); | 160 NOTREACHED(); |
| 157 return NULL; | 161 return NULL; |
| 158 } | 162 } |
| 159 | 163 |
| 164 void RenderWidgetHostViewBase::OnFocusedFormFieldDataReply( | |
| 165 int request_id, | |
| 166 const FormFieldData& field_data) { | |
| 167 DCHECK(extract_form_field_data_callbacks_.find(request_id) != | |
| 168 extract_form_field_data_callbacks_.end()); | |
| 169 extract_form_field_data_callbacks_[request_id].Run(field_data); | |
|
David Trainor- moved to gerrit
2016/11/03 04:25:49
What if we have callbacks when the RWHV dies? Sho
| |
| 170 extract_form_field_data_callbacks_.erase(request_id); | |
| 171 } | |
| 172 | |
| 173 void RenderWidgetHostViewBase::GetFocusedFormFieldData( | |
| 174 ExtractFormFieldDataCallback& reply) { | |
| 175 if (!GetRenderWidgetHost()) { | |
| 176 reply.Run(FormFieldData()); | |
| 177 return; | |
| 178 } | |
| 179 | |
| 180 int request_id = ++next_request_id_; | |
| 181 extract_form_field_data_callbacks_[request_id] = reply; | |
| 182 GetRenderWidgetHost()->Send(new ViewMsg_GetFocusedFormFieldData( | |
| 183 GetRenderWidgetHost()->GetRoutingID(), request_id)); | |
| 184 } | |
| 185 | |
| 160 bool RenderWidgetHostViewBase::IsShowingContextMenu() const { | 186 bool RenderWidgetHostViewBase::IsShowingContextMenu() const { |
| 161 return showing_context_menu_; | 187 return showing_context_menu_; |
| 162 } | 188 } |
| 163 | 189 |
| 164 void RenderWidgetHostViewBase::SetShowingContextMenu(bool showing) { | 190 void RenderWidgetHostViewBase::SetShowingContextMenu(bool showing) { |
| 165 DCHECK_NE(showing_context_menu_, showing); | 191 DCHECK_NE(showing_context_menu_, showing); |
| 166 showing_context_menu_ = showing; | 192 showing_context_menu_ = showing; |
| 167 } | 193 } |
| 168 | 194 |
| 169 base::string16 RenderWidgetHostViewBase::GetSelectedText() { | 195 base::string16 RenderWidgetHostViewBase::GetSelectedText() { |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 522 | 548 |
| 523 bool RenderWidgetHostViewBase::IsChildFrameForTesting() const { | 549 bool RenderWidgetHostViewBase::IsChildFrameForTesting() const { |
| 524 return false; | 550 return false; |
| 525 } | 551 } |
| 526 | 552 |
| 527 cc::SurfaceId RenderWidgetHostViewBase::SurfaceIdForTesting() const { | 553 cc::SurfaceId RenderWidgetHostViewBase::SurfaceIdForTesting() const { |
| 528 return cc::SurfaceId(); | 554 return cc::SurfaceId(); |
| 529 } | 555 } |
| 530 | 556 |
| 531 } // namespace content | 557 } // namespace content |
| OLD | NEW |