Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(399)

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 11829040: Fix the content_browsertests everywhere maybe. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: And fix the final ExtensionApiTest.AlertBasic case. Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 window_->SetBounds(rect); 459 window_->SetBounds(rect);
460 host_->WasResized(); 460 host_->WasResized();
461 } 461 }
462 462
463 gfx::NativeView RenderWidgetHostViewAura::GetNativeView() const { 463 gfx::NativeView RenderWidgetHostViewAura::GetNativeView() const {
464 return window_; 464 return window_;
465 } 465 }
466 466
467 gfx::NativeViewId RenderWidgetHostViewAura::GetNativeViewId() const { 467 gfx::NativeViewId RenderWidgetHostViewAura::GetNativeViewId() const {
468 #if defined(OS_WIN) 468 #if defined(OS_WIN)
469 HWND window = window_->GetRootWindow()->GetAcceleratedWidget(); 469 aura::RootWindow* root_window = window_->GetRootWindow();
Elliot Glaysher 2013/01/18 20:31:38 If you search through this file, you'll see that h
470 return reinterpret_cast<gfx::NativeViewId>(window); 470 if (root_window) {
471 #else 471 HWND window = root_window->GetAcceleratedWidget();
472 return reinterpret_cast<gfx::NativeViewId>(window);
473 }
474 #endif
472 return static_cast<gfx::NativeViewId>(NULL); 475 return static_cast<gfx::NativeViewId>(NULL);
473 #endif
474 } 476 }
475 477
476 gfx::NativeViewAccessible RenderWidgetHostViewAura::GetNativeViewAccessible() { 478 gfx::NativeViewAccessible RenderWidgetHostViewAura::GetNativeViewAccessible() {
477 NOTIMPLEMENTED(); 479 NOTIMPLEMENTED();
478 return static_cast<gfx::NativeViewAccessible>(NULL); 480 return static_cast<gfx::NativeViewAccessible>(NULL);
479 } 481 }
480 482
481 void RenderWidgetHostViewAura::MovePluginWindows( 483 void RenderWidgetHostViewAura::MovePluginWindows(
482 const gfx::Vector2d& scroll_offset, 484 const gfx::Vector2d& scroll_offset,
483 const std::vector<webkit::npapi::WebPluginGeometry>& plugin_window_moves) { 485 const std::vector<webkit::npapi::WebPluginGeometry>& plugin_window_moves) {
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 gfx::Rect clip_rect; 616 gfx::Rect clip_rect;
615 if (paint_canvas_) { 617 if (paint_canvas_) {
616 SkRect sk_clip_rect; 618 SkRect sk_clip_rect;
617 if (paint_canvas_->sk_canvas()->getClipBounds(&sk_clip_rect)) 619 if (paint_canvas_->sk_canvas()->getClipBounds(&sk_clip_rect))
618 clip_rect = gfx::ToEnclosingRect(gfx::SkRectToRectF(sk_clip_rect)); 620 clip_rect = gfx::ToEnclosingRect(gfx::SkRectToRectF(sk_clip_rect));
619 } 621 }
620 622
621 if (!scroll_rect.IsEmpty()) 623 if (!scroll_rect.IsEmpty())
622 SchedulePaintIfNotInClip(scroll_rect, clip_rect); 624 SchedulePaintIfNotInClip(scroll_rect, clip_rect);
623 625
626 #if defined(OS_WIN)
627 aura::RootWindow* root_window = window_->GetRootWindow();
628 #endif
624 for (size_t i = 0; i < copy_rects.size(); ++i) { 629 for (size_t i = 0; i < copy_rects.size(); ++i) {
625 gfx::Rect rect = gfx::SubtractRects(copy_rects[i], scroll_rect); 630 gfx::Rect rect = gfx::SubtractRects(copy_rects[i], scroll_rect);
626 if (rect.IsEmpty()) 631 if (rect.IsEmpty())
627 continue; 632 continue;
628 633
629 SchedulePaintIfNotInClip(rect, clip_rect); 634 SchedulePaintIfNotInClip(rect, clip_rect);
630 635
631 #if defined(OS_WIN) 636 #if defined(OS_WIN)
632 // Send the invalid rect in screen coordinates. 637 if (root_window) {
633 gfx::Rect screen_rect = GetViewBounds(); 638 // Send the invalid rect in screen coordinates.
634 gfx::Rect invalid_screen_rect(rect); 639 gfx::Rect screen_rect = GetViewBounds();
635 invalid_screen_rect.Offset(screen_rect.x(), screen_rect.y()); 640 gfx::Rect invalid_screen_rect(rect);
636 HWND hwnd = window_->GetRootWindow()->GetAcceleratedWidget(); 641 invalid_screen_rect.Offset(screen_rect.x(), screen_rect.y());
637 PaintPluginWindowsHelper(hwnd, invalid_screen_rect); 642 HWND hwnd = root_window->GetAcceleratedWidget();
643 PaintPluginWindowsHelper(hwnd, invalid_screen_rect);
644 }
638 #endif // defined(OS_WIN) 645 #endif // defined(OS_WIN)
639 } 646 }
640 } 647 }
641 648
642 void RenderWidgetHostViewAura::RenderViewGone(base::TerminationStatus status, 649 void RenderWidgetHostViewAura::RenderViewGone(base::TerminationStatus status,
643 int error_code) { 650 int error_code) {
644 UpdateCursorIfOverSelf(); 651 UpdateCursorIfOverSelf();
645 Destroy(); 652 Destroy();
646 } 653 }
647 654
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 --render_widget_host_view->pending_thumbnail_tasks_; 1013 --render_widget_host_view->pending_thumbnail_tasks_;
1007 } 1014 }
1008 1015
1009 void RenderWidgetHostViewAura::SetBackground(const SkBitmap& background) { 1016 void RenderWidgetHostViewAura::SetBackground(const SkBitmap& background) {
1010 RenderWidgetHostViewBase::SetBackground(background); 1017 RenderWidgetHostViewBase::SetBackground(background);
1011 host_->SetBackground(background); 1018 host_->SetBackground(background);
1012 window_->layer()->SetFillsBoundsOpaquely(background.isOpaque()); 1019 window_->layer()->SetFillsBoundsOpaquely(background.isOpaque());
1013 } 1020 }
1014 1021
1015 void RenderWidgetHostViewAura::GetScreenInfo(WebScreenInfo* results) { 1022 void RenderWidgetHostViewAura::GetScreenInfo(WebScreenInfo* results) {
1016 GetScreenInfoForWindow(results, window_); 1023 GetScreenInfoForWindow(results, window_->GetRootWindow() ? window_ : NULL);
1017 } 1024 }
1018 1025
1019 gfx::Rect RenderWidgetHostViewAura::GetBoundsInRootWindow() { 1026 gfx::Rect RenderWidgetHostViewAura::GetBoundsInRootWindow() {
1020 return window_->GetToplevelWindow()->GetBoundsInScreen(); 1027 return window_->GetToplevelWindow()->GetBoundsInScreen();
1021 } 1028 }
1022 1029
1023 void RenderWidgetHostViewAura::ProcessAckedTouchEvent( 1030 void RenderWidgetHostViewAura::ProcessAckedTouchEvent(
1024 const WebKit::WebTouchEvent& touch_event, InputEventAckState ack_result) { 1031 const WebKit::WebTouchEvent& touch_event, InputEventAckState ack_result) {
1025 ScopedVector<ui::TouchEvent> events; 1032 ScopedVector<ui::TouchEvent> events;
1026 if (!MakeUITouchEventsFromWebTouchEvents(touch_event, &events)) 1033 if (!MakeUITouchEventsFromWebTouchEvents(touch_event, &events))
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 1176
1170 bool RenderWidgetHostViewAura::CanComposeInline() const { 1177 bool RenderWidgetHostViewAura::CanComposeInline() const {
1171 return can_compose_inline_; 1178 return can_compose_inline_;
1172 } 1179 }
1173 1180
1174 gfx::Rect RenderWidgetHostViewAura::ConvertRectToScreen(const gfx::Rect& rect) { 1181 gfx::Rect RenderWidgetHostViewAura::ConvertRectToScreen(const gfx::Rect& rect) {
1175 gfx::Point origin = rect.origin(); 1182 gfx::Point origin = rect.origin();
1176 gfx::Point end = gfx::Point(rect.right(), rect.bottom()); 1183 gfx::Point end = gfx::Point(rect.right(), rect.bottom());
1177 1184
1178 aura::RootWindow* root_window = window_->GetRootWindow(); 1185 aura::RootWindow* root_window = window_->GetRootWindow();
1179 aura::client::ScreenPositionClient* screen_position_client = 1186 if (root_window) {
1180 aura::client::GetScreenPositionClient(root_window); 1187 aura::client::ScreenPositionClient* screen_position_client =
1181 screen_position_client->ConvertPointToScreen(window_, &origin); 1188 aura::client::GetScreenPositionClient(root_window);
1182 screen_position_client->ConvertPointToScreen(window_, &end); 1189 screen_position_client->ConvertPointToScreen(window_, &origin);
1183 return gfx::Rect(origin.x(), 1190 screen_position_client->ConvertPointToScreen(window_, &end);
1184 origin.y(), 1191 return gfx::Rect(origin.x(),
1185 end.x() - origin.x(), 1192 origin.y(),
1186 end.y() - origin.y()); 1193 end.x() - origin.x(),
1194 end.y() - origin.y());
1195 }
1196
1197 return rect;
1187 } 1198 }
1188 1199
1189 gfx::Rect RenderWidgetHostViewAura::GetCaretBounds() { 1200 gfx::Rect RenderWidgetHostViewAura::GetCaretBounds() {
1190 const gfx::Rect rect = 1201 const gfx::Rect rect =
1191 gfx::UnionRects(selection_start_rect_, selection_end_rect_); 1202 gfx::UnionRects(selection_start_rect_, selection_end_rect_);
1192 return ConvertRectToScreen(rect); 1203 return ConvertRectToScreen(rect);
1193 } 1204 }
1194 1205
1195 bool RenderWidgetHostViewAura::GetCompositionCharacterBounds(uint32 index, 1206 bool RenderWidgetHostViewAura::GetCompositionCharacterBounds(uint32 index,
1196 gfx::Rect* rect) { 1207 gfx::Rect* rect) {
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
1666 1677
1667 // If a gesture is not processed by the webpage, then WebKit processes it 1678 // If a gesture is not processed by the webpage, then WebKit processes it
1668 // (e.g. generates synthetic mouse events). 1679 // (e.g. generates synthetic mouse events).
1669 event->SetHandled(); 1680 event->SetHandled();
1670 } 1681 }
1671 1682
1672 //////////////////////////////////////////////////////////////////////////////// 1683 ////////////////////////////////////////////////////////////////////////////////
1673 // RenderWidgetHostViewAura, aura::client::ActivationDelegate implementation: 1684 // RenderWidgetHostViewAura, aura::client::ActivationDelegate implementation:
1674 1685
1675 bool RenderWidgetHostViewAura::ShouldActivate() const { 1686 bool RenderWidgetHostViewAura::ShouldActivate() const {
1676 const ui::Event* event = window_->GetRootWindow()->current_event(); 1687 aura::RootWindow* root_window = window_->GetRootWindow();
1688 if (!root_window)
1689 return true;
1690 const ui::Event* event = root_window->current_event();
1677 if (!event) 1691 if (!event)
1678 return true; 1692 return true;
1679 return is_fullscreen_; 1693 return is_fullscreen_;
1680 } 1694 }
1681 1695
1682 //////////////////////////////////////////////////////////////////////////////// 1696 ////////////////////////////////////////////////////////////////////////////////
1683 // RenderWidgetHostViewAura, 1697 // RenderWidgetHostViewAura,
1684 // aura::client::ActivationChangeObserver implementation: 1698 // aura::client::ActivationChangeObserver implementation:
1685 1699
1686 void RenderWidgetHostViewAura::OnWindowActivated(aura::Window* gained_active, 1700 void RenderWidgetHostViewAura::OnWindowActivated(aura::Window* gained_active,
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
1989 RenderWidgetHost* widget) { 2003 RenderWidgetHost* widget) {
1990 return new RenderWidgetHostViewAura(widget); 2004 return new RenderWidgetHostViewAura(widget);
1991 } 2005 }
1992 2006
1993 // static 2007 // static
1994 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { 2008 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) {
1995 GetScreenInfoForWindow(results, NULL); 2009 GetScreenInfoForWindow(results, NULL);
1996 } 2010 }
1997 2011
1998 } // namespace content 2012 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698