Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/logging.h" | 7 #include "base/logging.h" |
| 8 #include "content/browser/renderer_host/backing_store_skia.h" | 8 #include "content/browser/renderer_host/backing_store_skia.h" |
| 9 #include "content/browser/renderer_host/render_widget_host.h" | 9 #include "content/browser/renderer_host/render_widget_host.h" |
| 10 #include "content/browser/renderer_host/web_input_event_aura.h" | 10 #include "content/browser/renderer_host/web_input_event_aura.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 93 ALLOW_THIS_IN_INITIALIZER_LIST(window_(new aura::Window(this))), | 93 ALLOW_THIS_IN_INITIALIZER_LIST(window_(new aura::Window(this))), |
| 94 is_fullscreen_(false), | 94 is_fullscreen_(false), |
| 95 popup_parent_host_view_(NULL), | 95 popup_parent_host_view_(NULL), |
| 96 is_loading_(false), | 96 is_loading_(false), |
| 97 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) | 97 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) |
| 98 current_surface_(gfx::kNullPluginWindow), | 98 current_surface_(gfx::kNullPluginWindow), |
| 99 #endif | 99 #endif |
| 100 skip_schedule_paint_(false) { | 100 skip_schedule_paint_(false) { |
| 101 host_->SetView(this); | 101 host_->SetView(this); |
| 102 window_->SetProperty(aura::kTooltipTextKey, &tooltip_); | 102 window_->SetProperty(aura::kTooltipTextKey, &tooltip_); |
| 103 window_->SetProperty(aura::kActivationDelegateKey, | |
|
sky
2011/12/09 23:11:23
It would be nice if you added a static setter for
| |
| 104 static_cast<aura::ActivationDelegate*>(this)); | |
| 103 } | 105 } |
| 104 | 106 |
| 105 RenderWidgetHostViewAura::~RenderWidgetHostViewAura() { | 107 RenderWidgetHostViewAura::~RenderWidgetHostViewAura() { |
| 106 } | 108 } |
| 107 | 109 |
| 108 void RenderWidgetHostViewAura::InitAsChild() { | 110 void RenderWidgetHostViewAura::InitAsChild() { |
| 109 window_->Init(ui::Layer::LAYER_HAS_TEXTURE); | 111 window_->Init(ui::Layer::LAYER_HAS_TEXTURE); |
| 110 window_->SetName("RenderWidgetHostViewAura"); | 112 window_->SetName("RenderWidgetHostViewAura"); |
| 111 } | 113 } |
| 112 | 114 |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 528 UpdateWebTouchEventAfterDispatch(&touch_event_, point); | 530 UpdateWebTouchEventAfterDispatch(&touch_event_, point); |
| 529 } | 531 } |
| 530 | 532 |
| 531 return DecideTouchStatus(touch_event_, point); | 533 return DecideTouchStatus(touch_event_, point); |
| 532 } | 534 } |
| 533 | 535 |
| 534 bool RenderWidgetHostViewAura::CanFocus() { | 536 bool RenderWidgetHostViewAura::CanFocus() { |
| 535 return popup_type_ == WebKit::WebPopupTypeNone; | 537 return popup_type_ == WebKit::WebPopupTypeNone; |
| 536 } | 538 } |
| 537 | 539 |
| 538 bool RenderWidgetHostViewAura::ShouldActivate(aura::Event* event) { | |
| 539 return false; | |
| 540 } | |
| 541 | |
| 542 void RenderWidgetHostViewAura::OnActivated() { | |
| 543 } | |
| 544 | |
| 545 void RenderWidgetHostViewAura::OnLostActive() { | |
| 546 } | |
| 547 | |
| 548 void RenderWidgetHostViewAura::OnCaptureLost() { | 540 void RenderWidgetHostViewAura::OnCaptureLost() { |
| 549 host_->LostCapture(); | 541 host_->LostCapture(); |
| 550 } | 542 } |
| 551 | 543 |
| 552 void RenderWidgetHostViewAura::OnPaint(gfx::Canvas* canvas) { | 544 void RenderWidgetHostViewAura::OnPaint(gfx::Canvas* canvas) { |
| 553 if (!window_->IsVisible()) | 545 if (!window_->IsVisible()) |
| 554 return; | 546 return; |
| 555 skip_schedule_paint_ = true; | 547 skip_schedule_paint_ = true; |
| 556 BackingStore* backing_store = host_->GetBackingStore(true); | 548 BackingStore* backing_store = host_->GetBackingStore(true); |
| 557 skip_schedule_paint_ = false; | 549 skip_schedule_paint_ = false; |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 568 } | 560 } |
| 569 | 561 |
| 570 void RenderWidgetHostViewAura::OnWindowDestroyed() { | 562 void RenderWidgetHostViewAura::OnWindowDestroyed() { |
| 571 host_->ViewDestroyed(); | 563 host_->ViewDestroyed(); |
| 572 delete this; | 564 delete this; |
| 573 } | 565 } |
| 574 | 566 |
| 575 void RenderWidgetHostViewAura::OnWindowVisibilityChanged(bool visible) { | 567 void RenderWidgetHostViewAura::OnWindowVisibilityChanged(bool visible) { |
| 576 } | 568 } |
| 577 | 569 |
| 570 //////////////////////////////////////////////////////////////////////////////// | |
| 571 // RenderWidgetHostViewAura, aura::ActivationDelegate implementation: | |
| 572 | |
| 573 bool RenderWidgetHostViewAura::ShouldActivate(aura::Event* event) { | |
| 574 return false; | |
| 575 } | |
| 576 | |
| 577 void RenderWidgetHostViewAura::OnActivated() { | |
| 578 } | |
| 579 | |
| 580 void RenderWidgetHostViewAura::OnLostActive() { | |
| 581 } | |
| 582 | |
| 578 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) | 583 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) |
| 579 //////////////////////////////////////////////////////////////////////////////// | 584 //////////////////////////////////////////////////////////////////////////////// |
| 580 // RenderWidgetHostViewAura, ui::CompositorDelegate implementation: | 585 // RenderWidgetHostViewAura, ui::CompositorDelegate implementation: |
| 581 | 586 |
| 582 void RenderWidgetHostViewAura::OnCompositingEnded(ui::Compositor* compositor) { | 587 void RenderWidgetHostViewAura::OnCompositingEnded(ui::Compositor* compositor) { |
| 583 for (std::vector< base::Callback<void(void)> >::const_iterator | 588 for (std::vector< base::Callback<void(void)> >::const_iterator |
| 584 it = on_compositing_ended_callbacks_.begin(); | 589 it = on_compositing_ended_callbacks_.begin(); |
| 585 it != on_compositing_ended_callbacks_.end(); ++it) { | 590 it != on_compositing_ended_callbacks_.end(); ++it) { |
| 586 it->Run(); | 591 it->Run(); |
| 587 } | 592 } |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 612 // static | 617 // static |
| 613 void RenderWidgetHostView::GetDefaultScreenInfo( | 618 void RenderWidgetHostView::GetDefaultScreenInfo( |
| 614 WebKit::WebScreenInfo* results) { | 619 WebKit::WebScreenInfo* results) { |
| 615 const gfx::Size size = gfx::Screen::GetPrimaryMonitorSize(); | 620 const gfx::Size size = gfx::Screen::GetPrimaryMonitorSize(); |
| 616 results->rect = WebKit::WebRect(0, 0, size.width(), size.height()); | 621 results->rect = WebKit::WebRect(0, 0, size.width(), size.height()); |
| 617 results->availableRect = results->rect; | 622 results->availableRect = results->rect; |
| 618 // TODO(derat): Don't hardcode this? | 623 // TODO(derat): Don't hardcode this? |
| 619 results->depth = 24; | 624 results->depth = 24; |
| 620 results->depthPerComponent = 8; | 625 results->depthPerComponent = 8; |
| 621 } | 626 } |
| OLD | NEW |