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

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

Issue 23460016: Removes debugging code added @ 219682 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 | « chrome/browser/ui/views/tabs/tab_drag_controller.h ('k') | no next file » | 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 "base/auto_reset.h" 10 #include "base/auto_reset.h"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/debug/alias.h"
14 #include "base/i18n/rtl.h" 13 #include "base/i18n/rtl.h"
15 #include "chrome/browser/chrome_notification_types.h" 14 #include "chrome/browser/chrome_notification_types.h"
16 #include "chrome/browser/extensions/extension_function_dispatcher.h" 15 #include "chrome/browser/extensions/extension_function_dispatcher.h"
17 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/ui/app_modal_dialogs/javascript_dialog_manager.h" 17 #include "chrome/browser/ui/app_modal_dialogs/javascript_dialog_manager.h"
19 #include "chrome/browser/ui/browser_window.h" 18 #include "chrome/browser/ui/browser_window.h"
20 #include "chrome/browser/ui/tabs/tab_strip_model.h" 19 #include "chrome/browser/ui/tabs/tab_strip_model.h"
21 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h" 20 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h"
22 #include "chrome/browser/ui/views/frame/browser_view.h" 21 #include "chrome/browser/ui/views/frame/browser_view.h"
23 #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h" 22 #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h"
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 initial_move_(true), 368 initial_move_(true),
370 detach_behavior_(DETACHABLE), 369 detach_behavior_(DETACHABLE),
371 move_behavior_(REORDER), 370 move_behavior_(REORDER),
372 mouse_move_direction_(0), 371 mouse_move_direction_(0),
373 is_dragging_window_(false), 372 is_dragging_window_(false),
374 end_run_loop_behavior_(END_RUN_LOOP_STOP_DRAGGING), 373 end_run_loop_behavior_(END_RUN_LOOP_STOP_DRAGGING),
375 waiting_for_run_loop_to_exit_(false), 374 waiting_for_run_loop_to_exit_(false),
376 tab_strip_to_attach_to_after_exit_(NULL), 375 tab_strip_to_attach_to_after_exit_(NULL),
377 move_loop_widget_(NULL), 376 move_loop_widget_(NULL),
378 destroyed_(NULL), 377 destroyed_(NULL),
379 is_mutating_(false), 378 is_mutating_(false) {
380 saving_focus_(false) {
381 instance_ = this; 379 instance_ = this;
382 } 380 }
383 381
384 TabDragController::~TabDragController() { 382 TabDragController::~TabDragController() {
385 CHECK(!saving_focus_);
386 if (instance_ == this) 383 if (instance_ == this)
387 instance_ = NULL; 384 instance_ = NULL;
388 385
389 if (destroyed_) 386 if (destroyed_)
390 *destroyed_ = true; 387 *destroyed_ = true;
391 388
392 if (move_loop_widget_) { 389 if (move_loop_widget_) {
393 move_loop_widget_->RemoveObserver(this); 390 move_loop_widget_->RemoveObserver(this);
394 SetTrackedByWorkspace(move_loop_widget_->GetNativeView(), true); 391 SetTrackedByWorkspace(move_loop_widget_->GetNativeView(), true);
395 SetWindowPositionManaged(move_loop_widget_->GetNativeView(), true); 392 SetWindowPositionManaged(move_loop_widget_->GetNativeView(), true);
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 // Current dock position is the same as last, update the controller's 739 // Current dock position is the same as last, update the controller's
743 // in_enable_area state as it may have changed. 740 // in_enable_area state as it may have changed.
744 dock_controllers_.back()->UpdateInEnabledArea(dock_info_.in_enable_area()); 741 dock_controllers_.back()->UpdateInEnabledArea(dock_info_.in_enable_area());
745 } 742 }
746 } 743 }
747 744
748 void TabDragController::SaveFocus() { 745 void TabDragController::SaveFocus() {
749 DCHECK(!old_focused_view_); // This should only be invoked once. 746 DCHECK(!old_focused_view_); // This should only be invoked once.
750 DCHECK(source_tabstrip_); 747 DCHECK(source_tabstrip_);
751 old_focused_view_ = source_tabstrip_->GetFocusManager()->GetFocusedView(); 748 old_focused_view_ = source_tabstrip_->GetFocusManager()->GetFocusedView();
752 // TODO(sky): used in tracking crash; see 275931.
753 const char* old_focused_view_class_name =
754 old_focused_view_ ? old_focused_view_->GetClassName() : NULL;
755 base::debug::Alias(old_focused_view_class_name);
756 const int old_focused_view_id =
757 old_focused_view_ ? old_focused_view_->id() : 0;
758 base::debug::Alias(&old_focused_view_id);
759 base::AutoReset<bool> setter(&saving_focus_, true);
760 source_tabstrip_->GetFocusManager()->SetFocusedView(source_tabstrip_); 749 source_tabstrip_->GetFocusManager()->SetFocusedView(source_tabstrip_);
761 } 750 }
762 751
763 void TabDragController::RestoreFocus() { 752 void TabDragController::RestoreFocus() {
764 if (old_focused_view_ && attached_tabstrip_ == source_tabstrip_) 753 if (old_focused_view_ && attached_tabstrip_ == source_tabstrip_)
765 old_focused_view_->GetFocusManager()->SetFocusedView(old_focused_view_); 754 old_focused_view_->GetFocusManager()->SetFocusedView(old_focused_view_);
766 old_focused_view_ = NULL; 755 old_focused_view_ = NULL;
767 } 756 }
768 757
769 bool TabDragController::CanStartDrag(const gfx::Point& point_in_screen) const { 758 bool TabDragController::CanStartDrag(const gfx::Point& point_in_screen) const {
(...skipping 1386 matching lines...) Expand 10 before | Expand all | Expand 10 after
2156 gfx::Vector2d TabDragController::GetWindowOffset( 2145 gfx::Vector2d TabDragController::GetWindowOffset(
2157 const gfx::Point& point_in_screen) { 2146 const gfx::Point& point_in_screen) {
2158 TabStrip* owning_tabstrip = (attached_tabstrip_ && detach_into_browser_) ? 2147 TabStrip* owning_tabstrip = (attached_tabstrip_ && detach_into_browser_) ?
2159 attached_tabstrip_ : source_tabstrip_; 2148 attached_tabstrip_ : source_tabstrip_;
2160 views::View* toplevel_view = owning_tabstrip->GetWidget()->GetContentsView(); 2149 views::View* toplevel_view = owning_tabstrip->GetWidget()->GetContentsView();
2161 2150
2162 gfx::Point point = point_in_screen; 2151 gfx::Point point = point_in_screen;
2163 views::View::ConvertPointFromScreen(toplevel_view, &point); 2152 views::View::ConvertPointFromScreen(toplevel_view, &point);
2164 return point.OffsetFromOrigin(); 2153 return point.OffsetFromOrigin();
2165 } 2154 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tabs/tab_drag_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698