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