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 "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 #include "ui/aura/env.h" | 56 #include "ui/aura/env.h" |
57 #include "ui/aura/window.h" | 57 #include "ui/aura/window.h" |
58 #include "ui/aura/window_event_dispatcher.h" | 58 #include "ui/aura/window_event_dispatcher.h" |
59 #include "ui/aura/window_observer.h" | 59 #include "ui/aura/window_observer.h" |
60 #include "ui/aura/window_tracker.h" | 60 #include "ui/aura/window_tracker.h" |
61 #include "ui/aura/window_tree_host.h" | 61 #include "ui/aura/window_tree_host.h" |
62 #include "ui/base/clipboard/scoped_clipboard_writer.h" | 62 #include "ui/base/clipboard/scoped_clipboard_writer.h" |
63 #include "ui/base/hit_test.h" | 63 #include "ui/base/hit_test.h" |
64 #include "ui/base/ime/input_method.h" | 64 #include "ui/base/ime/input_method.h" |
65 #include "ui/base/ui_base_types.h" | 65 #include "ui/base/ui_base_types.h" |
66 #include "ui/compositor/compositor_vsync_manager.h" | |
67 #include "ui/compositor/dip_util.h" | 66 #include "ui/compositor/dip_util.h" |
68 #include "ui/events/event.h" | 67 #include "ui/events/event.h" |
69 #include "ui/events/event_utils.h" | 68 #include "ui/events/event_utils.h" |
70 #include "ui/events/gestures/gesture_recognizer.h" | 69 #include "ui/events/gestures/gesture_recognizer.h" |
71 #include "ui/gfx/canvas.h" | 70 #include "ui/gfx/canvas.h" |
72 #include "ui/gfx/display.h" | 71 #include "ui/gfx/display.h" |
73 #include "ui/gfx/geometry/rect_conversions.h" | 72 #include "ui/gfx/geometry/rect_conversions.h" |
74 #include "ui/gfx/geometry/size_conversions.h" | 73 #include "ui/gfx/geometry/size_conversions.h" |
75 #include "ui/gfx/screen.h" | 74 #include "ui/gfx/screen.h" |
76 #include "ui/gfx/skia_util.h" | 75 #include "ui/gfx/skia_util.h" |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 DISALLOW_COPY_AND_ASSIGN(WindowObserver); | 406 DISALLOW_COPY_AND_ASSIGN(WindowObserver); |
408 }; | 407 }; |
409 | 408 |
410 //////////////////////////////////////////////////////////////////////////////// | 409 //////////////////////////////////////////////////////////////////////////////// |
411 // RenderWidgetHostViewAura, public: | 410 // RenderWidgetHostViewAura, public: |
412 | 411 |
413 RenderWidgetHostViewAura::RenderWidgetHostViewAura(RenderWidgetHost* host, | 412 RenderWidgetHostViewAura::RenderWidgetHostViewAura(RenderWidgetHost* host, |
414 bool is_guest_view_hack) | 413 bool is_guest_view_hack) |
415 : host_(RenderWidgetHostImpl::From(host)), | 414 : host_(RenderWidgetHostImpl::From(host)), |
416 window_(new aura::Window(this)), | 415 window_(new aura::Window(this)), |
417 delegated_frame_host_(new DelegatedFrameHost(this)), | 416 delegated_frame_host_(new DelegatedFrameHost(this, true)), |
418 in_shutdown_(false), | 417 in_shutdown_(false), |
419 in_bounds_changed_(false), | 418 in_bounds_changed_(false), |
420 is_fullscreen_(false), | 419 is_fullscreen_(false), |
421 popup_parent_host_view_(NULL), | 420 popup_parent_host_view_(NULL), |
422 popup_child_host_view_(NULL), | 421 popup_child_host_view_(NULL), |
423 is_loading_(false), | 422 is_loading_(false), |
424 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), | 423 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), |
425 text_input_mode_(ui::TEXT_INPUT_MODE_DEFAULT), | 424 text_input_mode_(ui::TEXT_INPUT_MODE_DEFAULT), |
426 text_input_flags_(0), | 425 text_input_flags_(0), |
427 can_compose_inline_(true), | 426 can_compose_inline_(true), |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 | 459 |
461 bool RenderWidgetHostViewAura::OnMessageReceived( | 460 bool RenderWidgetHostViewAura::OnMessageReceived( |
462 const IPC::Message& message) { | 461 const IPC::Message& message) { |
463 bool handled = true; | 462 bool handled = true; |
464 IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewAura, message) | 463 IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewAura, message) |
465 // TODO(kevers): Move to RenderWidgetHostViewImpl and consolidate IPC | 464 // TODO(kevers): Move to RenderWidgetHostViewImpl and consolidate IPC |
466 // messages for TextInput<State|Type>Changed. Corresponding code in | 465 // messages for TextInput<State|Type>Changed. Corresponding code in |
467 // RenderWidgetHostViewAndroid should also be moved at the same time. | 466 // RenderWidgetHostViewAndroid should also be moved at the same time. |
468 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged, | 467 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged, |
469 OnTextInputStateChanged) | 468 OnTextInputStateChanged) |
| 469 IPC_MESSAGE_HANDLER(ViewHostMsg_SetNeedsBeginFrames, |
| 470 OnSetNeedsBeginFrames) |
470 IPC_MESSAGE_UNHANDLED(handled = false) | 471 IPC_MESSAGE_UNHANDLED(handled = false) |
471 IPC_END_MESSAGE_MAP() | 472 IPC_END_MESSAGE_MAP() |
472 return handled; | 473 return handled; |
473 } | 474 } |
474 | 475 |
475 void RenderWidgetHostViewAura::InitAsChild( | 476 void RenderWidgetHostViewAura::InitAsChild( |
476 gfx::NativeView parent_view) { | 477 gfx::NativeView parent_view) { |
477 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); | 478 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); |
478 window_->Init(aura::WINDOW_LAYER_SOLID_COLOR); | 479 window_->Init(aura::WINDOW_LAYER_SOLID_COLOR); |
479 window_->SetName("RenderWidgetHostViewAura"); | 480 window_->SetName("RenderWidgetHostViewAura"); |
(...skipping 2111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2591 } | 2592 } |
2592 #endif | 2593 #endif |
2593 | 2594 |
2594 host_->ForwardKeyboardEvent(event); | 2595 host_->ForwardKeyboardEvent(event); |
2595 } | 2596 } |
2596 | 2597 |
2597 SkColorType RenderWidgetHostViewAura::PreferredReadbackFormat() { | 2598 SkColorType RenderWidgetHostViewAura::PreferredReadbackFormat() { |
2598 return kN32_SkColorType; | 2599 return kN32_SkColorType; |
2599 } | 2600 } |
2600 | 2601 |
| 2602 void RenderWidgetHostViewAura::OnSetNeedsBeginFrames(bool needs_begin_frames) { |
| 2603 delegated_frame_host_->OnSetNeedsBeginFrames(needs_begin_frames); |
| 2604 } |
| 2605 |
2601 //////////////////////////////////////////////////////////////////////////////// | 2606 //////////////////////////////////////////////////////////////////////////////// |
2602 // DelegatedFrameHost, public: | 2607 // DelegatedFrameHostClient, public: |
2603 | 2608 |
2604 ui::Layer* RenderWidgetHostViewAura::DelegatedFrameHostGetLayer() const { | 2609 ui::Layer* RenderWidgetHostViewAura::DelegatedFrameHostGetLayer() const { |
2605 return window_->layer(); | 2610 return window_->layer(); |
2606 } | 2611 } |
2607 | 2612 |
2608 bool RenderWidgetHostViewAura::DelegatedFrameHostIsVisible() const { | 2613 bool RenderWidgetHostViewAura::DelegatedFrameHostIsVisible() const { |
2609 return !host_->is_hidden(); | 2614 return !host_->is_hidden(); |
2610 } | 2615 } |
2611 | 2616 |
2612 gfx::Size RenderWidgetHostViewAura::DelegatedFrameHostDesiredSizeInDIP() const { | 2617 gfx::Size RenderWidgetHostViewAura::DelegatedFrameHostDesiredSizeInDIP() const { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2654 int output_surface_id, | 2659 int output_surface_id, |
2655 const cc::CompositorFrameAck& ack) { | 2660 const cc::CompositorFrameAck& ack) { |
2656 host_->Send(new ViewMsg_ReclaimCompositorResources(host_->GetRoutingID(), | 2661 host_->Send(new ViewMsg_ReclaimCompositorResources(host_->GetRoutingID(), |
2657 output_surface_id, ack)); | 2662 output_surface_id, ack)); |
2658 } | 2663 } |
2659 | 2664 |
2660 void RenderWidgetHostViewAura::DelegatedFrameHostOnLostCompositorResources() { | 2665 void RenderWidgetHostViewAura::DelegatedFrameHostOnLostCompositorResources() { |
2661 host_->ScheduleComposite(); | 2666 host_->ScheduleComposite(); |
2662 } | 2667 } |
2663 | 2668 |
2664 void RenderWidgetHostViewAura::DelegatedFrameHostUpdateVSyncParameters( | 2669 void RenderWidgetHostViewAura::DelegatedFrameHostSendBeginFrame( |
2665 const base::TimeTicks& timebase, | 2670 const cc::BeginFrameArgs& args) { |
2666 const base::TimeDelta& interval) { | 2671 host_->Send(new ViewMsg_BeginFrame(host_->GetRoutingID(), args)); |
2667 host_->UpdateVSyncParameters(timebase, interval); | |
2668 } | 2672 } |
2669 | 2673 |
2670 void RenderWidgetHostViewAura::OnDidNavigateMainFrameToNewPage() { | 2674 void RenderWidgetHostViewAura::OnDidNavigateMainFrameToNewPage() { |
2671 ui::GestureRecognizer::Get()->CancelActiveTouches(window_); | 2675 ui::GestureRecognizer::Get()->CancelActiveTouches(window_); |
2672 } | 2676 } |
2673 | 2677 |
2674 //////////////////////////////////////////////////////////////////////////////// | 2678 //////////////////////////////////////////////////////////////////////////////// |
2675 // RenderWidgetHostViewBase, public: | 2679 // RenderWidgetHostViewBase, public: |
2676 | 2680 |
2677 // static | 2681 // static |
2678 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { | 2682 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { |
2679 GetScreenInfoForWindow(results, NULL); | 2683 GetScreenInfoForWindow(results, NULL); |
2680 } | 2684 } |
2681 | 2685 |
2682 } // namespace content | 2686 } // namespace content |
OLD | NEW |