| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 // Distance from the next/previous stacked before before we consider the tab | 76 // Distance from the next/previous stacked before before we consider the tab |
| 77 // close enough to trigger moving. | 77 // close enough to trigger moving. |
| 78 const int kStackedDistance = 36; | 78 const int kStackedDistance = 36; |
| 79 | 79 |
| 80 // A dragged window is forced to be a bit smaller than maximized bounds during a | 80 // A dragged window is forced to be a bit smaller than maximized bounds during a |
| 81 // drag. This prevents the dragged browser widget from getting maximized at | 81 // drag. This prevents the dragged browser widget from getting maximized at |
| 82 // creation and makes it easier to drag tabs out of a restored window that had | 82 // creation and makes it easier to drag tabs out of a restored window that had |
| 83 // maximized size. | 83 // maximized size. |
| 84 const int kMaximizedWindowInset = 10; // DIPs. | 84 const int kMaximizedWindowInset = 10; // DIPs. |
| 85 | 85 |
| 86 // Whether a new browser window created during a drag is destroyed immediately |
| 87 // once it is associated with a new tab strip. If false, windows created during |
| 88 // the drag are destroyed only when the drag ends. |
| 89 #if 0 && defined(OS_MACOSX) |
| 90 const bool windows_destroy_during_drag = false; |
| 91 #else |
| 92 const bool windows_destroy_during_drag = true; |
| 93 #endif |
| 94 |
| 86 #if defined(USE_ASH) | 95 #if defined(USE_ASH) |
| 87 void SetWindowPositionManaged(gfx::NativeWindow window, bool value) { | 96 void SetWindowPositionManaged(gfx::NativeWindow window, bool value) { |
| 88 ash::wm::GetWindowState(window)->set_window_position_managed(value); | 97 ash::wm::GetWindowState(window)->set_window_position_managed(value); |
| 89 } | 98 } |
| 90 | 99 |
| 91 // Returns true if |tab_strip| browser window is docked. | 100 // Returns true if |tab_strip| browser window is docked. |
| 92 bool IsDockedOrSnapped(const TabStrip* tab_strip) { | 101 bool IsDockedOrSnapped(const TabStrip* tab_strip) { |
| 93 DCHECK(tab_strip); | 102 DCHECK(tab_strip); |
| 94 ash::wm::WindowState* window_state = | 103 ash::wm::WindowState* window_state = |
| 95 ash::wm::GetWindowState(tab_strip->GetWidget()->GetNativeWindow()); | 104 ash::wm::GetWindowState(tab_strip->GetWidget()->GetNativeWindow()); |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 // synchronous on desktop Linux, so use that. | 281 // synchronous on desktop Linux, so use that. |
| 273 // - Ash | 282 // - Ash |
| 274 // Releasing capture on Ash cancels gestures so avoid it. | 283 // Releasing capture on Ash cancels gestures so avoid it. |
| 275 #if defined(OS_LINUX) | 284 #if defined(OS_LINUX) |
| 276 can_release_capture_ = false; | 285 can_release_capture_ = false; |
| 277 #else | 286 #else |
| 278 can_release_capture_ = | 287 can_release_capture_ = |
| 279 (host_desktop_type_ != chrome::HOST_DESKTOP_TYPE_ASH); | 288 (host_desktop_type_ != chrome::HOST_DESKTOP_TYPE_ASH); |
| 280 #endif | 289 #endif |
| 281 start_point_in_screen_ = gfx::Point(source_tab_offset, mouse_offset.y()); | 290 start_point_in_screen_ = gfx::Point(source_tab_offset, mouse_offset.y()); |
| 291 DLOG(INFO) << "TabDragController::Init/mouse offset -> point_in_window=" |
| 292 << mouse_offset.ToString() << " -> " |
| 293 << start_point_in_screen_.ToString(); |
| 282 views::View::ConvertPointToScreen(source_tab, &start_point_in_screen_); | 294 views::View::ConvertPointToScreen(source_tab, &start_point_in_screen_); |
| 295 DLOG(INFO) << " --> in screen=" << start_point_in_screen_.ToString(); |
| 296 |
| 283 event_source_ = event_source; | 297 event_source_ = event_source; |
| 284 mouse_offset_ = mouse_offset; | 298 mouse_offset_ = mouse_offset; |
| 285 move_behavior_ = move_behavior; | 299 move_behavior_ = move_behavior; |
| 286 last_point_in_screen_ = start_point_in_screen_; | 300 last_point_in_screen_ = start_point_in_screen_; |
| 287 last_move_screen_loc_ = start_point_in_screen_.x(); | 301 last_move_screen_loc_ = start_point_in_screen_.x(); |
| 288 initial_tab_positions_ = source_tabstrip->GetTabXCoordinates(); | 302 initial_tab_positions_ = source_tabstrip->GetTabXCoordinates(); |
| 289 | 303 |
| 290 GetModel(source_tabstrip_)->AddObserver(this); | 304 GetModel(source_tabstrip_)->AddObserver(this); |
| 291 | 305 |
| 292 drag_data_.resize(tabs.size()); | 306 drag_data_.resize(tabs.size()); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 void TabDragController::Drag(const gfx::Point& point_in_screen) { | 358 void TabDragController::Drag(const gfx::Point& point_in_screen) { |
| 345 TRACE_EVENT1("views", "TabDragController::Drag", | 359 TRACE_EVENT1("views", "TabDragController::Drag", |
| 346 "point_in_screen", point_in_screen.ToString()); | 360 "point_in_screen", point_in_screen.ToString()); |
| 347 | 361 |
| 348 bring_to_front_timer_.Stop(); | 362 bring_to_front_timer_.Stop(); |
| 349 move_stacked_timer_.Stop(); | 363 move_stacked_timer_.Stop(); |
| 350 | 364 |
| 351 if (waiting_for_run_loop_to_exit_) | 365 if (waiting_for_run_loop_to_exit_) |
| 352 return; | 366 return; |
| 353 | 367 |
| 368 DLOG(INFO) << "Started_drag = " << started_drag_; |
| 369 |
| 354 if (!started_drag_) { | 370 if (!started_drag_) { |
| 355 if (!CanStartDrag(point_in_screen)) | 371 if (!CanStartDrag(point_in_screen)) |
| 356 return; // User hasn't dragged far enough yet. | 372 return; // User hasn't dragged far enough yet. |
| 357 | 373 |
| 374 DLOG(INFO) << "STARTING!"; |
| 375 |
| 358 // On windows SaveFocus() may trigger a capture lost, which destroys us. | 376 // On windows SaveFocus() may trigger a capture lost, which destroys us. |
| 359 { | 377 { |
| 360 base::WeakPtr<TabDragController> ref(weak_factory_.GetWeakPtr()); | 378 base::WeakPtr<TabDragController> ref(weak_factory_.GetWeakPtr()); |
| 361 SaveFocus(); | 379 SaveFocus(); |
| 362 if (!ref) | 380 if (!ref) |
| 363 return; | 381 return; |
| 364 } | 382 } |
| 383 DLOG(INFO) << "Starting drag"; |
| 365 started_drag_ = true; | 384 started_drag_ = true; |
| 366 Attach(source_tabstrip_, gfx::Point()); | 385 Attach(source_tabstrip_, gfx::Point()); |
| 367 if (static_cast<int>(drag_data_.size()) == | 386 if (static_cast<int>(drag_data_.size()) == |
| 368 GetModel(source_tabstrip_)->count()) { | 387 GetModel(source_tabstrip_)->count()) { |
| 369 if (was_source_maximized_ || was_source_fullscreen_) { | 388 if (was_source_maximized_ || was_source_fullscreen_) { |
| 370 did_restore_window_ = true; | 389 did_restore_window_ = true; |
| 371 // When all tabs in a maximized browser are dragged the browser gets | 390 // When all tabs in a maximized browser are dragged the browser gets |
| 372 // restored during the drag and maximized back when the drag ends. | 391 // restored during the drag and maximized back when the drag ends. |
| 373 views::Widget* widget = GetAttachedBrowserWidget(); | 392 views::Widget* widget = GetAttachedBrowserWidget(); |
| 374 const int last_tabstrip_width = attached_tabstrip_->tab_area_width(); | 393 const int last_tabstrip_width = attached_tabstrip_->tab_area_width(); |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 return; | 541 return; |
| 523 old_focused_view->GetFocusManager()->SetFocusedView(old_focused_view); | 542 old_focused_view->GetFocusManager()->SetFocusedView(old_focused_view); |
| 524 } | 543 } |
| 525 | 544 |
| 526 bool TabDragController::CanStartDrag(const gfx::Point& point_in_screen) const { | 545 bool TabDragController::CanStartDrag(const gfx::Point& point_in_screen) const { |
| 527 // Determine if the mouse has moved beyond a minimum elasticity distance in | 546 // Determine if the mouse has moved beyond a minimum elasticity distance in |
| 528 // any direction from the starting point. | 547 // any direction from the starting point. |
| 529 static const int kMinimumDragDistance = 10; | 548 static const int kMinimumDragDistance = 10; |
| 530 int x_offset = abs(point_in_screen.x() - start_point_in_screen_.x()); | 549 int x_offset = abs(point_in_screen.x() - start_point_in_screen_.x()); |
| 531 int y_offset = abs(point_in_screen.y() - start_point_in_screen_.y()); | 550 int y_offset = abs(point_in_screen.y() - start_point_in_screen_.y()); |
| 532 return sqrt(pow(static_cast<float>(x_offset), 2) + | 551 bool result = sqrt(pow(static_cast<float>(x_offset), 2) + |
| 533 pow(static_cast<float>(y_offset), 2)) > kMinimumDragDistance; | 552 pow(static_cast<float>(y_offset), 2)) > kMinimumDragDistance; |
| 553 DLOG(INFO) << start_point_in_screen_.ToString() << " , " << point_in_screen.To
String(); |
| 554 DLOG(INFO) << "can start = " << result; |
| 555 return result; |
| 534 } | 556 } |
| 535 | 557 |
| 536 void TabDragController::ContinueDragging(const gfx::Point& point_in_screen) { | 558 void TabDragController::ContinueDragging(const gfx::Point& point_in_screen) { |
| 537 TRACE_EVENT1("views", "TabDragController::ContinueDragging", | 559 TRACE_EVENT1("views", "TabDragController::ContinueDragging", |
| 538 "point_in_screen", point_in_screen.ToString()); | 560 "point_in_screen", point_in_screen.ToString()); |
| 561 DLOG(INFO) << "ContinueDragging... point_in_screen=" << point_in_screen.ToStri
ng(); |
| 539 | 562 |
| 540 DCHECK(attached_tabstrip_); | 563 DCHECK(attached_tabstrip_); |
| 541 | 564 |
| 542 TabStrip* target_tabstrip = detach_behavior_ == DETACHABLE ? | 565 TabStrip* target_tabstrip = detach_behavior_ == DETACHABLE ? |
| 543 GetTargetTabStripForPoint(point_in_screen) : source_tabstrip_; | 566 GetTargetTabStripForPoint(point_in_screen) : source_tabstrip_; |
| 544 bool tab_strip_changed = (target_tabstrip != attached_tabstrip_); | 567 bool tab_strip_changed = (target_tabstrip != attached_tabstrip_); |
| 545 | 568 |
| 546 if (attached_tabstrip_) { | 569 if (attached_tabstrip_) { |
| 547 int move_delta = point_in_screen.x() - last_point_in_screen_.x(); | 570 int move_delta = point_in_screen.x() - last_point_in_screen_.x(); |
| 548 if (move_delta > 0) | 571 if (move_delta > 0) |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 // observer so we don't get notified and process the event. | 629 // observer so we don't get notified and process the event. |
| 607 if (host_desktop_type_ == chrome::HOST_DESKTOP_TYPE_ASH) { | 630 if (host_desktop_type_ == chrome::HOST_DESKTOP_TYPE_ASH) { |
| 608 move_loop_widget_->RemoveObserver(this); | 631 move_loop_widget_->RemoveObserver(this); |
| 609 move_loop_widget_ = NULL; | 632 move_loop_widget_ = NULL; |
| 610 } | 633 } |
| 611 views::Widget* browser_widget = GetAttachedBrowserWidget(); | 634 views::Widget* browser_widget = GetAttachedBrowserWidget(); |
| 612 // Need to release the drag controller before starting the move loop as it's | 635 // Need to release the drag controller before starting the move loop as it's |
| 613 // going to trigger capture lost, which cancels drag. | 636 // going to trigger capture lost, which cancels drag. |
| 614 attached_tabstrip_->ReleaseDragController(); | 637 attached_tabstrip_->ReleaseDragController(); |
| 615 target_tabstrip->OwnDragController(this); | 638 target_tabstrip->OwnDragController(this); |
| 639 if (!windows_destroy_during_drag) { |
| 640 Detach(DONT_RELEASE_CAPTURE); |
| 641 Attach(target_tabstrip, point_in_screen); |
| 642 // Move the tabs into position. |
| 643 // MoveAttached(point_in_screen); // assumes !is_dragging_window_ |
| 644 return DRAG_BROWSER_RESULT_CONTINUE; |
| 645 } |
| 646 |
| 616 // Disable animations so that we don't see a close animation on aero. | 647 // Disable animations so that we don't see a close animation on aero. |
| 617 browser_widget->SetVisibilityChangedAnimationsEnabled(false); | 648 browser_widget->SetVisibilityChangedAnimationsEnabled(false); |
| 618 if (can_release_capture_) | 649 if (can_release_capture_) |
| 619 browser_widget->ReleaseCapture(); | 650 browser_widget->ReleaseCapture(); |
| 620 else | 651 else |
| 621 target_tabstrip->GetWidget()->SetCapture(attached_tabstrip_); | 652 target_tabstrip->GetWidget()->SetCapture(attached_tabstrip_); |
| 622 | 653 |
| 623 // The window is going away. Since the drag is still on going we don't want | 654 // The window is going away. Since the drag is still on going we don't want |
| 624 // that to effect the position of any windows. | 655 // that to effect the position of any windows. |
| 625 SetWindowPositionManaged(browser_widget->GetNativeWindow(), false); | 656 SetWindowPositionManaged(browser_widget->GetNativeWindow(), false); |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 821 return DETACH_AFTER; | 852 return DETACH_AFTER; |
| 822 return DETACH_ABOVE_OR_BELOW; | 853 return DETACH_ABOVE_OR_BELOW; |
| 823 } | 854 } |
| 824 | 855 |
| 825 TabStrip* TabDragController::GetTargetTabStripForPoint( | 856 TabStrip* TabDragController::GetTargetTabStripForPoint( |
| 826 const gfx::Point& point_in_screen) { | 857 const gfx::Point& point_in_screen) { |
| 827 TRACE_EVENT1("views", "TabDragController::GetTargetTabStripForPoint", | 858 TRACE_EVENT1("views", "TabDragController::GetTargetTabStripForPoint", |
| 828 "point_in_screen", point_in_screen.ToString()); | 859 "point_in_screen", point_in_screen.ToString()); |
| 829 | 860 |
| 830 if (move_only() && attached_tabstrip_) { | 861 if (move_only() && attached_tabstrip_) { |
| 862 DLOG(INFO) << "MoveOnly"; |
| 831 // move_only() is intended for touch, in which case we only want to detach | 863 // move_only() is intended for touch, in which case we only want to detach |
| 832 // if the touch point moves significantly in the vertical distance. | 864 // if the touch point moves significantly in the vertical distance. |
| 833 gfx::Rect tabstrip_bounds = GetViewScreenBounds(attached_tabstrip_); | 865 gfx::Rect tabstrip_bounds = GetViewScreenBounds(attached_tabstrip_); |
| 834 if (DoesRectContainVerticalPointExpanded(tabstrip_bounds, | 866 if (DoesRectContainVerticalPointExpanded(tabstrip_bounds, |
| 835 kTouchVerticalDetachMagnetism, | 867 kTouchVerticalDetachMagnetism, |
| 836 point_in_screen.y())) | 868 point_in_screen.y())) |
| 837 return attached_tabstrip_; | 869 return attached_tabstrip_; |
| 838 } | 870 } |
| 839 gfx::NativeWindow local_window = | 871 gfx::NativeWindow local_window = |
| 840 GetLocalProcessWindow(point_in_screen, is_dragging_window_); | 872 GetLocalProcessWindow(point_in_screen, is_dragging_window_); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 "point_in_screen", point_in_screen.ToString()); | 920 "point_in_screen", point_in_screen.ToString()); |
| 889 | 921 |
| 890 DCHECK(!attached_tabstrip_); // We should already have detached by the time | 922 DCHECK(!attached_tabstrip_); // We should already have detached by the time |
| 891 // we get here. | 923 // we get here. |
| 892 | 924 |
| 893 attached_tabstrip_ = attached_tabstrip; | 925 attached_tabstrip_ = attached_tabstrip; |
| 894 | 926 |
| 895 std::vector<Tab*> tabs = | 927 std::vector<Tab*> tabs = |
| 896 GetTabsMatchingDraggedContents(attached_tabstrip_); | 928 GetTabsMatchingDraggedContents(attached_tabstrip_); |
| 897 | 929 |
| 930 bool acquire_capture = true; |
| 931 |
| 898 if (tabs.empty()) { | 932 if (tabs.empty()) { |
| 899 // Transitioning from detached to attached to a new tabstrip. Add tabs to | 933 // Transitioning from detached to attached to a new tabstrip. Add tabs to |
| 900 // the new model. | 934 // the new model. |
| 901 | 935 |
| 902 selection_model_before_attach_.Copy(attached_tabstrip->GetSelectionModel()); | 936 selection_model_before_attach_.Copy(attached_tabstrip->GetSelectionModel()); |
| 903 | 937 |
| 904 // Inserting counts as a move. We don't want the tabs to jitter when the | 938 // Inserting counts as a move. We don't want the tabs to jitter when the |
| 905 // user moves the tab immediately after attaching it. | 939 // user moves the tab immediately after attaching it. |
| 906 last_move_screen_loc_ = point_in_screen.x(); | 940 last_move_screen_loc_ = point_in_screen.x(); |
| 907 | 941 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 927 DCHECK_EQ(1u, drag_data_.size()); | 961 DCHECK_EQ(1u, drag_data_.size()); |
| 928 add_types |= TabStripModel::ADD_ACTIVE; | 962 add_types |= TabStripModel::ADD_ACTIVE; |
| 929 } | 963 } |
| 930 if (drag_data_[i].pinned) | 964 if (drag_data_[i].pinned) |
| 931 add_types |= TabStripModel::ADD_PINNED; | 965 add_types |= TabStripModel::ADD_PINNED; |
| 932 GetModel(attached_tabstrip_)->InsertWebContentsAt( | 966 GetModel(attached_tabstrip_)->InsertWebContentsAt( |
| 933 index + i, drag_data_[i].contents, add_types); | 967 index + i, drag_data_[i].contents, add_types); |
| 934 } | 968 } |
| 935 | 969 |
| 936 tabs = GetTabsMatchingDraggedContents(attached_tabstrip_); | 970 tabs = GetTabsMatchingDraggedContents(attached_tabstrip_); |
| 971 |
| 972 // If the windows are kept, there's no need to re-acquire capture. Instead, |
| 973 // the TabDragController remains in a MoveLoop. |
| 974 acquire_capture = windows_destroy_during_drag; |
| 937 } | 975 } |
| 938 DCHECK_EQ(tabs.size(), drag_data_.size()); | 976 DCHECK_EQ(tabs.size(), drag_data_.size()); |
| 939 for (size_t i = 0; i < drag_data_.size(); ++i) | 977 for (size_t i = 0; i < drag_data_.size(); ++i) |
| 940 drag_data_[i].attached_tab = tabs[i]; | 978 drag_data_[i].attached_tab = tabs[i]; |
| 941 | 979 |
| 942 attached_tabstrip_->StartedDraggingTabs(tabs); | 980 attached_tabstrip_->StartedDraggingTabs(tabs); |
| 943 | 981 |
| 944 ResetSelection(GetModel(attached_tabstrip_)); | 982 ResetSelection(GetModel(attached_tabstrip_)); |
| 945 | 983 |
| 946 // The size of the dragged tab may have changed. Adjust the x offset so that | 984 // The size of the dragged tab may have changed. Adjust the x offset so that |
| 947 // ratio of mouse_offset_ to original width is maintained. | 985 // ratio of mouse_offset_ to original width is maintained. |
| 948 std::vector<Tab*> tabs_to_source(tabs); | 986 std::vector<Tab*> tabs_to_source(tabs); |
| 949 tabs_to_source.erase(tabs_to_source.begin() + source_tab_index_ + 1, | 987 tabs_to_source.erase(tabs_to_source.begin() + source_tab_index_ + 1, |
| 950 tabs_to_source.end()); | 988 tabs_to_source.end()); |
| 951 int new_x = attached_tabstrip_->GetSizeNeededForTabs(tabs_to_source) - | 989 int new_x = attached_tabstrip_->GetSizeNeededForTabs(tabs_to_source) - |
| 952 tabs[source_tab_index_]->width() + | 990 tabs[source_tab_index_]->width() + |
| 953 static_cast<int>(offset_to_width_ratio_ * | 991 static_cast<int>(offset_to_width_ratio_ * |
| 954 tabs[source_tab_index_]->width()); | 992 tabs[source_tab_index_]->width()); |
| 955 mouse_offset_.set_x(new_x); | 993 mouse_offset_.set_x(new_x); |
| 956 | 994 |
| 957 // Transfer ownership of us to the new tabstrip as well as making sure the | 995 // Transfer ownership of us to the new tabstrip as well as making sure the |
| 958 // window has capture. This is important so that if activation changes the | 996 // window has capture. This is important so that if activation changes the |
| 959 // drag isn't prematurely canceled. | 997 // drag isn't prematurely canceled. |
| 960 attached_tabstrip_->GetWidget()->SetCapture(attached_tabstrip_); | 998 if (acquire_capture) |
| 999 attached_tabstrip_->GetWidget()->SetCapture(attached_tabstrip_); |
| 961 attached_tabstrip_->OwnDragController(this); | 1000 attached_tabstrip_->OwnDragController(this); |
| 962 } | 1001 } |
| 963 | 1002 |
| 964 void TabDragController::Detach(ReleaseCapture release_capture) { | 1003 void TabDragController::Detach(ReleaseCapture release_capture) { |
| 965 TRACE_EVENT1("views", "TabDragController::Detach", | 1004 TRACE_EVENT1("views", "TabDragController::Detach", |
| 966 "release_capture", release_capture); | 1005 "release_capture", release_capture); |
| 967 | 1006 |
| 968 attach_index_ = -1; | 1007 attach_index_ = -1; |
| 969 | 1008 |
| 970 // When the user detaches we assume they want to reorder. | 1009 // When the user detaches we assume they want to reorder. |
| (...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1748 Profile::FromBrowserContext(drag_data_[0].contents->GetBrowserContext()); | 1787 Profile::FromBrowserContext(drag_data_[0].contents->GetBrowserContext()); |
| 1749 Browser::CreateParams create_params(Browser::TYPE_TABBED, | 1788 Browser::CreateParams create_params(Browser::TYPE_TABBED, |
| 1750 profile, | 1789 profile, |
| 1751 host_desktop_type_); | 1790 host_desktop_type_); |
| 1752 create_params.initial_bounds = new_bounds; | 1791 create_params.initial_bounds = new_bounds; |
| 1753 Browser* browser = new Browser(create_params); | 1792 Browser* browser = new Browser(create_params); |
| 1754 is_dragging_new_browser_ = true; | 1793 is_dragging_new_browser_ = true; |
| 1755 SetWindowPositionManaged(browser->window()->GetNativeWindow(), false); | 1794 SetWindowPositionManaged(browser->window()->GetNativeWindow(), false); |
| 1756 // If the window is created maximized then the bounds we supplied are ignored. | 1795 // If the window is created maximized then the bounds we supplied are ignored. |
| 1757 // We need to reset them again so they are honored. | 1796 // We need to reset them again so they are honored. |
| 1797 DLOG(INFO) << "SetBounds -> " << new_bounds.ToString(); |
| 1758 browser->window()->SetBounds(new_bounds); | 1798 browser->window()->SetBounds(new_bounds); |
| 1759 | 1799 |
| 1760 return browser; | 1800 return browser; |
| 1761 } | 1801 } |
| 1762 | 1802 |
| 1763 gfx::Point TabDragController::GetCursorScreenPoint() { | 1803 gfx::Point TabDragController::GetCursorScreenPoint() { |
| 1764 #if defined(USE_ASH) | 1804 #if defined(USE_ASH) |
| 1765 if (host_desktop_type_ == chrome::HOST_DESKTOP_TYPE_ASH && | 1805 if (host_desktop_type_ == chrome::HOST_DESKTOP_TYPE_ASH && |
| 1766 event_source_ == EVENT_SOURCE_TOUCH && | 1806 event_source_ == EVENT_SOURCE_TOUCH && |
| 1767 aura::Env::GetInstance()->is_touch_down()) { | 1807 aura::Env::GetInstance()->is_touch_down()) { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1816 it != browser_list->end(); ++it) { | 1856 it != browser_list->end(); ++it) { |
| 1817 if ((*it)->tab_strip_model()->empty()) | 1857 if ((*it)->tab_strip_model()->empty()) |
| 1818 exclude.insert((*it)->window()->GetNativeWindow()); | 1858 exclude.insert((*it)->window()->GetNativeWindow()); |
| 1819 } | 1859 } |
| 1820 #endif | 1860 #endif |
| 1821 return GetLocalProcessWindowAtPoint(host_desktop_type_, | 1861 return GetLocalProcessWindowAtPoint(host_desktop_type_, |
| 1822 screen_point, | 1862 screen_point, |
| 1823 exclude); | 1863 exclude); |
| 1824 | 1864 |
| 1825 } | 1865 } |
| OLD | NEW |