OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/dragged_tab_controller.h" | 5 #include "chrome/browser/ui/views/tabs/dragged_tab_controller.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/i18n/rtl.h" | 11 #include "base/i18n/rtl.h" |
12 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 12 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
13 #include "chrome/browser/tabs/tab_strip_model.h" | 13 #include "chrome/browser/tabs/tab_strip_model.h" |
| 14 #include "chrome/browser/ui/app_modal_dialogs/message_box_handler.h" |
14 #include "chrome/browser/ui/browser_window.h" | 15 #include "chrome/browser/ui/browser_window.h" |
15 #include "chrome/browser/ui/views/frame/browser_view.h" | 16 #include "chrome/browser/ui/views/frame/browser_view.h" |
16 #include "chrome/browser/ui/views/tabs/base_tab.h" | 17 #include "chrome/browser/ui/views/tabs/base_tab.h" |
17 #include "chrome/browser/ui/views/tabs/base_tab_strip.h" | 18 #include "chrome/browser/ui/views/tabs/base_tab_strip.h" |
18 #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h" | 19 #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h" |
19 #include "chrome/browser/ui/views/tabs/dragged_tab_view.h" | 20 #include "chrome/browser/ui/views/tabs/dragged_tab_view.h" |
20 #include "chrome/browser/ui/views/tabs/native_view_photobooth.h" | 21 #include "chrome/browser/ui/views/tabs/native_view_photobooth.h" |
21 #include "chrome/browser/ui/views/tabs/side_tab.h" | 22 #include "chrome/browser/ui/views/tabs/side_tab.h" |
22 #include "chrome/browser/ui/views/tabs/side_tab_strip.h" | 23 #include "chrome/browser/ui/views/tabs/side_tab_strip.h" |
23 #include "chrome/browser/ui/views/tabs/tab.h" | 24 #include "chrome/browser/ui/views/tabs/tab.h" |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 // Ignored. | 482 // Ignored. |
482 } | 483 } |
483 | 484 |
484 bool DraggedTabController::ShouldSuppressDialogs() { | 485 bool DraggedTabController::ShouldSuppressDialogs() { |
485 // When a dialog is about to be shown we revert the drag. Otherwise a modal | 486 // When a dialog is about to be shown we revert the drag. Otherwise a modal |
486 // dialog might appear and attempt to parent itself to a hidden tabcontents. | 487 // dialog might appear and attempt to parent itself to a hidden tabcontents. |
487 EndDragImpl(CANCELED); | 488 EndDragImpl(CANCELED); |
488 return false; | 489 return false; |
489 } | 490 } |
490 | 491 |
| 492 content::JavaScriptDialogCreator* |
| 493 DraggedTabController::GetJavaScriptDialogCreator() { |
| 494 return GetJavaScriptDialogCreatorInstance(); |
| 495 } |
| 496 |
491 /////////////////////////////////////////////////////////////////////////////// | 497 /////////////////////////////////////////////////////////////////////////////// |
492 // DraggedTabController, NotificationObserver implementation: | 498 // DraggedTabController, NotificationObserver implementation: |
493 | 499 |
494 void DraggedTabController::Observe(NotificationType type, | 500 void DraggedTabController::Observe(NotificationType type, |
495 const NotificationSource& source, | 501 const NotificationSource& source, |
496 const NotificationDetails& details) { | 502 const NotificationDetails& details) { |
497 DCHECK_EQ(type.value, NotificationType::TAB_CONTENTS_DESTROYED); | 503 DCHECK_EQ(type.value, NotificationType::TAB_CONTENTS_DESTROYED); |
498 TabContents* destroyed_contents = Source<TabContents>(source).ptr(); | 504 TabContents* destroyed_contents = Source<TabContents>(source).ptr(); |
499 for (size_t i = 0; i < drag_data_.size(); ++i) { | 505 for (size_t i = 0; i < drag_data_.size(); ++i) { |
500 if (drag_data_[i].contents->tab_contents() == destroyed_contents) { | 506 if (drag_data_[i].contents->tab_contents() == destroyed_contents) { |
(...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1435 | 1441 |
1436 bool DraggedTabController::AreTabsConsecutive() { | 1442 bool DraggedTabController::AreTabsConsecutive() { |
1437 for (size_t i = 1; i < drag_data_.size(); ++i) { | 1443 for (size_t i = 1; i < drag_data_.size(); ++i) { |
1438 if (drag_data_[i - 1].source_model_index + 1 != | 1444 if (drag_data_[i - 1].source_model_index + 1 != |
1439 drag_data_[i].source_model_index) { | 1445 drag_data_[i].source_model_index) { |
1440 return false; | 1446 return false; |
1441 } | 1447 } |
1442 } | 1448 } |
1443 return true; | 1449 return true; |
1444 } | 1450 } |
OLD | NEW |