| 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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 delegated_frame_host_(new DelegatedFrameHost(this)), | 421 delegated_frame_host_(new DelegatedFrameHost(this)), |
| 422 in_shutdown_(false), | 422 in_shutdown_(false), |
| 423 in_bounds_changed_(false), | 423 in_bounds_changed_(false), |
| 424 is_fullscreen_(false), | 424 is_fullscreen_(false), |
| 425 popup_parent_host_view_(nullptr), | 425 popup_parent_host_view_(nullptr), |
| 426 popup_child_host_view_(nullptr), | 426 popup_child_host_view_(nullptr), |
| 427 is_loading_(false), | 427 is_loading_(false), |
| 428 has_composition_text_(false), | 428 has_composition_text_(false), |
| 429 accept_return_character_(false), | 429 accept_return_character_(false), |
| 430 begin_frame_source_(nullptr), | 430 begin_frame_source_(nullptr), |
| 431 needs_begin_frames_(false), | |
| 432 synthetic_move_sent_(false), | 431 synthetic_move_sent_(false), |
| 433 cursor_visibility_state_in_renderer_(UNKNOWN), | 432 cursor_visibility_state_in_renderer_(UNKNOWN), |
| 434 #if defined(OS_WIN) | 433 #if defined(OS_WIN) |
| 435 legacy_render_widget_host_HWND_(nullptr), | 434 legacy_render_widget_host_HWND_(nullptr), |
| 436 legacy_window_destroyed_(false), | 435 legacy_window_destroyed_(false), |
| 437 virtual_keyboard_requested_(false), | 436 virtual_keyboard_requested_(false), |
| 438 #endif | 437 #endif |
| 439 has_snapped_to_boundary_(false), | 438 has_snapped_to_boundary_(false), |
| 440 is_guest_view_hack_(is_guest_view_hack), | 439 is_guest_view_hack_(is_guest_view_hack), |
| 441 set_focus_on_mouse_down_or_key_event_(false), | 440 set_focus_on_mouse_down_or_key_event_(false), |
| (...skipping 29 matching lines...) Expand all Loading... |
| 471 if (rvh) { | 470 if (rvh) { |
| 472 // TODO(mostynb): actually use prefs. Landing this as a separate CL | 471 // TODO(mostynb): actually use prefs. Landing this as a separate CL |
| 473 // first to rebaseline some unreliable layout tests. | 472 // first to rebaseline some unreliable layout tests. |
| 474 ignore_result(rvh->GetWebkitPreferences()); | 473 ignore_result(rvh->GetWebkitPreferences()); |
| 475 } | 474 } |
| 476 } | 475 } |
| 477 | 476 |
| 478 //////////////////////////////////////////////////////////////////////////////// | 477 //////////////////////////////////////////////////////////////////////////////// |
| 479 // RenderWidgetHostViewAura, RenderWidgetHostView implementation: | 478 // RenderWidgetHostViewAura, RenderWidgetHostView implementation: |
| 480 | 479 |
| 481 bool RenderWidgetHostViewAura::OnMessageReceived( | |
| 482 const IPC::Message& message) { | |
| 483 bool handled = true; | |
| 484 IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewAura, message) | |
| 485 IPC_MESSAGE_HANDLER(ViewHostMsg_SetNeedsBeginFrames, | |
| 486 OnSetNeedsBeginFrames) | |
| 487 IPC_MESSAGE_UNHANDLED(handled = false) | |
| 488 IPC_END_MESSAGE_MAP() | |
| 489 return handled; | |
| 490 } | |
| 491 | |
| 492 void RenderWidgetHostViewAura::InitAsChild( | 480 void RenderWidgetHostViewAura::InitAsChild( |
| 493 gfx::NativeView parent_view) { | 481 gfx::NativeView parent_view) { |
| 494 CreateAuraWindow(); | 482 CreateAuraWindow(); |
| 495 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); | 483 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); |
| 496 window_->Init(ui::LAYER_SOLID_COLOR); | 484 window_->Init(ui::LAYER_SOLID_COLOR); |
| 497 window_->SetName("RenderWidgetHostViewAura"); | 485 window_->SetName("RenderWidgetHostViewAura"); |
| 498 window_->layer()->SetColor(background_color_); | 486 window_->layer()->SetColor(background_color_); |
| 499 | 487 |
| 500 if (parent_view) | 488 if (parent_view) |
| 501 parent_view->AddChild(GetNativeView()); | 489 parent_view->AddChild(GetNativeView()); |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 #endif | 692 #endif |
| 705 | 693 |
| 706 NOTIMPLEMENTED(); | 694 NOTIMPLEMENTED(); |
| 707 return static_cast<gfx::NativeViewAccessible>(NULL); | 695 return static_cast<gfx::NativeViewAccessible>(NULL); |
| 708 } | 696 } |
| 709 | 697 |
| 710 ui::TextInputClient* RenderWidgetHostViewAura::GetTextInputClient() { | 698 ui::TextInputClient* RenderWidgetHostViewAura::GetTextInputClient() { |
| 711 return this; | 699 return this; |
| 712 } | 700 } |
| 713 | 701 |
| 714 void RenderWidgetHostViewAura::OnSetNeedsBeginFrames(bool needs_begin_frames) { | 702 void RenderWidgetHostViewAura::SetNeedsBeginFrames(bool needs_begin_frames) { |
| 715 if (needs_begin_frames_ == needs_begin_frames) | 703 if (!begin_frame_source_) |
| 716 return; | 704 return; |
| 717 | 705 |
| 718 needs_begin_frames_ = needs_begin_frames; | 706 if (needs_begin_frames) |
| 719 if (begin_frame_source_) { | 707 begin_frame_source_->AddObserver(this); |
| 720 if (needs_begin_frames_) | 708 else |
| 721 begin_frame_source_->AddObserver(this); | 709 begin_frame_source_->RemoveObserver(this); |
| 722 else | |
| 723 begin_frame_source_->RemoveObserver(this); | |
| 724 } | |
| 725 } | 710 } |
| 726 | 711 |
| 727 void RenderWidgetHostViewAura::OnBeginFrame( | 712 void RenderWidgetHostViewAura::OnBeginFrame( |
| 728 const cc::BeginFrameArgs& args) { | 713 const cc::BeginFrameArgs& args) { |
| 729 delegated_frame_host_->SetVSyncParameters(args.frame_time, args.interval); | 714 delegated_frame_host_->SetVSyncParameters(args.frame_time, args.interval); |
| 730 host_->Send(new ViewMsg_BeginFrame(host_->GetRoutingID(), args)); | 715 host_->Send(new ViewMsg_BeginFrame(host_->GetRoutingID(), args)); |
| 731 last_begin_frame_args_ = args; | 716 last_begin_frame_args_ = args; |
| 732 } | 717 } |
| 733 | 718 |
| 734 const cc::BeginFrameArgs& RenderWidgetHostViewAura::LastUsedBeginFrameArgs() | 719 const cc::BeginFrameArgs& RenderWidgetHostViewAura::LastUsedBeginFrameArgs() |
| (...skipping 2181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2916 } | 2901 } |
| 2917 | 2902 |
| 2918 void RenderWidgetHostViewAura::DelegatedFrameHostUpdateVSyncParameters( | 2903 void RenderWidgetHostViewAura::DelegatedFrameHostUpdateVSyncParameters( |
| 2919 const base::TimeTicks& timebase, | 2904 const base::TimeTicks& timebase, |
| 2920 const base::TimeDelta& interval) { | 2905 const base::TimeDelta& interval) { |
| 2921 host_->UpdateVSyncParameters(timebase, interval); | 2906 host_->UpdateVSyncParameters(timebase, interval); |
| 2922 } | 2907 } |
| 2923 | 2908 |
| 2924 void RenderWidgetHostViewAura::SetBeginFrameSource( | 2909 void RenderWidgetHostViewAura::SetBeginFrameSource( |
| 2925 cc::BeginFrameSource* source) { | 2910 cc::BeginFrameSource* source) { |
| 2926 if (begin_frame_source_ && needs_begin_frames_) | 2911 bool needs_begin_frames = host_->needs_begin_frames(); |
| 2912 if (begin_frame_source_ && needs_begin_frames) |
| 2927 begin_frame_source_->RemoveObserver(this); | 2913 begin_frame_source_->RemoveObserver(this); |
| 2928 begin_frame_source_ = source; | 2914 begin_frame_source_ = source; |
| 2929 if (begin_frame_source_ && needs_begin_frames_) | 2915 if (begin_frame_source_ && needs_begin_frames) |
| 2930 begin_frame_source_->AddObserver(this); | 2916 begin_frame_source_->AddObserver(this); |
| 2931 } | 2917 } |
| 2932 | 2918 |
| 2933 bool RenderWidgetHostViewAura::IsAutoResizeEnabled() const { | 2919 bool RenderWidgetHostViewAura::IsAutoResizeEnabled() const { |
| 2934 return host_->auto_resize_enabled(); | 2920 return host_->auto_resize_enabled(); |
| 2935 } | 2921 } |
| 2936 | 2922 |
| 2937 void RenderWidgetHostViewAura::OnDidNavigateMainFrameToNewPage() { | 2923 void RenderWidgetHostViewAura::OnDidNavigateMainFrameToNewPage() { |
| 2938 ui::GestureRecognizer::Get()->CancelActiveTouches(window_); | 2924 ui::GestureRecognizer::Get()->CancelActiveTouches(window_); |
| 2939 } | 2925 } |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3052 return; | 3038 return; |
| 3053 } | 3039 } |
| 3054 | 3040 |
| 3055 // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard. | 3041 // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard. |
| 3056 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION); | 3042 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION); |
| 3057 clipboard_writer.WriteText(text_selection->text.substr(pos, n)); | 3043 clipboard_writer.WriteText(text_selection->text.substr(pos, n)); |
| 3058 #endif // defined(USE_X11) && !defined(OS_CHROMEOS) | 3044 #endif // defined(USE_X11) && !defined(OS_CHROMEOS) |
| 3059 } | 3045 } |
| 3060 | 3046 |
| 3061 } // namespace content | 3047 } // namespace content |
| OLD | NEW |