| 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_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 window_(nullptr), | 432 window_(nullptr), |
| 433 in_shutdown_(false), | 433 in_shutdown_(false), |
| 434 in_bounds_changed_(false), | 434 in_bounds_changed_(false), |
| 435 is_fullscreen_(false), | 435 is_fullscreen_(false), |
| 436 popup_parent_host_view_(nullptr), | 436 popup_parent_host_view_(nullptr), |
| 437 popup_child_host_view_(nullptr), | 437 popup_child_host_view_(nullptr), |
| 438 is_loading_(false), | 438 is_loading_(false), |
| 439 has_composition_text_(false), | 439 has_composition_text_(false), |
| 440 accept_return_character_(false), | 440 accept_return_character_(false), |
| 441 begin_frame_source_(nullptr), | 441 begin_frame_source_(nullptr), |
| 442 needs_begin_frames_(false), |
| 443 added_frame_observer_(false), |
| 442 synthetic_move_sent_(false), | 444 synthetic_move_sent_(false), |
| 443 cursor_visibility_state_in_renderer_(UNKNOWN), | 445 cursor_visibility_state_in_renderer_(UNKNOWN), |
| 444 #if defined(OS_WIN) | 446 #if defined(OS_WIN) |
| 445 legacy_render_widget_host_HWND_(nullptr), | 447 legacy_render_widget_host_HWND_(nullptr), |
| 446 legacy_window_destroyed_(false), | 448 legacy_window_destroyed_(false), |
| 447 virtual_keyboard_requested_(false), | 449 virtual_keyboard_requested_(false), |
| 448 #endif | 450 #endif |
| 449 has_snapped_to_boundary_(false), | 451 has_snapped_to_boundary_(false), |
| 450 is_guest_view_hack_(is_guest_view_hack), | 452 is_guest_view_hack_(is_guest_view_hack), |
| 451 set_focus_on_mouse_down_or_key_event_(false), | 453 set_focus_on_mouse_down_or_key_event_(false), |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 708 | 710 |
| 709 NOTIMPLEMENTED(); | 711 NOTIMPLEMENTED(); |
| 710 return static_cast<gfx::NativeViewAccessible>(NULL); | 712 return static_cast<gfx::NativeViewAccessible>(NULL); |
| 711 } | 713 } |
| 712 | 714 |
| 713 ui::TextInputClient* RenderWidgetHostViewAura::GetTextInputClient() { | 715 ui::TextInputClient* RenderWidgetHostViewAura::GetTextInputClient() { |
| 714 return this; | 716 return this; |
| 715 } | 717 } |
| 716 | 718 |
| 717 void RenderWidgetHostViewAura::SetNeedsBeginFrames(bool needs_begin_frames) { | 719 void RenderWidgetHostViewAura::SetNeedsBeginFrames(bool needs_begin_frames) { |
| 720 needs_begin_frames_ = needs_begin_frames; |
| 721 UpdateNeedsBeginFramesInternal(); |
| 722 } |
| 723 |
| 724 void RenderWidgetHostViewAura::UpdateNeedsBeginFramesInternal() { |
| 718 if (!begin_frame_source_) | 725 if (!begin_frame_source_) |
| 719 return; | 726 return; |
| 720 | 727 |
| 721 if (needs_begin_frames) | 728 if (added_frame_observer_ == needs_begin_frames_) |
| 729 return; |
| 730 |
| 731 if (needs_begin_frames_) |
| 722 begin_frame_source_->AddObserver(this); | 732 begin_frame_source_->AddObserver(this); |
| 723 else | 733 else |
| 724 begin_frame_source_->RemoveObserver(this); | 734 begin_frame_source_->RemoveObserver(this); |
| 735 added_frame_observer_ = needs_begin_frames_; |
| 725 } | 736 } |
| 726 | 737 |
| 727 void RenderWidgetHostViewAura::OnBeginFrame( | 738 void RenderWidgetHostViewAura::OnBeginFrame( |
| 728 const cc::BeginFrameArgs& args) { | 739 const cc::BeginFrameArgs& args) { |
| 729 host_->Send(new ViewMsg_BeginFrame(host_->GetRoutingID(), args)); | 740 host_->Send(new ViewMsg_BeginFrame(host_->GetRoutingID(), args)); |
| 730 last_begin_frame_args_ = args; | 741 last_begin_frame_args_ = args; |
| 731 } | 742 } |
| 732 | 743 |
| 733 const cc::BeginFrameArgs& RenderWidgetHostViewAura::LastUsedBeginFrameArgs() | 744 const cc::BeginFrameArgs& RenderWidgetHostViewAura::LastUsedBeginFrameArgs() |
| 734 const { | 745 const { |
| (...skipping 2185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2920 host_->Send(new ViewMsg_ReclaimCompositorResources( | 2931 host_->Send(new ViewMsg_ReclaimCompositorResources( |
| 2921 host_->GetRoutingID(), compositor_frame_sink_id, is_swap_ack, resources)); | 2932 host_->GetRoutingID(), compositor_frame_sink_id, is_swap_ack, resources)); |
| 2922 } | 2933 } |
| 2923 | 2934 |
| 2924 void RenderWidgetHostViewAura::DelegatedFrameHostOnLostCompositorResources() { | 2935 void RenderWidgetHostViewAura::DelegatedFrameHostOnLostCompositorResources() { |
| 2925 host_->ScheduleComposite(); | 2936 host_->ScheduleComposite(); |
| 2926 } | 2937 } |
| 2927 | 2938 |
| 2928 void RenderWidgetHostViewAura::SetBeginFrameSource( | 2939 void RenderWidgetHostViewAura::SetBeginFrameSource( |
| 2929 cc::BeginFrameSource* source) { | 2940 cc::BeginFrameSource* source) { |
| 2930 bool needs_begin_frames = host_->needs_begin_frames(); | 2941 if (begin_frame_source_ && added_frame_observer_) { |
| 2931 if (begin_frame_source_ && needs_begin_frames) | |
| 2932 begin_frame_source_->RemoveObserver(this); | 2942 begin_frame_source_->RemoveObserver(this); |
| 2943 added_frame_observer_ = false; |
| 2944 } |
| 2933 begin_frame_source_ = source; | 2945 begin_frame_source_ = source; |
| 2934 if (begin_frame_source_ && needs_begin_frames) | 2946 UpdateNeedsBeginFramesInternal(); |
| 2935 begin_frame_source_->AddObserver(this); | |
| 2936 } | 2947 } |
| 2937 | 2948 |
| 2938 bool RenderWidgetHostViewAura::IsAutoResizeEnabled() const { | 2949 bool RenderWidgetHostViewAura::IsAutoResizeEnabled() const { |
| 2939 return host_->auto_resize_enabled(); | 2950 return host_->auto_resize_enabled(); |
| 2940 } | 2951 } |
| 2941 | 2952 |
| 2942 void RenderWidgetHostViewAura::OnDidNavigateMainFrameToNewPage() { | 2953 void RenderWidgetHostViewAura::OnDidNavigateMainFrameToNewPage() { |
| 2943 ui::GestureRecognizer::Get()->CancelActiveTouches(window_); | 2954 ui::GestureRecognizer::Get()->CancelActiveTouches(window_); |
| 2944 } | 2955 } |
| 2945 | 2956 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3045 ->GetTextSelection(focused_view) | 3056 ->GetTextSelection(focused_view) |
| 3046 ->GetSelectedText(&selected_text)) { | 3057 ->GetSelectedText(&selected_text)) { |
| 3047 // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard. | 3058 // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard. |
| 3048 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION); | 3059 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION); |
| 3049 clipboard_writer.WriteText(selected_text); | 3060 clipboard_writer.WriteText(selected_text); |
| 3050 } | 3061 } |
| 3051 #endif // defined(USE_X11) && !defined(OS_CHROMEOS) | 3062 #endif // defined(USE_X11) && !defined(OS_CHROMEOS) |
| 3052 } | 3063 } |
| 3053 | 3064 |
| 3054 } // namespace content | 3065 } // namespace content |
| OLD | NEW |