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" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/i18n/rtl.h" | 13 #include "base/i18n/rtl.h" |
14 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 14 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
15 #include "chrome/browser/ui/app_modal_dialogs/javascript_dialog_creator.h" | 15 #include "chrome/browser/ui/app_modal_dialogs/javascript_dialog_manager.h" |
16 #include "chrome/browser/ui/browser_window.h" | 16 #include "chrome/browser/ui/browser_window.h" |
17 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 17 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
18 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h" | 18 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h" |
19 #include "chrome/browser/ui/views/frame/browser_view.h" | 19 #include "chrome/browser/ui/views/frame/browser_view.h" |
20 #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h" | 20 #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h" |
21 #include "chrome/browser/ui/views/tabs/dragged_tab_view.h" | 21 #include "chrome/browser/ui/views/tabs/dragged_tab_view.h" |
22 #include "chrome/browser/ui/views/tabs/native_view_photobooth.h" | 22 #include "chrome/browser/ui/views/tabs/native_view_photobooth.h" |
23 #include "chrome/browser/ui/views/tabs/stacked_tab_strip_layout.h" | 23 #include "chrome/browser/ui/views/tabs/stacked_tab_strip_layout.h" |
24 #include "chrome/browser/ui/views/tabs/tab.h" | 24 #include "chrome/browser/ui/views/tabs/tab.h" |
25 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 25 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 view_->Update(); | 591 view_->Update(); |
592 } | 592 } |
593 | 593 |
594 bool TabDragController::ShouldSuppressDialogs() { | 594 bool TabDragController::ShouldSuppressDialogs() { |
595 // When a dialog is about to be shown we revert the drag. Otherwise a modal | 595 // When a dialog is about to be shown we revert the drag. Otherwise a modal |
596 // dialog might appear and attempt to parent itself to a hidden tabcontents. | 596 // dialog might appear and attempt to parent itself to a hidden tabcontents. |
597 EndDragImpl(CANCELED); | 597 EndDragImpl(CANCELED); |
598 return false; | 598 return false; |
599 } | 599 } |
600 | 600 |
601 content::JavaScriptDialogCreator* | 601 content::JavaScriptDialogManager* |
602 TabDragController::GetJavaScriptDialogCreator() { | 602 TabDragController::GetJavaScriptDialogManager() { |
603 return GetJavaScriptDialogCreatorInstance(); | 603 return GetJavaScriptDialogManagerInstance(); |
604 } | 604 } |
605 | 605 |
606 /////////////////////////////////////////////////////////////////////////////// | 606 /////////////////////////////////////////////////////////////////////////////// |
607 // TabDragController, content::NotificationObserver implementation: | 607 // TabDragController, content::NotificationObserver implementation: |
608 | 608 |
609 void TabDragController::Observe( | 609 void TabDragController::Observe( |
610 int type, | 610 int type, |
611 const content::NotificationSource& source, | 611 const content::NotificationSource& source, |
612 const content::NotificationDetails& details) { | 612 const content::NotificationDetails& details) { |
613 DCHECK_EQ(content::NOTIFICATION_WEB_CONTENTS_DESTROYED, type); | 613 DCHECK_EQ(content::NOTIFICATION_WEB_CONTENTS_DESTROYED, type); |
(...skipping 1427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2041 gfx::Vector2d TabDragController::GetWindowOffset( | 2041 gfx::Vector2d TabDragController::GetWindowOffset( |
2042 const gfx::Point& point_in_screen) { | 2042 const gfx::Point& point_in_screen) { |
2043 TabStrip* owning_tabstrip = (attached_tabstrip_ && detach_into_browser_) ? | 2043 TabStrip* owning_tabstrip = (attached_tabstrip_ && detach_into_browser_) ? |
2044 attached_tabstrip_ : source_tabstrip_; | 2044 attached_tabstrip_ : source_tabstrip_; |
2045 views::View* toplevel_view = owning_tabstrip->GetWidget()->GetContentsView(); | 2045 views::View* toplevel_view = owning_tabstrip->GetWidget()->GetContentsView(); |
2046 | 2046 |
2047 gfx::Point point = point_in_screen; | 2047 gfx::Point point = point_in_screen; |
2048 views::View::ConvertPointFromScreen(toplevel_view, &point); | 2048 views::View::ConvertPointFromScreen(toplevel_view, &point); |
2049 return point.OffsetFromOrigin(); | 2049 return point.OffsetFromOrigin(); |
2050 } | 2050 } |
OLD | NEW |