| 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 "chrome/browser/ui/views/tab_contents/native_tab_contents_view_aura.h" | 5 #include "chrome/browser/ui/views/tab_contents/native_tab_contents_view_aura.h" |
| 6 | 6 |
| 7 #include "base/event_types.h" | 7 #include "base/event_types.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "chrome/browser/ui/views/tab_contents/native_tab_contents_view_delegate
.h" | 9 #include "chrome/browser/ui/views/tab_contents/native_tab_contents_view_delegate
.h" |
| 10 #include "content/browser/renderer_host/render_view_host.h" | 10 #include "content/browser/renderer_host/render_view_host.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 } | 53 } |
| 54 virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE { | 54 virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE { |
| 55 ui::EventType type = ui::EventTypeFromNative(event); | 55 ui::EventType type = ui::EventTypeFromNative(event); |
| 56 RenderViewHost* rvh = NULL; | 56 RenderViewHost* rvh = NULL; |
| 57 switch (type) { | 57 switch (type) { |
| 58 case ui::ET_MOUSE_DRAGGED: | 58 case ui::ET_MOUSE_DRAGGED: |
| 59 rvh = view_->GetWebContents()->GetRenderViewHost(); | 59 rvh = view_->GetWebContents()->GetRenderViewHost(); |
| 60 if (rvh) { | 60 if (rvh) { |
| 61 gfx::Point screen_loc = ui::EventLocationFromNative(event); | 61 gfx::Point screen_loc = ui::EventLocationFromNative(event); |
| 62 gfx::Point client_loc = screen_loc; | 62 gfx::Point client_loc = screen_loc; |
| 63 aura::Window* window = rvh->view()->GetNativeView(); | 63 aura::Window* window = rvh->GetView()->GetNativeView(); |
| 64 aura::Window::ConvertPointToWindow(window->GetRootWindow(), | 64 aura::Window::ConvertPointToWindow(window->GetRootWindow(), |
| 65 window, &client_loc); | 65 window, &client_loc); |
| 66 rvh->DragSourceMovedTo(client_loc.x(), client_loc.y(), | 66 rvh->DragSourceMovedTo(client_loc.x(), client_loc.y(), |
| 67 screen_loc.x(), screen_loc.y()); | 67 screen_loc.x(), screen_loc.y()); |
| 68 } | 68 } |
| 69 break; | 69 break; |
| 70 default: | 70 default: |
| 71 break; | 71 break; |
| 72 } | 72 } |
| 73 } | 73 } |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 } | 322 } |
| 323 | 323 |
| 324 //////////////////////////////////////////////////////////////////////////////// | 324 //////////////////////////////////////////////////////////////////////////////// |
| 325 // NativeTabContentsViewAura, private: | 325 // NativeTabContentsViewAura, private: |
| 326 | 326 |
| 327 void NativeTabContentsViewAura::EndDrag(WebKit::WebDragOperationsMask ops) { | 327 void NativeTabContentsViewAura::EndDrag(WebKit::WebDragOperationsMask ops) { |
| 328 aura::RootWindow* root_window = GetNativeView()->GetRootWindow(); | 328 aura::RootWindow* root_window = GetNativeView()->GetRootWindow(); |
| 329 gfx::Point screen_loc = root_window->last_mouse_location(); | 329 gfx::Point screen_loc = root_window->last_mouse_location(); |
| 330 gfx::Point client_loc = screen_loc; | 330 gfx::Point client_loc = screen_loc; |
| 331 RenderViewHost* rvh = GetWebContents()->GetRenderViewHost(); | 331 RenderViewHost* rvh = GetWebContents()->GetRenderViewHost(); |
| 332 aura::Window* window = rvh->view()->GetNativeView(); | 332 aura::Window* window = rvh->GetView()->GetNativeView(); |
| 333 aura::Window::ConvertPointToWindow(root_window, window, &client_loc); | 333 aura::Window::ConvertPointToWindow(root_window, window, &client_loc); |
| 334 rvh->DragSourceEndedAt(client_loc.x(), client_loc.y(), screen_loc.x(), | 334 rvh->DragSourceEndedAt(client_loc.x(), client_loc.y(), screen_loc.x(), |
| 335 screen_loc.y(), ops); | 335 screen_loc.y(), ops); |
| 336 } | 336 } |
| 337 | 337 |
| 338 //////////////////////////////////////////////////////////////////////////////// | 338 //////////////////////////////////////////////////////////////////////////////// |
| 339 // NativeTabContentsView, public: | 339 // NativeTabContentsView, public: |
| 340 | 340 |
| 341 // static | 341 // static |
| 342 NativeTabContentsView* NativeTabContentsView::CreateNativeTabContentsView( | 342 NativeTabContentsView* NativeTabContentsView::CreateNativeTabContentsView( |
| 343 internal::NativeTabContentsViewDelegate* delegate) { | 343 internal::NativeTabContentsViewDelegate* delegate) { |
| 344 return new NativeTabContentsViewAura(delegate); | 344 return new NativeTabContentsViewAura(delegate); |
| 345 } | 345 } |
| OLD | NEW |