| 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_impl.h" | 5 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 input_method_active_(false), | 179 input_method_active_(false), |
| 180 text_direction_updated_(false), | 180 text_direction_updated_(false), |
| 181 text_direction_(blink::WebTextDirectionLeftToRight), | 181 text_direction_(blink::WebTextDirectionLeftToRight), |
| 182 text_direction_canceled_(false), | 182 text_direction_canceled_(false), |
| 183 suppress_next_char_events_(false), | 183 suppress_next_char_events_(false), |
| 184 pending_mouse_lock_request_(false), | 184 pending_mouse_lock_request_(false), |
| 185 allow_privileged_mouse_lock_(false), | 185 allow_privileged_mouse_lock_(false), |
| 186 has_touch_handler_(false), | 186 has_touch_handler_(false), |
| 187 next_browser_snapshot_id_(1), | 187 next_browser_snapshot_id_(1), |
| 188 owned_by_render_frame_host_(false), | 188 owned_by_render_frame_host_(false), |
| 189 is_focused_(false), |
| 189 weak_factory_(this) { | 190 weak_factory_(this) { |
| 190 CHECK(delegate_); | 191 CHECK(delegate_); |
| 191 if (routing_id_ == MSG_ROUTING_NONE) { | 192 if (routing_id_ == MSG_ROUTING_NONE) { |
| 192 routing_id_ = process_->GetNextRoutingID(); | 193 routing_id_ = process_->GetNextRoutingID(); |
| 193 surface_id_ = GpuSurfaceTracker::Get()->AddSurfaceForRenderer( | 194 surface_id_ = GpuSurfaceTracker::Get()->AddSurfaceForRenderer( |
| 194 process_->GetID(), | 195 process_->GetID(), |
| 195 routing_id_); | 196 routing_id_); |
| 196 } else { | 197 } else { |
| 197 // TODO(piman): This is a O(N) lookup, where we could forward the | 198 // TODO(piman): This is a O(N) lookup, where we could forward the |
| 198 // information from the RenderWidgetHelper. The problem is that doing so | 199 // information from the RenderWidgetHelper. The problem is that doing so |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 Send(new ViewMsg_ChangeResizeRect(routing_id_, new_rect)); | 657 Send(new ViewMsg_ChangeResizeRect(routing_id_, new_rect)); |
| 657 } | 658 } |
| 658 | 659 |
| 659 void RenderWidgetHostImpl::GotFocus() { | 660 void RenderWidgetHostImpl::GotFocus() { |
| 660 Focus(); | 661 Focus(); |
| 661 if (delegate_) | 662 if (delegate_) |
| 662 delegate_->RenderWidgetGotFocus(this); | 663 delegate_->RenderWidgetGotFocus(this); |
| 663 } | 664 } |
| 664 | 665 |
| 665 void RenderWidgetHostImpl::Focus() { | 666 void RenderWidgetHostImpl::Focus() { |
| 667 is_focused_ = true; |
| 668 |
| 666 Send(new InputMsg_SetFocus(routing_id_, true)); | 669 Send(new InputMsg_SetFocus(routing_id_, true)); |
| 667 } | 670 } |
| 668 | 671 |
| 669 void RenderWidgetHostImpl::Blur() { | 672 void RenderWidgetHostImpl::Blur() { |
| 673 is_focused_ = false; |
| 674 |
| 670 // If there is a pending mouse lock request, we don't want to reject it at | 675 // If there is a pending mouse lock request, we don't want to reject it at |
| 671 // this point. The user can switch focus back to this view and approve the | 676 // this point. The user can switch focus back to this view and approve the |
| 672 // request later. | 677 // request later. |
| 673 if (IsMouseLocked()) | 678 if (IsMouseLocked()) |
| 674 view_->UnlockMouse(); | 679 view_->UnlockMouse(); |
| 675 | 680 |
| 676 if (touch_emulator_) | 681 if (touch_emulator_) |
| 677 touch_emulator_->CancelTouch(); | 682 touch_emulator_->CancelTouch(); |
| 678 | 683 |
| 679 Send(new InputMsg_SetFocus(routing_id_, false)); | 684 Send(new InputMsg_SetFocus(routing_id_, false)); |
| (...skipping 1512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2192 } | 2197 } |
| 2193 #endif | 2198 #endif |
| 2194 | 2199 |
| 2195 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { | 2200 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { |
| 2196 if (view_) | 2201 if (view_) |
| 2197 return view_->PreferredReadbackFormat(); | 2202 return view_->PreferredReadbackFormat(); |
| 2198 return kN32_SkColorType; | 2203 return kN32_SkColorType; |
| 2199 } | 2204 } |
| 2200 | 2205 |
| 2201 } // namespace content | 2206 } // namespace content |
| OLD | NEW |