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

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

Issue 375593002: Do not set the mouse event handler if Widget::SetCapture() fails (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months 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
« no previous file with comments | « no previous file | ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ash/accelerators/accelerator_commands.h" 10 #include "ash/accelerators/accelerator_commands.h"
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 tabs[source_tab_index_]->width() + 908 tabs[source_tab_index_]->width() +
909 static_cast<int>(offset_to_width_ratio_ * 909 static_cast<int>(offset_to_width_ratio_ *
910 tabs[source_tab_index_]->width()); 910 tabs[source_tab_index_]->width());
911 mouse_offset_.set_x(new_x); 911 mouse_offset_.set_x(new_x);
912 912
913 // Transfer ownership of us to the new tabstrip as well as making sure the 913 // Transfer ownership of us to the new tabstrip as well as making sure the
914 // window has capture. This is important so that if activation changes the 914 // window has capture. This is important so that if activation changes the
915 // drag isn't prematurely canceled. 915 // drag isn't prematurely canceled.
916 attached_tabstrip_->GetWidget()->SetCapture(attached_tabstrip_); 916 attached_tabstrip_->GetWidget()->SetCapture(attached_tabstrip_);
917 attached_tabstrip_->OwnDragController(this); 917 attached_tabstrip_->OwnDragController(this);
918
919 // Redirect all mouse events to the TabStrip so that the tab that originated
920 // the drag can safely be deleted.
921 static_cast<views::internal::RootView*>(
922 attached_tabstrip_->GetWidget()->GetRootView())->SetMouseHandler(
923 attached_tabstrip_);
pkotwicz 2014/07/16 18:50:11 This call was added a prior date to attached_tabst
924 } 918 }
925 919
926 void TabDragController::Detach(ReleaseCapture release_capture) { 920 void TabDragController::Detach(ReleaseCapture release_capture) {
927 TRACE_EVENT1("views", "TabDragController::Detach", 921 TRACE_EVENT1("views", "TabDragController::Detach",
928 "release_capture", release_capture); 922 "release_capture", release_capture);
929 923
930 attach_index_ = -1; 924 attach_index_ = -1;
931 925
932 // When the user detaches we assume they want to reorder. 926 // When the user detaches we assume they want to reorder.
933 move_behavior_ = REORDER; 927 move_behavior_ = REORDER;
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after
1760 it != browser_list->end(); ++it) { 1754 it != browser_list->end(); ++it) {
1761 if ((*it)->tab_strip_model()->empty()) 1755 if ((*it)->tab_strip_model()->empty())
1762 exclude.insert((*it)->window()->GetNativeWindow()); 1756 exclude.insert((*it)->window()->GetNativeWindow());
1763 } 1757 }
1764 #endif 1758 #endif
1765 return GetLocalProcessWindowAtPoint(host_desktop_type_, 1759 return GetLocalProcessWindowAtPoint(host_desktop_type_,
1766 screen_point, 1760 screen_point,
1767 exclude); 1761 exclude);
1768 1762
1769 } 1763 }
OLDNEW
« no previous file with comments | « no previous file | ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698