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" |
| 19 #include "ui/display/display.h" | 20 #include "ui/display/display.h" |
| 20 #include "ui/display/screen.h" | 21 #include "ui/display/screen.h" |
| 21 #include "ui/gfx/geometry/point_conversions.h" | 22 #include "ui/gfx/geometry/point_conversions.h" |
| 22 #include "ui/gfx/geometry/size_conversions.h" | 23 #include "ui/gfx/geometry/size_conversions.h" |
| 23 #include "ui/gfx/geometry/size_f.h" | 24 #include "ui/gfx/geometry/size_f.h" |
| 24 | 25 |
| 25 namespace content { | 26 namespace content { |
| 26 | 27 |
| 27 namespace { | 28 namespace { |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 38 mouse_locked_(false), | 39 mouse_locked_(false), |
| 39 showing_context_menu_(false), | 40 showing_context_menu_(false), |
| 40 #if !defined(USE_AURA) | 41 #if !defined(USE_AURA) |
| 41 selection_text_offset_(0), | 42 selection_text_offset_(0), |
| 42 selection_range_(gfx::Range::InvalidRange()), | 43 selection_range_(gfx::Range::InvalidRange()), |
| 43 #endif | 44 #endif |
| 44 current_device_scale_factor_(0), | 45 current_device_scale_factor_(0), |
| 45 current_display_rotation_(display::Display::ROTATE_0), | 46 current_display_rotation_(display::Display::ROTATE_0), |
| 46 text_input_manager_(nullptr), | 47 text_input_manager_(nullptr), |
| 47 renderer_frame_number_(0), | 48 renderer_frame_number_(0), |
| 49 next_request_id_(0), | |
| 48 weak_factory_(this) { | 50 weak_factory_(this) { |
| 49 } | 51 } |
| 50 | 52 |
| 51 RenderWidgetHostViewBase::~RenderWidgetHostViewBase() { | 53 RenderWidgetHostViewBase::~RenderWidgetHostViewBase() { |
| 52 DCHECK(!mouse_locked_); | 54 DCHECK(!mouse_locked_); |
| 53 // We call this here to guarantee that observers are notified before we go | 55 // We call this here to guarantee that observers are notified before we go |
| 54 // away. However, some subclasses may wish to call this earlier in their | 56 // away. However, some subclasses may wish to call this earlier in their |
| 55 // shutdown process, e.g. to force removal from | 57 // shutdown process, e.g. to force removal from |
| 56 // RenderWidgetHostInputEventRouter's surface map before relinquishing a | 58 // RenderWidgetHostInputEventRouter's surface map before relinquishing a |
| 57 // host pointer, as in RenderWidgetHostViewGuest. There is no harm in calling | 59 // host pointer, as in RenderWidgetHostViewGuest. There is no harm in calling |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 150 | 152 |
| 151 gfx::Size RenderWidgetHostViewBase::GetRequestedRendererSize() const { | 153 gfx::Size RenderWidgetHostViewBase::GetRequestedRendererSize() const { |
| 152 return GetViewBounds().size(); | 154 return GetViewBounds().size(); |
| 153 } | 155 } |
| 154 | 156 |
| 155 ui::TextInputClient* RenderWidgetHostViewBase::GetTextInputClient() { | 157 ui::TextInputClient* RenderWidgetHostViewBase::GetTextInputClient() { |
| 156 NOTREACHED(); | 158 NOTREACHED(); |
| 157 return NULL; | 159 return NULL; |
| 158 } | 160 } |
| 159 | 161 |
| 162 void RenderWidgetHostViewBase::OnTextInputInfoReply( | |
| 163 int request_id, | |
| 164 const std::string& text, | |
| 165 const std::string& placeholder) { | |
| 166 DCHECK(text_input_callbacks_.find(request_id) != text_input_callbacks_.end()); | |
| 167 text_input_callbacks_[request_id].Run(text, placeholder); | |
| 168 text_input_callbacks_.erase(request_id); | |
| 169 } | |
| 170 | |
| 171 void RenderWidgetHostViewBase::FetchTextInputInfo( | |
| 172 base::Callback<void(const std::string&, const std::string&)>& reply) { | |
| 173 if (!GetRenderWidgetHost()) | |
|
David Trainor- moved to gerrit
2016/10/26 01:36:42
I would trigger the callback with an empty struct
shaktisahu
2016/10/31 23:13:58
Done.
| |
| 174 return; | |
| 175 | |
| 176 int request_id = ++next_request_id_; | |
| 177 text_input_callbacks_[request_id] = reply; | |
| 178 GetRenderWidgetHost()->Send(new ViewMsg_GetFormTextInputInfo( | |
| 179 GetRenderWidgetHost()->GetRoutingID(), request_id)); | |
| 180 } | |
| 181 | |
| 160 bool RenderWidgetHostViewBase::IsShowingContextMenu() const { | 182 bool RenderWidgetHostViewBase::IsShowingContextMenu() const { |
| 161 return showing_context_menu_; | 183 return showing_context_menu_; |
| 162 } | 184 } |
| 163 | 185 |
| 164 void RenderWidgetHostViewBase::SetShowingContextMenu(bool showing) { | 186 void RenderWidgetHostViewBase::SetShowingContextMenu(bool showing) { |
| 165 DCHECK_NE(showing_context_menu_, showing); | 187 DCHECK_NE(showing_context_menu_, showing); |
| 166 showing_context_menu_ = showing; | 188 showing_context_menu_ = showing; |
| 167 } | 189 } |
| 168 | 190 |
| 169 base::string16 RenderWidgetHostViewBase::GetSelectedText() { | 191 base::string16 RenderWidgetHostViewBase::GetSelectedText() { |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 522 | 544 |
| 523 bool RenderWidgetHostViewBase::IsChildFrameForTesting() const { | 545 bool RenderWidgetHostViewBase::IsChildFrameForTesting() const { |
| 524 return false; | 546 return false; |
| 525 } | 547 } |
| 526 | 548 |
| 527 cc::SurfaceId RenderWidgetHostViewBase::SurfaceIdForTesting() const { | 549 cc::SurfaceId RenderWidgetHostViewBase::SurfaceIdForTesting() const { |
| 528 return cc::SurfaceId(); | 550 return cc::SurfaceId(); |
| 529 } | 551 } |
| 530 | 552 |
| 531 } // namespace content | 553 } // namespace content |
| OLD | NEW |