| 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/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 16 matching lines...) Expand all Loading... |
| 27 #include "content/public/common/content_switches.h" | 27 #include "content/public/common/content_switches.h" |
| 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli
ne.h" | 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli
ne.h" |
| 29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
| 30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" | 30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" |
| 31 #include "ui/aura/client/aura_constants.h" | 31 #include "ui/aura/client/aura_constants.h" |
| 32 #include "ui/aura/client/cursor_client.h" | 32 #include "ui/aura/client/cursor_client.h" |
| 33 #include "ui/aura/client/screen_position_client.h" | 33 #include "ui/aura/client/screen_position_client.h" |
| 34 #include "ui/aura/client/stacking_client.h" | 34 #include "ui/aura/client/stacking_client.h" |
| 35 #include "ui/aura/client/tooltip_client.h" | 35 #include "ui/aura/client/tooltip_client.h" |
| 36 #include "ui/aura/client/window_types.h" | 36 #include "ui/aura/client/window_types.h" |
| 37 #include "ui/aura/display_manager.h" | |
| 38 #include "ui/aura/env.h" | 37 #include "ui/aura/env.h" |
| 39 #include "ui/aura/root_window.h" | 38 #include "ui/aura/root_window.h" |
| 40 #include "ui/aura/window.h" | 39 #include "ui/aura/window.h" |
| 41 #include "ui/aura/window_observer.h" | 40 #include "ui/aura/window_observer.h" |
| 42 #include "ui/aura/window_tracker.h" | 41 #include "ui/aura/window_tracker.h" |
| 43 #include "ui/base/clipboard/scoped_clipboard_writer.h" | 42 #include "ui/base/clipboard/scoped_clipboard_writer.h" |
| 44 #include "ui/base/events/event.h" | 43 #include "ui/base/events/event.h" |
| 45 #include "ui/base/gestures/gesture_recognizer.h" | 44 #include "ui/base/gestures/gesture_recognizer.h" |
| 46 #include "ui/base/hit_test.h" | 45 #include "ui/base/hit_test.h" |
| 47 #include "ui/base/ime/input_method.h" | 46 #include "ui/base/ime/input_method.h" |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 surface_route_id_(0), | 283 surface_route_id_(0), |
| 285 paint_canvas_(NULL), | 284 paint_canvas_(NULL), |
| 286 synthetic_move_sent_(false), | 285 synthetic_move_sent_(false), |
| 287 accelerated_compositing_state_changed_(false), | 286 accelerated_compositing_state_changed_(false), |
| 288 can_lock_compositor_(YES) { | 287 can_lock_compositor_(YES) { |
| 289 host_->SetView(this); | 288 host_->SetView(this); |
| 290 window_observer_.reset(new WindowObserver(this)); | 289 window_observer_.reset(new WindowObserver(this)); |
| 291 window_->AddObserver(window_observer_.get()); | 290 window_->AddObserver(window_observer_.get()); |
| 292 aura::client::SetTooltipText(window_, &tooltip_); | 291 aura::client::SetTooltipText(window_, &tooltip_); |
| 293 aura::client::SetActivationDelegate(window_, this); | 292 aura::client::SetActivationDelegate(window_, this); |
| 294 aura::DisplayManager* display_manager = | 293 gfx::Screen::GetScreenFor(window_)->AddObserver(this); |
| 295 aura::Env::GetInstance()->display_manager(); | |
| 296 // display_manager can be NULL in tests. | |
| 297 if (display_manager) | |
| 298 display_manager->AddObserver(this); | |
| 299 } | 294 } |
| 300 | 295 |
| 301 //////////////////////////////////////////////////////////////////////////////// | 296 //////////////////////////////////////////////////////////////////////////////// |
| 302 // RenderWidgetHostViewAura, RenderWidgetHostView implementation: | 297 // RenderWidgetHostViewAura, RenderWidgetHostView implementation: |
| 303 | 298 |
| 304 void RenderWidgetHostViewAura::InitAsChild( | 299 void RenderWidgetHostViewAura::InitAsChild( |
| 305 gfx::NativeView parent_view) { | 300 gfx::NativeView parent_view) { |
| 306 window_->Init(ui::LAYER_TEXTURED); | 301 window_->Init(ui::LAYER_TEXTURED); |
| 307 window_->SetName("RenderWidgetHostViewAura"); | 302 window_->SetName("RenderWidgetHostViewAura"); |
| 308 } | 303 } |
| (...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1295 } | 1290 } |
| 1296 | 1291 |
| 1297 void RenderWidgetHostViewAura::ExtendSelectionAndDelete( | 1292 void RenderWidgetHostViewAura::ExtendSelectionAndDelete( |
| 1298 size_t before, size_t after) { | 1293 size_t before, size_t after) { |
| 1299 // TODO(horo): implement this method if it is required. | 1294 // TODO(horo): implement this method if it is required. |
| 1300 // http://crbug.com/149155 | 1295 // http://crbug.com/149155 |
| 1301 NOTIMPLEMENTED(); | 1296 NOTIMPLEMENTED(); |
| 1302 } | 1297 } |
| 1303 | 1298 |
| 1304 //////////////////////////////////////////////////////////////////////////////// | 1299 //////////////////////////////////////////////////////////////////////////////// |
| 1305 // RenderWidgetHostViewAura, aura::DisplayObserver implementation: | 1300 // RenderWidgetHostViewAura, gfx::DisplayObserver implementation: |
| 1306 | 1301 |
| 1307 void RenderWidgetHostViewAura::OnDisplayBoundsChanged( | 1302 void RenderWidgetHostViewAura::OnDisplayBoundsChanged( |
| 1308 const gfx::Display& display) { | 1303 const gfx::Display& display) { |
| 1309 gfx::Screen* screen = gfx::Screen::GetScreenFor(window_); | 1304 gfx::Screen* screen = gfx::Screen::GetScreenFor(window_); |
| 1310 if (display.id() == screen->GetDisplayNearestWindow(window_).id()) { | 1305 if (display.id() == screen->GetDisplayNearestWindow(window_).id()) { |
| 1311 UpdateScreenInfo(window_); | 1306 UpdateScreenInfo(window_); |
| 1312 } | 1307 } |
| 1313 } | 1308 } |
| 1314 | 1309 |
| 1315 void RenderWidgetHostViewAura::OnDisplayAdded( | 1310 void RenderWidgetHostViewAura::OnDisplayAdded( |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1775 factory->DestroySharedSurfaceHandle(shared_surface_handle_); | 1770 factory->DestroySharedSurfaceHandle(shared_surface_handle_); |
| 1776 factory->RemoveObserver(this); | 1771 factory->RemoveObserver(this); |
| 1777 } | 1772 } |
| 1778 window_->RemoveObserver(window_observer_.get()); | 1773 window_->RemoveObserver(window_observer_.get()); |
| 1779 UnlockMouse(); | 1774 UnlockMouse(); |
| 1780 if (popup_type_ != WebKit::WebPopupTypeNone) { | 1775 if (popup_type_ != WebKit::WebPopupTypeNone) { |
| 1781 DCHECK(popup_parent_host_view_); | 1776 DCHECK(popup_parent_host_view_); |
| 1782 popup_parent_host_view_->popup_child_host_view_ = NULL; | 1777 popup_parent_host_view_->popup_child_host_view_ = NULL; |
| 1783 } | 1778 } |
| 1784 aura::client::SetTooltipText(window_, NULL); | 1779 aura::client::SetTooltipText(window_, NULL); |
| 1785 aura::DisplayManager* display_manager = | 1780 gfx::Screen::GetScreenFor(window_)->RemoveObserver(this); |
| 1786 aura::Env::GetInstance()->display_manager(); | |
| 1787 // display_manager can be NULL in tests. | |
| 1788 if (display_manager) | |
| 1789 display_manager->RemoveObserver(this); | |
| 1790 | 1781 |
| 1791 // This call is usually no-op since |this| object is already removed from the | 1782 // This call is usually no-op since |this| object is already removed from the |
| 1792 // Aura root window and we don't have a way to get an input method object | 1783 // Aura root window and we don't have a way to get an input method object |
| 1793 // associated with the window, but just in case. | 1784 // associated with the window, but just in case. |
| 1794 DetachFromInputMethod(); | 1785 DetachFromInputMethod(); |
| 1795 } | 1786 } |
| 1796 | 1787 |
| 1797 void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() { | 1788 void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() { |
| 1798 const gfx::Point screen_point = | 1789 const gfx::Point screen_point = |
| 1799 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(); | 1790 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(); |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1960 RenderWidgetHost* widget) { | 1951 RenderWidgetHost* widget) { |
| 1961 return new RenderWidgetHostViewAura(widget); | 1952 return new RenderWidgetHostViewAura(widget); |
| 1962 } | 1953 } |
| 1963 | 1954 |
| 1964 // static | 1955 // static |
| 1965 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 1956 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
| 1966 GetScreenInfoForWindow(results, NULL); | 1957 GetScreenInfoForWindow(results, NULL); |
| 1967 } | 1958 } |
| 1968 | 1959 |
| 1969 } // namespace content | 1960 } // namespace content |
| OLD | NEW |