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 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 | 474 |
475 bool RenderWidgetHostViewAura::OnMessageReceived( | 475 bool RenderWidgetHostViewAura::OnMessageReceived( |
476 const IPC::Message& message) { | 476 const IPC::Message& message) { |
477 bool handled = true; | 477 bool handled = true; |
478 IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewAura, message) | 478 IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewAura, message) |
479 // TODO(kevers): Move to RenderWidgetHostViewImpl and consolidate IPC | 479 // TODO(kevers): Move to RenderWidgetHostViewImpl and consolidate IPC |
480 // messages for TextInput<State|Type>Changed. Corresponding code in | 480 // messages for TextInput<State|Type>Changed. Corresponding code in |
481 // RenderWidgetHostViewAndroid should also be moved at the same time. | 481 // RenderWidgetHostViewAndroid should also be moved at the same time. |
482 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged, | 482 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged, |
483 OnTextInputStateChanged) | 483 OnTextInputStateChanged) |
| 484 IPC_MESSAGE_HANDLER(ViewHostMsg_SetNeedsBeginFrames, |
| 485 OnSetNeedsBeginFrames) |
484 IPC_MESSAGE_UNHANDLED(handled = false) | 486 IPC_MESSAGE_UNHANDLED(handled = false) |
485 IPC_END_MESSAGE_MAP() | 487 IPC_END_MESSAGE_MAP() |
486 return handled; | 488 return handled; |
487 } | 489 } |
488 | 490 |
489 void RenderWidgetHostViewAura::InitAsChild( | 491 void RenderWidgetHostViewAura::InitAsChild( |
490 gfx::NativeView parent_view) { | 492 gfx::NativeView parent_view) { |
491 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); | 493 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); |
492 window_->Init(aura::WINDOW_LAYER_SOLID_COLOR); | 494 window_->Init(aura::WINDOW_LAYER_SOLID_COLOR); |
493 window_->SetName("RenderWidgetHostViewAura"); | 495 window_->SetName("RenderWidgetHostViewAura"); |
(...skipping 2023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2517 } | 2519 } |
2518 #endif | 2520 #endif |
2519 | 2521 |
2520 host_->ForwardKeyboardEvent(event); | 2522 host_->ForwardKeyboardEvent(event); |
2521 } | 2523 } |
2522 | 2524 |
2523 SkColorType RenderWidgetHostViewAura::PreferredReadbackFormat() { | 2525 SkColorType RenderWidgetHostViewAura::PreferredReadbackFormat() { |
2524 return kN32_SkColorType; | 2526 return kN32_SkColorType; |
2525 } | 2527 } |
2526 | 2528 |
| 2529 void RenderWidgetHostViewAura::OnSetNeedsBeginFrames(bool needs_begin_frames) { |
| 2530 delegated_frame_host_->OnSetNeedsBeginFrames(needs_begin_frames); |
| 2531 } |
| 2532 |
2527 //////////////////////////////////////////////////////////////////////////////// | 2533 //////////////////////////////////////////////////////////////////////////////// |
2528 // DelegatedFrameHost, public: | 2534 // DelegatedFrameHostClient, public: |
2529 | 2535 |
2530 ui::Compositor* RenderWidgetHostViewAura::GetCompositor() const { | 2536 ui::Compositor* RenderWidgetHostViewAura::GetCompositor() const { |
2531 aura::WindowTreeHost* host = window_->GetHost(); | 2537 aura::WindowTreeHost* host = window_->GetHost(); |
2532 return host ? host->compositor() : NULL; | 2538 return host ? host->compositor() : NULL; |
2533 } | 2539 } |
2534 | 2540 |
2535 ui::Layer* RenderWidgetHostViewAura::GetLayer() { | 2541 ui::Layer* RenderWidgetHostViewAura::GetLayer() { |
2536 return window_->layer(); | 2542 return window_->layer(); |
2537 } | 2543 } |
2538 | 2544 |
(...skipping 11 matching lines...) Expand all Loading... |
2550 | 2556 |
2551 float RenderWidgetHostViewAura::CurrentDeviceScaleFactor() { | 2557 float RenderWidgetHostViewAura::CurrentDeviceScaleFactor() { |
2552 return current_device_scale_factor_; | 2558 return current_device_scale_factor_; |
2553 } | 2559 } |
2554 | 2560 |
2555 gfx::Size RenderWidgetHostViewAura::ConvertViewSizeToPixel( | 2561 gfx::Size RenderWidgetHostViewAura::ConvertViewSizeToPixel( |
2556 const gfx::Size& size) { | 2562 const gfx::Size& size) { |
2557 return content::ConvertViewSizeToPixel(this, size); | 2563 return content::ConvertViewSizeToPixel(this, size); |
2558 } | 2564 } |
2559 | 2565 |
| 2566 void RenderWidgetHostViewAura::OnSendBeginFrame( |
| 2567 const cc::BeginFrameArgs& args) { |
| 2568 host_->Send(new ViewMsg_BeginFrame(host_->GetRoutingID(), args)); |
| 2569 } |
| 2570 |
2560 scoped_ptr<ResizeLock> RenderWidgetHostViewAura::CreateResizeLock( | 2571 scoped_ptr<ResizeLock> RenderWidgetHostViewAura::CreateResizeLock( |
2561 bool defer_compositor_lock) { | 2572 bool defer_compositor_lock) { |
2562 gfx::Size desired_size = window_->bounds().size(); | 2573 gfx::Size desired_size = window_->bounds().size(); |
2563 return scoped_ptr<ResizeLock>(new CompositorResizeLock( | 2574 return scoped_ptr<ResizeLock>(new CompositorResizeLock( |
2564 window_->GetHost(), | 2575 window_->GetHost(), |
2565 desired_size, | 2576 desired_size, |
2566 defer_compositor_lock, | 2577 defer_compositor_lock, |
2567 base::TimeDelta::FromMilliseconds(kResizeLockTimeoutMs))); | 2578 base::TimeDelta::FromMilliseconds(kResizeLockTimeoutMs))); |
2568 } | 2579 } |
2569 | 2580 |
2570 DelegatedFrameHost* RenderWidgetHostViewAura::GetDelegatedFrameHost() const { | 2581 DelegatedFrameHost* RenderWidgetHostViewAura::GetDelegatedFrameHost() const { |
2571 return delegated_frame_host_.get(); | 2582 return delegated_frame_host_.get(); |
2572 } | 2583 } |
2573 | 2584 |
2574 //////////////////////////////////////////////////////////////////////////////// | 2585 //////////////////////////////////////////////////////////////////////////////// |
2575 // RenderWidgetHostViewBase, public: | 2586 // RenderWidgetHostViewBase, public: |
2576 | 2587 |
2577 // static | 2588 // static |
2578 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { | 2589 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { |
2579 GetScreenInfoForWindow(results, NULL); | 2590 GetScreenInfoForWindow(results, NULL); |
2580 } | 2591 } |
2581 | 2592 |
2582 } // namespace content | 2593 } // namespace content |
OLD | NEW |