| 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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 DISALLOW_COPY_AND_ASSIGN(WindowObserver); | 410 DISALLOW_COPY_AND_ASSIGN(WindowObserver); |
| 412 }; | 411 }; |
| 413 | 412 |
| 414 //////////////////////////////////////////////////////////////////////////////// | 413 //////////////////////////////////////////////////////////////////////////////// |
| 415 // RenderWidgetHostViewAura, public: | 414 // RenderWidgetHostViewAura, public: |
| 416 | 415 |
| 417 RenderWidgetHostViewAura::RenderWidgetHostViewAura(RenderWidgetHost* host, | 416 RenderWidgetHostViewAura::RenderWidgetHostViewAura(RenderWidgetHost* host, |
| 418 bool is_guest_view_hack) | 417 bool is_guest_view_hack) |
| 419 : host_(RenderWidgetHostImpl::From(host)), | 418 : host_(RenderWidgetHostImpl::From(host)), |
| 420 window_(new aura::Window(this)), | 419 window_(new aura::Window(this)), |
| 421 delegated_frame_host_(new DelegatedFrameHost(this)), | 420 delegated_frame_host_(new DelegatedFrameHost(this, false)), |
| 422 in_shutdown_(false), | 421 in_shutdown_(false), |
| 423 in_bounds_changed_(false), | 422 in_bounds_changed_(false), |
| 424 is_fullscreen_(false), | 423 is_fullscreen_(false), |
| 425 popup_parent_host_view_(NULL), | 424 popup_parent_host_view_(NULL), |
| 426 popup_child_host_view_(NULL), | 425 popup_child_host_view_(NULL), |
| 427 is_loading_(false), | 426 is_loading_(false), |
| 428 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), | 427 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), |
| 429 text_input_mode_(ui::TEXT_INPUT_MODE_DEFAULT), | 428 text_input_mode_(ui::TEXT_INPUT_MODE_DEFAULT), |
| 430 text_input_flags_(0), | 429 text_input_flags_(0), |
| 431 can_compose_inline_(true), | 430 can_compose_inline_(true), |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 | 463 |
| 465 bool RenderWidgetHostViewAura::OnMessageReceived( | 464 bool RenderWidgetHostViewAura::OnMessageReceived( |
| 466 const IPC::Message& message) { | 465 const IPC::Message& message) { |
| 467 bool handled = true; | 466 bool handled = true; |
| 468 IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewAura, message) | 467 IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewAura, message) |
| 469 // TODO(kevers): Move to RenderWidgetHostViewImpl and consolidate IPC | 468 // TODO(kevers): Move to RenderWidgetHostViewImpl and consolidate IPC |
| 470 // messages for TextInput<State|Type>Changed. Corresponding code in | 469 // messages for TextInput<State|Type>Changed. Corresponding code in |
| 471 // RenderWidgetHostViewAndroid should also be moved at the same time. | 470 // RenderWidgetHostViewAndroid should also be moved at the same time. |
| 472 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged, | 471 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged, |
| 473 OnTextInputStateChanged) | 472 OnTextInputStateChanged) |
| 473 IPC_MESSAGE_HANDLER(ViewHostMsg_SetNeedsBeginFrames, |
| 474 OnSetNeedsBeginFrames) |
| 474 IPC_MESSAGE_UNHANDLED(handled = false) | 475 IPC_MESSAGE_UNHANDLED(handled = false) |
| 475 IPC_END_MESSAGE_MAP() | 476 IPC_END_MESSAGE_MAP() |
| 476 return handled; | 477 return handled; |
| 477 } | 478 } |
| 478 | 479 |
| 479 void RenderWidgetHostViewAura::InitAsChild( | 480 void RenderWidgetHostViewAura::InitAsChild( |
| 480 gfx::NativeView parent_view) { | 481 gfx::NativeView parent_view) { |
| 481 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); | 482 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); |
| 482 window_->Init(aura::WINDOW_LAYER_SOLID_COLOR); | 483 window_->Init(aura::WINDOW_LAYER_SOLID_COLOR); |
| 483 window_->SetName("RenderWidgetHostViewAura"); | 484 window_->SetName("RenderWidgetHostViewAura"); |
| (...skipping 2111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2595 } | 2596 } |
| 2596 #endif | 2597 #endif |
| 2597 | 2598 |
| 2598 host_->ForwardKeyboardEvent(event); | 2599 host_->ForwardKeyboardEvent(event); |
| 2599 } | 2600 } |
| 2600 | 2601 |
| 2601 SkColorType RenderWidgetHostViewAura::PreferredReadbackFormat() { | 2602 SkColorType RenderWidgetHostViewAura::PreferredReadbackFormat() { |
| 2602 return kN32_SkColorType; | 2603 return kN32_SkColorType; |
| 2603 } | 2604 } |
| 2604 | 2605 |
| 2606 void RenderWidgetHostViewAura::OnSetNeedsBeginFrames(bool needs_begin_frames) { |
| 2607 delegated_frame_host_->OnSetNeedsBeginFrames(needs_begin_frames); |
| 2608 } |
| 2609 |
| 2605 //////////////////////////////////////////////////////////////////////////////// | 2610 //////////////////////////////////////////////////////////////////////////////// |
| 2606 // DelegatedFrameHost, public: | 2611 // DelegatedFrameHostClient, public: |
| 2607 | 2612 |
| 2608 ui::Layer* RenderWidgetHostViewAura::DelegatedFrameHostGetLayer() const { | 2613 ui::Layer* RenderWidgetHostViewAura::DelegatedFrameHostGetLayer() const { |
| 2609 return window_->layer(); | 2614 return window_->layer(); |
| 2610 } | 2615 } |
| 2611 | 2616 |
| 2612 bool RenderWidgetHostViewAura::DelegatedFrameHostIsVisible() const { | 2617 bool RenderWidgetHostViewAura::DelegatedFrameHostIsVisible() const { |
| 2613 return !host_->is_hidden(); | 2618 return !host_->is_hidden(); |
| 2614 } | 2619 } |
| 2615 | 2620 |
| 2616 gfx::Size RenderWidgetHostViewAura::DelegatedFrameHostDesiredSizeInDIP() const { | 2621 gfx::Size RenderWidgetHostViewAura::DelegatedFrameHostDesiredSizeInDIP() const { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2664 void RenderWidgetHostViewAura::DelegatedFrameHostOnLostCompositorResources() { | 2669 void RenderWidgetHostViewAura::DelegatedFrameHostOnLostCompositorResources() { |
| 2665 host_->ScheduleComposite(); | 2670 host_->ScheduleComposite(); |
| 2666 } | 2671 } |
| 2667 | 2672 |
| 2668 void RenderWidgetHostViewAura::DelegatedFrameHostUpdateVSyncParameters( | 2673 void RenderWidgetHostViewAura::DelegatedFrameHostUpdateVSyncParameters( |
| 2669 const base::TimeTicks& timebase, | 2674 const base::TimeTicks& timebase, |
| 2670 const base::TimeDelta& interval) { | 2675 const base::TimeDelta& interval) { |
| 2671 host_->UpdateVSyncParameters(timebase, interval); | 2676 host_->UpdateVSyncParameters(timebase, interval); |
| 2672 } | 2677 } |
| 2673 | 2678 |
| 2679 void RenderWidgetHostViewAura::DelegatedFrameHostSendBeginFrame( |
| 2680 const cc::BeginFrameArgs& args) { |
| 2681 host_->Send(new ViewMsg_BeginFrame(host_->GetRoutingID(), args)); |
| 2682 } |
| 2683 |
| 2674 void RenderWidgetHostViewAura::OnDidNavigateMainFrameToNewPage() { | 2684 void RenderWidgetHostViewAura::OnDidNavigateMainFrameToNewPage() { |
| 2675 ui::GestureRecognizer::Get()->CancelActiveTouches(window_); | 2685 ui::GestureRecognizer::Get()->CancelActiveTouches(window_); |
| 2676 } | 2686 } |
| 2677 | 2687 |
| 2678 //////////////////////////////////////////////////////////////////////////////// | 2688 //////////////////////////////////////////////////////////////////////////////// |
| 2679 // RenderWidgetHostViewBase, public: | 2689 // RenderWidgetHostViewBase, public: |
| 2680 | 2690 |
| 2681 // static | 2691 // static |
| 2682 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { | 2692 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { |
| 2683 GetScreenInfoForWindow(results, NULL); | 2693 GetScreenInfoForWindow(results, NULL); |
| 2684 } | 2694 } |
| 2685 | 2695 |
| 2686 } // namespace content | 2696 } // namespace content |
| OLD | NEW |