| 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 999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1308 } | 1303 } |
| 1309 | 1304 |
| 1310 void RenderWidgetHostViewAura::ExtendSelectionAndDelete( | 1305 void RenderWidgetHostViewAura::ExtendSelectionAndDelete( |
| 1311 size_t before, size_t after) { | 1306 size_t before, size_t after) { |
| 1312 // TODO(horo): implement this method if it is required. | 1307 // TODO(horo): implement this method if it is required. |
| 1313 // http://crbug.com/149155 | 1308 // http://crbug.com/149155 |
| 1314 NOTIMPLEMENTED(); | 1309 NOTIMPLEMENTED(); |
| 1315 } | 1310 } |
| 1316 | 1311 |
| 1317 //////////////////////////////////////////////////////////////////////////////// | 1312 //////////////////////////////////////////////////////////////////////////////// |
| 1318 // RenderWidgetHostViewAura, aura::DisplayObserver implementation: | 1313 // RenderWidgetHostViewAura, gfx::DisplayObserver implementation: |
| 1319 | 1314 |
| 1320 void RenderWidgetHostViewAura::OnDisplayBoundsChanged( | 1315 void RenderWidgetHostViewAura::OnDisplayBoundsChanged( |
| 1321 const gfx::Display& display) { | 1316 const gfx::Display& display) { |
| 1322 gfx::Screen* screen = gfx::Screen::GetScreenFor(window_); | 1317 gfx::Screen* screen = gfx::Screen::GetScreenFor(window_); |
| 1323 if (display.id() == screen->GetDisplayNearestWindow(window_).id()) { | 1318 if (display.id() == screen->GetDisplayNearestWindow(window_).id()) { |
| 1324 UpdateScreenInfo(window_); | 1319 UpdateScreenInfo(window_); |
| 1325 } | 1320 } |
| 1326 } | 1321 } |
| 1327 | 1322 |
| 1328 void RenderWidgetHostViewAura::OnDisplayAdded( | 1323 void RenderWidgetHostViewAura::OnDisplayAdded( |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1794 DCHECK(popup_parent_host_view_->popup_child_host_view_ == NULL || | 1789 DCHECK(popup_parent_host_view_->popup_child_host_view_ == NULL || |
| 1795 popup_parent_host_view_->popup_child_host_view_ == this); | 1790 popup_parent_host_view_->popup_child_host_view_ == this); |
| 1796 popup_parent_host_view_->popup_child_host_view_ = NULL; | 1791 popup_parent_host_view_->popup_child_host_view_ = NULL; |
| 1797 } | 1792 } |
| 1798 if (popup_child_host_view_) { | 1793 if (popup_child_host_view_) { |
| 1799 DCHECK(popup_child_host_view_->popup_parent_host_view_ == NULL || | 1794 DCHECK(popup_child_host_view_->popup_parent_host_view_ == NULL || |
| 1800 popup_child_host_view_->popup_parent_host_view_ == this); | 1795 popup_child_host_view_->popup_parent_host_view_ == this); |
| 1801 popup_child_host_view_->popup_parent_host_view_ = NULL; | 1796 popup_child_host_view_->popup_parent_host_view_ = NULL; |
| 1802 } | 1797 } |
| 1803 aura::client::SetTooltipText(window_, NULL); | 1798 aura::client::SetTooltipText(window_, NULL); |
| 1804 aura::DisplayManager* display_manager = | 1799 gfx::Screen::GetScreenFor(window_)->RemoveObserver(this); |
| 1805 aura::Env::GetInstance()->display_manager(); | |
| 1806 // display_manager can be NULL in tests. | |
| 1807 if (display_manager) | |
| 1808 display_manager->RemoveObserver(this); | |
| 1809 | 1800 |
| 1810 // This call is usually no-op since |this| object is already removed from the | 1801 // This call is usually no-op since |this| object is already removed from the |
| 1811 // Aura root window and we don't have a way to get an input method object | 1802 // Aura root window and we don't have a way to get an input method object |
| 1812 // associated with the window, but just in case. | 1803 // associated with the window, but just in case. |
| 1813 DetachFromInputMethod(); | 1804 DetachFromInputMethod(); |
| 1814 } | 1805 } |
| 1815 | 1806 |
| 1816 void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() { | 1807 void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() { |
| 1817 const gfx::Point screen_point = | 1808 const gfx::Point screen_point = |
| 1818 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(); | 1809 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(); |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1979 RenderWidgetHost* widget) { | 1970 RenderWidgetHost* widget) { |
| 1980 return new RenderWidgetHostViewAura(widget); | 1971 return new RenderWidgetHostViewAura(widget); |
| 1981 } | 1972 } |
| 1982 | 1973 |
| 1983 // static | 1974 // static |
| 1984 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 1975 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
| 1985 GetScreenInfoForWindow(results, NULL); | 1976 GetScreenInfoForWindow(results, NULL); |
| 1986 } | 1977 } |
| 1987 | 1978 |
| 1988 } // namespace content | 1979 } // namespace content |
| OLD | NEW |