Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Side by Side Diff: chrome/browser/ui/views/tabs/default_tab_drag_controller.cc

Issue 8949061: Move a bunch of methods from TabContents into the WebContents interface. This change either moves... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/default_tab_drag_controller.h" 5 #include "chrome/browser/ui/views/tabs/default_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 823 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 selection_model_before_attach_.Copy(attached_tabstrip->GetSelectionModel()); 834 selection_model_before_attach_.Copy(attached_tabstrip->GetSelectionModel());
835 835
836 // Remove ourselves as the delegate now that the dragged TabContents is 836 // Remove ourselves as the delegate now that the dragged TabContents is
837 // being inserted back into a Browser. 837 // being inserted back into a Browser.
838 for (size_t i = 0; i < drag_data_.size(); ++i) { 838 for (size_t i = 0; i < drag_data_.size(); ++i) {
839 drag_data_[i].contents->tab_contents()->SetDelegate(NULL); 839 drag_data_[i].contents->tab_contents()->SetDelegate(NULL);
840 drag_data_[i].original_delegate = NULL; 840 drag_data_[i].original_delegate = NULL;
841 } 841 }
842 842
843 // Return the TabContents' to normalcy. 843 // Return the TabContents' to normalcy.
844 source_dragged_contents()->tab_contents()->set_capturing_contents(false); 844 source_dragged_contents()->tab_contents()->SetCapturingContents(false);
845 845
846 // Inserting counts as a move. We don't want the tabs to jitter when the 846 // Inserting counts as a move. We don't want the tabs to jitter when the
847 // user moves the tab immediately after attaching it. 847 // user moves the tab immediately after attaching it.
848 last_move_screen_loc_ = MajorAxisValue(screen_point, attached_tabstrip); 848 last_move_screen_loc_ = MajorAxisValue(screen_point, attached_tabstrip);
849 849
850 // Figure out where to insert the tab based on the bounds of the dragged 850 // Figure out where to insert the tab based on the bounds of the dragged
851 // representation and the ideal bounds of the other Tabs already in the 851 // representation and the ideal bounds of the other Tabs already in the
852 // strip. ("ideal bounds" are stable even if the Tabs' actual bounds are 852 // strip. ("ideal bounds" are stable even if the Tabs' actual bounds are
853 // changing due to animation). 853 // changing due to animation).
854 gfx::Point tab_strip_point(screen_point); 854 gfx::Point tab_strip_point(screen_point);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 tabs[source_tab_index_]->width()); 889 tabs[source_tab_index_]->width());
890 mouse_offset_.set_x(new_x); 890 mouse_offset_.set_x(new_x);
891 891
892 // Move the corresponding window to the front. 892 // Move the corresponding window to the front.
893 attached_tabstrip_->GetWidget()->Activate(); 893 attached_tabstrip_->GetWidget()->Activate();
894 } 894 }
895 895
896 void DefaultTabDragController::Detach() { 896 void DefaultTabDragController::Detach() {
897 // Prevent the TabContents' HWND from being hidden by any of the model 897 // Prevent the TabContents' HWND from being hidden by any of the model
898 // operations performed during the drag. 898 // operations performed during the drag.
899 source_dragged_contents()->tab_contents()->set_capturing_contents(true); 899 source_dragged_contents()->tab_contents()->SetCapturingContents(true);
900 900
901 // Calculate the drag bounds. 901 // Calculate the drag bounds.
902 std::vector<gfx::Rect> drag_bounds; 902 std::vector<gfx::Rect> drag_bounds;
903 std::vector<BaseTab*> attached_tabs; 903 std::vector<BaseTab*> attached_tabs;
904 for (size_t i = 0; i < drag_data_.size(); ++i) 904 for (size_t i = 0; i < drag_data_.size(); ++i)
905 attached_tabs.push_back(drag_data_[i].attached_tab); 905 attached_tabs.push_back(drag_data_[i].attached_tab);
906 attached_tabstrip_->CalculateBoundsForDraggedTabs(attached_tabs, 906 attached_tabstrip_->CalculateBoundsForDraggedTabs(attached_tabs,
907 &drag_bounds); 907 &drag_bounds);
908 908
909 TabStripModel* attached_model = GetModel(attached_tabstrip_); 909 TabStripModel* attached_model = GetModel(attached_tabstrip_);
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
1423 controller->Init(source_tabstrip, source_tab, tabs, mouse_offset, 1423 controller->Init(source_tabstrip, source_tab, tabs, mouse_offset,
1424 source_tab_offset, initial_selection_model); 1424 source_tab_offset, initial_selection_model);
1425 return controller; 1425 return controller;
1426 } 1426 }
1427 1427
1428 // static 1428 // static
1429 bool TabDragController::IsAttachedTo(TabStrip* tab_strip) { 1429 bool TabDragController::IsAttachedTo(TabStrip* tab_strip) {
1430 return instance_ && instance_->active()&& 1430 return instance_ && instance_->active()&&
1431 instance_->attached_tabstrip() == tab_strip; 1431 instance_->attached_tabstrip() == tab_strip;
1432 } 1432 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698