| 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 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 delegated_frame_host_(new DelegatedFrameHost(this)), | 433 delegated_frame_host_(new DelegatedFrameHost(this)), |
| 434 in_shutdown_(false), | 434 in_shutdown_(false), |
| 435 in_bounds_changed_(false), | 435 in_bounds_changed_(false), |
| 436 is_fullscreen_(false), | 436 is_fullscreen_(false), |
| 437 popup_parent_host_view_(nullptr), | 437 popup_parent_host_view_(nullptr), |
| 438 popup_child_host_view_(nullptr), | 438 popup_child_host_view_(nullptr), |
| 439 is_loading_(false), | 439 is_loading_(false), |
| 440 has_composition_text_(false), | 440 has_composition_text_(false), |
| 441 accept_return_character_(false), | 441 accept_return_character_(false), |
| 442 begin_frame_source_(nullptr), | 442 begin_frame_source_(nullptr), |
| 443 needs_begin_frames_(false), | |
| 444 needs_flush_input_(false), | |
| 445 added_frame_observer_(false), | |
| 446 synthetic_move_sent_(false), | 443 synthetic_move_sent_(false), |
| 447 cursor_visibility_state_in_renderer_(UNKNOWN), | 444 cursor_visibility_state_in_renderer_(UNKNOWN), |
| 448 #if defined(OS_WIN) | 445 #if defined(OS_WIN) |
| 449 legacy_render_widget_host_HWND_(nullptr), | 446 legacy_render_widget_host_HWND_(nullptr), |
| 450 legacy_window_destroyed_(false), | 447 legacy_window_destroyed_(false), |
| 451 virtual_keyboard_requested_(false), | 448 virtual_keyboard_requested_(false), |
| 452 #endif | 449 #endif |
| 453 has_snapped_to_boundary_(false), | 450 has_snapped_to_boundary_(false), |
| 454 is_guest_view_hack_(is_guest_view_hack), | 451 is_guest_view_hack_(is_guest_view_hack), |
| 455 set_focus_on_mouse_down_or_key_event_(false), | 452 set_focus_on_mouse_down_or_key_event_(false), |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 708 | 705 |
| 709 NOTIMPLEMENTED(); | 706 NOTIMPLEMENTED(); |
| 710 return static_cast<gfx::NativeViewAccessible>(NULL); | 707 return static_cast<gfx::NativeViewAccessible>(NULL); |
| 711 } | 708 } |
| 712 | 709 |
| 713 ui::TextInputClient* RenderWidgetHostViewAura::GetTextInputClient() { | 710 ui::TextInputClient* RenderWidgetHostViewAura::GetTextInputClient() { |
| 714 return this; | 711 return this; |
| 715 } | 712 } |
| 716 | 713 |
| 717 void RenderWidgetHostViewAura::SetNeedsBeginFrames(bool needs_begin_frames) { | 714 void RenderWidgetHostViewAura::SetNeedsBeginFrames(bool needs_begin_frames) { |
| 718 needs_begin_frames_ = needs_begin_frames; | |
| 719 UpdateNeedsBeginFramesInternal(); | |
| 720 } | |
| 721 | |
| 722 void RenderWidgetHostViewAura::OnSetNeedsFlushInput() { | |
| 723 needs_flush_input_ = true; | |
| 724 UpdateNeedsBeginFramesInternal(); | |
| 725 } | |
| 726 | |
| 727 void RenderWidgetHostViewAura::UpdateNeedsBeginFramesInternal() { | |
| 728 if (!begin_frame_source_) | 715 if (!begin_frame_source_) |
| 729 return; | 716 return; |
| 730 | 717 |
| 731 bool needs_frame = needs_begin_frames_ || needs_flush_input_; | 718 if (needs_begin_frames) |
| 732 if (needs_frame == added_frame_observer_) | |
| 733 return; | |
| 734 | |
| 735 added_frame_observer_ = needs_frame; | |
| 736 if (needs_frame) | |
| 737 begin_frame_source_->AddObserver(this); | 719 begin_frame_source_->AddObserver(this); |
| 738 else | 720 else |
| 739 begin_frame_source_->RemoveObserver(this); | 721 begin_frame_source_->RemoveObserver(this); |
| 740 } | 722 } |
| 741 | 723 |
| 742 void RenderWidgetHostViewAura::OnBeginFrame( | 724 void RenderWidgetHostViewAura::OnBeginFrame( |
| 743 const cc::BeginFrameArgs& args) { | 725 const cc::BeginFrameArgs& args) { |
| 744 needs_flush_input_ = false; | |
| 745 host_->FlushInput(); | |
| 746 UpdateNeedsBeginFramesInternal(); | |
| 747 host_->Send(new ViewMsg_BeginFrame(host_->GetRoutingID(), args)); | 726 host_->Send(new ViewMsg_BeginFrame(host_->GetRoutingID(), args)); |
| 748 last_begin_frame_args_ = args; | 727 last_begin_frame_args_ = args; |
| 749 } | 728 } |
| 750 | 729 |
| 751 const cc::BeginFrameArgs& RenderWidgetHostViewAura::LastUsedBeginFrameArgs() | 730 const cc::BeginFrameArgs& RenderWidgetHostViewAura::LastUsedBeginFrameArgs() |
| 752 const { | 731 const { |
| 753 return last_begin_frame_args_; | 732 return last_begin_frame_args_; |
| 754 } | 733 } |
| 755 | 734 |
| 756 void RenderWidgetHostViewAura::OnBeginFrameSourcePausedChanged(bool paused) { | 735 void RenderWidgetHostViewAura::OnBeginFrameSourcePausedChanged(bool paused) { |
| (...skipping 2181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2938 host_->Send(new ViewMsg_ReclaimCompositorResources( | 2917 host_->Send(new ViewMsg_ReclaimCompositorResources( |
| 2939 host_->GetRoutingID(), compositor_frame_sink_id, is_swap_ack, resources)); | 2918 host_->GetRoutingID(), compositor_frame_sink_id, is_swap_ack, resources)); |
| 2940 } | 2919 } |
| 2941 | 2920 |
| 2942 void RenderWidgetHostViewAura::DelegatedFrameHostOnLostCompositorResources() { | 2921 void RenderWidgetHostViewAura::DelegatedFrameHostOnLostCompositorResources() { |
| 2943 host_->ScheduleComposite(); | 2922 host_->ScheduleComposite(); |
| 2944 } | 2923 } |
| 2945 | 2924 |
| 2946 void RenderWidgetHostViewAura::SetBeginFrameSource( | 2925 void RenderWidgetHostViewAura::SetBeginFrameSource( |
| 2947 cc::BeginFrameSource* source) { | 2926 cc::BeginFrameSource* source) { |
| 2948 if (begin_frame_source_ && added_frame_observer_) { | 2927 bool needs_begin_frames = host_->needs_begin_frames(); |
| 2928 if (begin_frame_source_ && needs_begin_frames) |
| 2949 begin_frame_source_->RemoveObserver(this); | 2929 begin_frame_source_->RemoveObserver(this); |
| 2950 added_frame_observer_ = false; | |
| 2951 } | |
| 2952 begin_frame_source_ = source; | 2930 begin_frame_source_ = source; |
| 2953 UpdateNeedsBeginFramesInternal(); | 2931 if (begin_frame_source_ && needs_begin_frames) |
| 2932 begin_frame_source_->AddObserver(this); |
| 2954 } | 2933 } |
| 2955 | 2934 |
| 2956 bool RenderWidgetHostViewAura::IsAutoResizeEnabled() const { | 2935 bool RenderWidgetHostViewAura::IsAutoResizeEnabled() const { |
| 2957 return host_->auto_resize_enabled(); | 2936 return host_->auto_resize_enabled(); |
| 2958 } | 2937 } |
| 2959 | 2938 |
| 2960 void RenderWidgetHostViewAura::OnDidNavigateMainFrameToNewPage() { | 2939 void RenderWidgetHostViewAura::OnDidNavigateMainFrameToNewPage() { |
| 2961 ui::GestureRecognizer::Get()->CancelActiveTouches(window_); | 2940 ui::GestureRecognizer::Get()->CancelActiveTouches(window_); |
| 2962 } | 2941 } |
| 2963 | 2942 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3063 ->GetTextSelection(focused_view) | 3042 ->GetTextSelection(focused_view) |
| 3064 ->GetSelectedText(&selected_text)) { | 3043 ->GetSelectedText(&selected_text)) { |
| 3065 // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard. | 3044 // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard. |
| 3066 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION); | 3045 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION); |
| 3067 clipboard_writer.WriteText(selected_text); | 3046 clipboard_writer.WriteText(selected_text); |
| 3068 } | 3047 } |
| 3069 #endif // defined(USE_X11) && !defined(OS_CHROMEOS) | 3048 #endif // defined(USE_X11) && !defined(OS_CHROMEOS) |
| 3070 } | 3049 } |
| 3071 | 3050 |
| 3072 } // namespace content | 3051 } // namespace content |
| OLD | NEW |