| 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/callback.h" | 10 #include "base/callback.h" |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 drag_data_[i].original_delegate->NavigationStateChanged(source, | 550 drag_data_[i].original_delegate->NavigationStateChanged(source, |
| 551 changed_flags); | 551 changed_flags); |
| 552 break; | 552 break; |
| 553 } | 553 } |
| 554 } | 554 } |
| 555 } | 555 } |
| 556 if (view_.get()) | 556 if (view_.get()) |
| 557 view_->Update(); | 557 view_->Update(); |
| 558 } | 558 } |
| 559 | 559 |
| 560 void TabDragController::AddNewContents(WebContents* source, | 560 bool TabDragController::AddNewContents(WebContents* source, |
| 561 WebContents* new_contents, | 561 WebContents* new_contents, |
| 562 WindowOpenDisposition disposition, | 562 WindowOpenDisposition disposition, |
| 563 const gfx::Rect& initial_pos, | 563 const gfx::Rect& initial_pos, |
| 564 bool user_gesture) { | 564 bool user_gesture) { |
| 565 DCHECK_NE(CURRENT_TAB, disposition); | 565 DCHECK_NE(CURRENT_TAB, disposition); |
| 566 | 566 |
| 567 // Theoretically could be called while dragging if the page tries to | 567 // Theoretically could be called while dragging if the page tries to |
| 568 // spawn a window. Route this message back to the browser in most cases. | 568 // spawn a window. Route this message back to the browser in most cases. |
| 569 if (source_tab_drag_data()->original_delegate) { | 569 if (source_tab_drag_data()->original_delegate) { |
| 570 source_tab_drag_data()->original_delegate->AddNewContents( | 570 return source_tab_drag_data()->original_delegate->AddNewContents( |
| 571 source, new_contents, disposition, initial_pos, user_gesture); | 571 source, new_contents, disposition, initial_pos, user_gesture); |
| 572 } | 572 } |
| 573 return true; |
| 573 } | 574 } |
| 574 | 575 |
| 575 void TabDragController::LoadingStateChanged(WebContents* source) { | 576 void TabDragController::LoadingStateChanged(WebContents* source) { |
| 576 // It would be nice to respond to this message by changing the | 577 // It would be nice to respond to this message by changing the |
| 577 // screen shot in the dragged tab. | 578 // screen shot in the dragged tab. |
| 578 if (view_.get()) | 579 if (view_.get()) |
| 579 view_->Update(); | 580 view_->Update(); |
| 580 } | 581 } |
| 581 | 582 |
| 582 bool TabDragController::ShouldSuppressDialogs() { | 583 bool TabDragController::ShouldSuppressDialogs() { |
| (...skipping 1398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1981 gfx::Point TabDragController::GetWindowOffset( | 1982 gfx::Point TabDragController::GetWindowOffset( |
| 1982 const gfx::Point& point_in_screen) { | 1983 const gfx::Point& point_in_screen) { |
| 1983 TabStrip* owning_tabstrip = (attached_tabstrip_ && detach_into_browser_) ? | 1984 TabStrip* owning_tabstrip = (attached_tabstrip_ && detach_into_browser_) ? |
| 1984 attached_tabstrip_ : source_tabstrip_; | 1985 attached_tabstrip_ : source_tabstrip_; |
| 1985 views::View* toplevel_view = owning_tabstrip->GetWidget()->GetContentsView(); | 1986 views::View* toplevel_view = owning_tabstrip->GetWidget()->GetContentsView(); |
| 1986 | 1987 |
| 1987 gfx::Point offset = point_in_screen; | 1988 gfx::Point offset = point_in_screen; |
| 1988 views::View::ConvertPointFromScreen(toplevel_view, &offset); | 1989 views::View::ConvertPointFromScreen(toplevel_view, &offset); |
| 1989 return offset; | 1990 return offset; |
| 1990 } | 1991 } |
| OLD | NEW |