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/tabs/tab_drag_controller.h" | 5 #include "chrome/browser/ui/views/tabs/tab_drag_controller.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "chrome/browser/ui/views/tabs/tab.h" | 25 #include "chrome/browser/ui/views/tabs/tab.h" |
26 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 26 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
27 #include "chrome/common/chrome_notification_types.h" | 27 #include "chrome/common/chrome_notification_types.h" |
28 #include "chrome/common/chrome_switches.h" | 28 #include "chrome/common/chrome_switches.h" |
29 #include "content/public/browser/notification_details.h" | 29 #include "content/public/browser/notification_details.h" |
30 #include "content/public/browser/notification_service.h" | 30 #include "content/public/browser/notification_service.h" |
31 #include "content/public/browser/notification_source.h" | 31 #include "content/public/browser/notification_source.h" |
32 #include "content/public/browser/notification_types.h" | 32 #include "content/public/browser/notification_types.h" |
33 #include "content/public/browser/user_metrics.h" | 33 #include "content/public/browser/user_metrics.h" |
34 #include "content/public/browser/web_contents.h" | 34 #include "content/public/browser/web_contents.h" |
| 35 #include "content/public/browser/web_contents_view.h" |
35 #include "grit/theme_resources.h" | 36 #include "grit/theme_resources.h" |
36 #include "ui/base/animation/animation.h" | 37 #include "ui/base/animation/animation.h" |
37 #include "ui/base/animation/animation_delegate.h" | 38 #include "ui/base/animation/animation_delegate.h" |
38 #include "ui/base/animation/slide_animation.h" | 39 #include "ui/base/animation/slide_animation.h" |
39 #include "ui/base/events/event_constants.h" | 40 #include "ui/base/events/event_constants.h" |
40 #include "ui/base/events/event_utils.h" | 41 #include "ui/base/events/event_utils.h" |
41 #include "ui/base/resource/resource_bundle.h" | 42 #include "ui/base/resource/resource_bundle.h" |
42 #include "ui/gfx/canvas.h" | 43 #include "ui/gfx/canvas.h" |
43 #include "ui/gfx/image/image_skia.h" | 44 #include "ui/gfx/image/image_skia.h" |
44 #include "ui/gfx/screen.h" | 45 #include "ui/gfx/screen.h" |
(...skipping 1797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1842 | 1843 |
1843 void TabDragController::CreateDraggedView( | 1844 void TabDragController::CreateDraggedView( |
1844 const std::vector<TabRendererData>& data, | 1845 const std::vector<TabRendererData>& data, |
1845 const std::vector<gfx::Rect>& renderer_bounds) { | 1846 const std::vector<gfx::Rect>& renderer_bounds) { |
1846 #if !defined(USE_AURA) | 1847 #if !defined(USE_AURA) |
1847 DCHECK(!view_.get()); | 1848 DCHECK(!view_.get()); |
1848 DCHECK_EQ(data.size(), drag_data_.size()); | 1849 DCHECK_EQ(data.size(), drag_data_.size()); |
1849 | 1850 |
1850 // Set up the photo booth to start capturing the contents of the dragged | 1851 // Set up the photo booth to start capturing the contents of the dragged |
1851 // WebContents. | 1852 // WebContents. |
1852 NativeViewPhotobooth* photobooth = | 1853 NativeViewPhotobooth* photobooth = NativeViewPhotobooth::Create( |
1853 NativeViewPhotobooth::Create(source_dragged_contents()->GetNativeView()); | 1854 source_dragged_contents()->GetView()->GetNativeView()); |
1854 | 1855 |
1855 gfx::Rect content_bounds; | 1856 gfx::Rect content_bounds; |
1856 source_dragged_contents()->GetContainerBounds(&content_bounds); | 1857 source_dragged_contents()->GetView()->GetContainerBounds(&content_bounds); |
1857 | 1858 |
1858 std::vector<views::View*> renderers; | 1859 std::vector<views::View*> renderers; |
1859 for (size_t i = 0; i < drag_data_.size(); ++i) { | 1860 for (size_t i = 0; i < drag_data_.size(); ++i) { |
1860 Tab* renderer = source_tabstrip_->CreateTabForDragging(); | 1861 Tab* renderer = source_tabstrip_->CreateTabForDragging(); |
1861 renderer->SetData(data[i]); | 1862 renderer->SetData(data[i]); |
1862 renderers.push_back(renderer); | 1863 renderers.push_back(renderer); |
1863 } | 1864 } |
1864 // DraggedTabView takes ownership of the renderers. | 1865 // DraggedTabView takes ownership of the renderers. |
1865 view_.reset(new DraggedTabView(renderers, renderer_bounds, mouse_offset_, | 1866 view_.reset(new DraggedTabView(renderers, renderer_bounds, mouse_offset_, |
1866 content_bounds.size(), photobooth)); | 1867 content_bounds.size(), photobooth)); |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2060 gfx::Vector2d TabDragController::GetWindowOffset( | 2061 gfx::Vector2d TabDragController::GetWindowOffset( |
2061 const gfx::Point& point_in_screen) { | 2062 const gfx::Point& point_in_screen) { |
2062 TabStrip* owning_tabstrip = (attached_tabstrip_ && detach_into_browser_) ? | 2063 TabStrip* owning_tabstrip = (attached_tabstrip_ && detach_into_browser_) ? |
2063 attached_tabstrip_ : source_tabstrip_; | 2064 attached_tabstrip_ : source_tabstrip_; |
2064 views::View* toplevel_view = owning_tabstrip->GetWidget()->GetContentsView(); | 2065 views::View* toplevel_view = owning_tabstrip->GetWidget()->GetContentsView(); |
2065 | 2066 |
2066 gfx::Point point = point_in_screen; | 2067 gfx::Point point = point_in_screen; |
2067 views::View::ConvertPointFromScreen(toplevel_view, &point); | 2068 views::View::ConvertPointFromScreen(toplevel_view, &point); |
2068 return point.OffsetFromOrigin(); | 2069 return point.OffsetFromOrigin(); |
2069 } | 2070 } |
OLD | NEW |