Commit b450667e authored by Connie Wan's avatar Connie Wan Committed by Commit Bot

Run git cl format on tab_drag_controller.cc

Change-Id: Ia11827685185902bfd443f64af48cb2fca5b1fa5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1822028Reviewed-by: default avatarPeter Boström <pbos@chromium.org>
Commit-Queue: Connie Wan <connily@chromium.org>
Cr-Commit-Position: refs/heads/master@{#699475}
parent aa39ab47
...@@ -189,8 +189,7 @@ gfx::Rect GetTabstripScreenBounds(const TabDragContext* context) { ...@@ -189,8 +189,7 @@ gfx::Rect GetTabstripScreenBounds(const TabDragContext* context) {
// Returns true if |bounds| contains the y-coordinate |y|. The y-coordinate // Returns true if |bounds| contains the y-coordinate |y|. The y-coordinate
// of |bounds| is adjusted by |vertical_adjustment|. // of |bounds| is adjusted by |vertical_adjustment|.
bool DoesRectContainVerticalPointExpanded( bool DoesRectContainVerticalPointExpanded(const gfx::Rect& bounds,
const gfx::Rect& bounds,
int vertical_adjustment, int vertical_adjustment,
int y) { int y) {
int upper_threshold = bounds.bottom() + vertical_adjustment; int upper_threshold = bounds.bottom() + vertical_adjustment;
...@@ -287,11 +286,9 @@ TabDragController::TabDragData::TabDragData() ...@@ -287,11 +286,9 @@ TabDragController::TabDragData::TabDragData()
: contents(NULL), : contents(NULL),
source_model_index(-1), source_model_index(-1),
attached_tab(NULL), attached_tab(NULL),
pinned(false) { pinned(false) {}
}
TabDragController::TabDragData::~TabDragData() { TabDragController::TabDragData::~TabDragData() {}
}
TabDragController::TabDragData::TabDragData(TabDragData&&) = default; TabDragController::TabDragData::TabDragData(TabDragData&&) = default;
...@@ -531,8 +528,8 @@ bool TabDragController::IsDraggingTab(content::WebContents* contents) { ...@@ -531,8 +528,8 @@ bool TabDragController::IsDraggingTab(content::WebContents* contents) {
} }
void TabDragController::Drag(const gfx::Point& point_in_screen) { void TabDragController::Drag(const gfx::Point& point_in_screen) {
TRACE_EVENT1("views", "TabDragController::Drag", TRACE_EVENT1("views", "TabDragController::Drag", "point_in_screen",
"point_in_screen", point_in_screen.ToString()); point_in_screen.ToString());
bring_to_front_timer_.Stop(); bring_to_front_timer_.Stop();
move_stacked_timer_.Stop(); move_stacked_timer_.Stop();
...@@ -570,8 +567,8 @@ void TabDragController::Drag(const gfx::Point& point_in_screen) { ...@@ -570,8 +567,8 @@ void TabDragController::Drag(const gfx::Point& point_in_screen) {
new_bounds = CalculateDraggedBrowserBounds( new_bounds = CalculateDraggedBrowserBounds(
source_context_, point_in_screen, &drag_bounds); source_context_, point_in_screen, &drag_bounds);
new_bounds.Offset(-widget->GetRestoredBounds().x() + new_bounds.Offset(-widget->GetRestoredBounds().x() +
point_in_screen.x() - point_in_screen.x() - mouse_offset_.x(),
mouse_offset_.x(), 0); 0);
widget->SetVisibilityChangedAnimationsEnabled(false); widget->SetVisibilityChangedAnimationsEnabled(false);
widget->Restore(); widget->Restore();
widget->SetBounds(new_bounds); widget->SetBounds(new_bounds);
...@@ -642,8 +639,7 @@ void TabDragController::EndDrag(EndDragReason reason) { ...@@ -642,8 +639,7 @@ void TabDragController::EndDrag(EndDragReason reason) {
: NORMAL); : NORMAL);
} }
void TabDragController::InitTabDragData(Tab* tab, void TabDragController::InitTabDragData(Tab* tab, TabDragData* drag_data) {
TabDragData* drag_data) {
TRACE_EVENT0("views", "TabDragController::InitTabDragData"); TRACE_EVENT0("views", "TabDragController::InitTabDragData");
const int source_model_index = source_context_->GetIndexOf(tab); const int source_model_index = source_context_->GetIndexOf(tab);
drag_data->source_model_index = source_model_index; drag_data->source_model_index = source_model_index;
...@@ -1134,8 +1130,7 @@ TabDragContext* TabDragController::GetContextForWindow( ...@@ -1134,8 +1130,7 @@ TabDragContext* TabDragController::GetContextForWindow(
BrowserView* browser_view = BrowserView* browser_view =
BrowserView::GetBrowserViewForNativeWindow(window); BrowserView::GetBrowserViewForNativeWindow(window);
// We don't allow drops on windows that don't have tabstrips. // We don't allow drops on windows that don't have tabstrips.
if (!browser_view || if (!browser_view || !browser_view->browser()->SupportsWindowFeature(
!browser_view->browser()->SupportsWindowFeature(
Browser::FEATURE_TABSTRIP)) Browser::FEATURE_TABSTRIP))
return NULL; return NULL;
...@@ -1162,8 +1157,8 @@ bool TabDragController::DoesTabStripContain( ...@@ -1162,8 +1157,8 @@ bool TabDragController::DoesTabStripContain(
void TabDragController::Attach(TabDragContext* attached_context, void TabDragController::Attach(TabDragContext* attached_context,
const gfx::Point& point_in_screen, const gfx::Point& point_in_screen,
bool set_capture) { bool set_capture) {
TRACE_EVENT1("views", "TabDragController::Attach", TRACE_EVENT1("views", "TabDragController::Attach", "point_in_screen",
"point_in_screen", point_in_screen.ToString()); point_in_screen.ToString());
DCHECK(!attached_context_); // We should already have detached by the time DCHECK(!attached_context_); // We should already have detached by the time
// we get here. // we get here.
...@@ -1256,8 +1251,8 @@ void TabDragController::Attach(TabDragContext* attached_context, ...@@ -1256,8 +1251,8 @@ void TabDragController::Attach(TabDragContext* attached_context,
} }
void TabDragController::Detach(ReleaseCapture release_capture) { void TabDragController::Detach(ReleaseCapture release_capture) {
TRACE_EVENT1("views", "TabDragController::Detach", TRACE_EVENT1("views", "TabDragController::Detach", "release_capture",
"release_capture", release_capture); release_capture);
attached_context_tabs_closed_tracker_.reset(); attached_context_tabs_closed_tracker_.reset();
...@@ -1391,15 +1386,14 @@ void TabDragController::RunMoveLoop(const gfx::Vector2d& drag_offset) { ...@@ -1391,15 +1386,14 @@ void TabDragController::RunMoveLoop(const gfx::Vector2d& drag_offset) {
attached_context_->OwnDragController(this); attached_context_->OwnDragController(this);
} }
const views::Widget::MoveLoopSource move_loop_source = const views::Widget::MoveLoopSource move_loop_source =
event_source_ == EVENT_SOURCE_MOUSE ? event_source_ == EVENT_SOURCE_MOUSE
views::Widget::MOVE_LOOP_SOURCE_MOUSE : ? views::Widget::MOVE_LOOP_SOURCE_MOUSE
views::Widget::MOVE_LOOP_SOURCE_TOUCH; : views::Widget::MOVE_LOOP_SOURCE_TOUCH;
const views::Widget::MoveLoopEscapeBehavior escape_behavior = const views::Widget::MoveLoopEscapeBehavior escape_behavior =
is_dragging_new_browser_ ? is_dragging_new_browser_
views::Widget::MOVE_LOOP_ESCAPE_BEHAVIOR_HIDE : ? views::Widget::MOVE_LOOP_ESCAPE_BEHAVIOR_HIDE
views::Widget::MOVE_LOOP_ESCAPE_BEHAVIOR_DONT_HIDE; : views::Widget::MOVE_LOOP_ESCAPE_BEHAVIOR_DONT_HIDE;
views::Widget::MoveLoopResult result = views::Widget::MoveLoopResult result = move_loop_widget_->RunMoveLoop(
move_loop_widget_->RunMoveLoop(
drag_offset, move_loop_source, escape_behavior); drag_offset, move_loop_source, escape_behavior);
content::NotificationService::current()->Notify( content::NotificationService::current()->Notify(
chrome::NOTIFICATION_TAB_DRAG_LOOP_DONE, chrome::NOTIFICATION_TAB_DRAG_LOOP_DONE,
...@@ -1431,8 +1425,8 @@ void TabDragController::RunMoveLoop(const gfx::Vector2d& drag_offset) { ...@@ -1431,8 +1425,8 @@ void TabDragController::RunMoveLoop(const gfx::Vector2d& drag_offset) {
return; return;
tab_strip_to_attach_to_after_exit_ = NULL; tab_strip_to_attach_to_after_exit_ = NULL;
} else if (current_state_ == DragState::kWaitingToStop) { } else if (current_state_ == DragState::kWaitingToStop) {
EndDrag(result == views::Widget::MOVE_LOOP_CANCELED ? EndDrag(result == views::Widget::MOVE_LOOP_CANCELED ? END_DRAG_CANCEL
END_DRAG_CANCEL : END_DRAG_COMPLETE); : END_DRAG_COMPLETE);
} }
} }
...@@ -1780,8 +1774,8 @@ void TabDragController::BringWindowUnderPointToFront( ...@@ -1780,8 +1774,8 @@ void TabDragController::BringWindowUnderPointToFront(
return; return;
if (window) { if (window) {
views::Widget* widget_window = views::Widget::GetWidgetForNativeWindow( views::Widget* widget_window =
window); views::Widget::GetWidgetForNativeWindow(window);
if (!widget_window) if (!widget_window)
return; return;
...@@ -1866,10 +1860,8 @@ gfx::Rect TabDragController::CalculateDraggedBrowserBounds( ...@@ -1866,10 +1860,8 @@ gfx::Rect TabDragController::CalculateDraggedBrowserBounds(
// window is at least 50% the size of the old. // window is at least 50% the size of the old.
const gfx::Size max_size( const gfx::Size max_size(
source->AsView()->GetWidget()->GetWindowBoundsInScreen().size()); source->AsView()->GetWidget()->GetWindowBoundsInScreen().size());
new_bounds.set_width( new_bounds.set_width(std::max(max_size.width() / 2, new_bounds.width()));
std::max(max_size.width() / 2, new_bounds.width())); new_bounds.set_height(std::max(max_size.height() / 2, new_bounds.height()));
new_bounds.set_height(
std::max(max_size.height() / 2, new_bounds.height()));
} }
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
...@@ -1968,9 +1960,8 @@ Browser* TabDragController::CreateBrowserForDrag( ...@@ -1968,9 +1960,8 @@ Browser* TabDragController::CreateBrowserForDrag(
const gfx::Point& point_in_screen, const gfx::Point& point_in_screen,
gfx::Vector2d* drag_offset, gfx::Vector2d* drag_offset,
std::vector<gfx::Rect>* drag_bounds) { std::vector<gfx::Rect>* drag_bounds) {
gfx::Rect new_bounds(CalculateDraggedBrowserBounds(source, gfx::Rect new_bounds(
point_in_screen, CalculateDraggedBrowserBounds(source, point_in_screen, drag_bounds));
drag_bounds));
*drag_offset = point_in_screen - new_bounds.origin(); *drag_offset = point_in_screen - new_bounds.origin();
Profile* profile = Profile* profile =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment