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 // TODO(beng): USE_ASH | 7 // TODO(beng): USE_ASH |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/wm/visibility_controller.h" | 9 #include "ash/wm/visibility_controller.h" |
10 #include "base/event_types.h" | 10 #include "base/event_types.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 } | 51 } |
52 virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE { | 52 virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE { |
53 ui::EventType type = ui::EventTypeFromNative(event); | 53 ui::EventType type = ui::EventTypeFromNative(event); |
54 RenderViewHost* rvh = NULL; | 54 RenderViewHost* rvh = NULL; |
55 switch (type) { | 55 switch (type) { |
56 case ui::ET_MOUSE_DRAGGED: | 56 case ui::ET_MOUSE_DRAGGED: |
57 rvh = view_->GetWebContents()->GetRenderViewHost(); | 57 rvh = view_->GetWebContents()->GetRenderViewHost(); |
58 if (rvh) { | 58 if (rvh) { |
59 gfx::Point screen_loc = ui::EventLocationFromNative(event); | 59 gfx::Point screen_loc = ui::EventLocationFromNative(event); |
60 gfx::Point client_loc = screen_loc; | 60 gfx::Point client_loc = screen_loc; |
61 aura::Window* window = rvh->view()->GetNativeView(); | 61 aura::Window* window = rvh->GetView()->GetNativeView(); |
62 aura::Window::ConvertPointToWindow(ash::Shell::GetRootWindow(), | 62 aura::Window::ConvertPointToWindow(ash::Shell::GetRootWindow(), |
63 window, &client_loc); | 63 window, &client_loc); |
64 rvh->DragSourceMovedTo(client_loc.x(), client_loc.y(), | 64 rvh->DragSourceMovedTo(client_loc.x(), client_loc.y(), |
65 screen_loc.x(), screen_loc.y()); | 65 screen_loc.x(), screen_loc.y()); |
66 } | 66 } |
67 break; | 67 break; |
68 default: | 68 default: |
69 break; | 69 break; |
70 } | 70 } |
71 } | 71 } |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 } | 312 } |
313 | 313 |
314 //////////////////////////////////////////////////////////////////////////////// | 314 //////////////////////////////////////////////////////////////////////////////// |
315 // NativeTabContentsViewAura, private: | 315 // NativeTabContentsViewAura, private: |
316 | 316 |
317 void NativeTabContentsViewAura::EndDrag(WebKit::WebDragOperationsMask ops) { | 317 void NativeTabContentsViewAura::EndDrag(WebKit::WebDragOperationsMask ops) { |
318 gfx::Point screen_loc = | 318 gfx::Point screen_loc = |
319 ash::Shell::GetRootWindow()->last_mouse_location(); | 319 ash::Shell::GetRootWindow()->last_mouse_location(); |
320 gfx::Point client_loc = screen_loc; | 320 gfx::Point client_loc = screen_loc; |
321 RenderViewHost* rvh = GetWebContents()->GetRenderViewHost(); | 321 RenderViewHost* rvh = GetWebContents()->GetRenderViewHost(); |
322 aura::Window* window = rvh->view()->GetNativeView(); | 322 aura::Window* window = rvh->GetView()->GetNativeView(); |
323 aura::Window::ConvertPointToWindow(ash::Shell::GetRootWindow(), | 323 aura::Window::ConvertPointToWindow(ash::Shell::GetRootWindow(), |
324 window, &client_loc); | 324 window, &client_loc); |
325 rvh->DragSourceEndedAt(client_loc.x(), client_loc.y(), screen_loc.x(), | 325 rvh->DragSourceEndedAt(client_loc.x(), client_loc.y(), screen_loc.x(), |
326 screen_loc.y(), ops); | 326 screen_loc.y(), ops); |
327 } | 327 } |
328 | 328 |
329 //////////////////////////////////////////////////////////////////////////////// | 329 //////////////////////////////////////////////////////////////////////////////// |
330 // NativeTabContentsView, public: | 330 // NativeTabContentsView, public: |
331 | 331 |
332 // static | 332 // static |
333 NativeTabContentsView* NativeTabContentsView::CreateNativeTabContentsView( | 333 NativeTabContentsView* NativeTabContentsView::CreateNativeTabContentsView( |
334 internal::NativeTabContentsViewDelegate* delegate) { | 334 internal::NativeTabContentsViewDelegate* delegate) { |
335 return new NativeTabContentsViewAura(delegate); | 335 return new NativeTabContentsViewAura(delegate); |
336 } | 336 } |
OLD | NEW |