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

Unified Diff: chrome/browser/ui/panels/docked_panel_drag_handler.cc

Issue 2263863002: Remove implementation of Panels on OSes other than ChromeOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CR feedback Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/panels/docked_panel_drag_handler.h ('k') | chrome/browser/ui/panels/native_panel.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/panels/docked_panel_drag_handler.cc
diff --git a/chrome/browser/ui/panels/docked_panel_drag_handler.cc b/chrome/browser/ui/panels/docked_panel_drag_handler.cc
deleted file mode 100644
index 641414333408b10242f73ef11bf7a9a3ad02dcf3..0000000000000000000000000000000000000000
--- a/chrome/browser/ui/panels/docked_panel_drag_handler.cc
+++ /dev/null
@@ -1,115 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/ui/panels/docked_panel_drag_handler.h"
-
-#include "chrome/browser/ui/panels/docked_panel_collection.h"
-#include "chrome/browser/ui/panels/panel.h"
-#include "chrome/browser/ui/panels/panel_manager.h"
-#include "ui/gfx/geometry/point.h"
-#include "ui/gfx/geometry/rect.h"
-
-// static
-void DockedPanelDragHandler::HandleDrag(Panel* panel,
- const gfx::Point& target_position) {
- DCHECK_EQ(PanelCollection::DOCKED, panel->collection()->type());
-
- DockedPanelCollection* collection =
- static_cast<DockedPanelCollection*>(panel->collection());
-
- // Moves this panel to the dragging position.
- // Note that we still allow the panel to be moved vertically until it gets
- // aligned to the bottom area.
- gfx::Rect new_bounds(panel->GetBounds());
- new_bounds.set_x(target_position.x());
- int delta_x = new_bounds.x() - panel->GetBounds().x();
- int bottom = collection->GetBottomPositionForExpansionState(
- panel->expansion_state());
- if (new_bounds.bottom() != bottom) {
- new_bounds.set_y(target_position.y());
- if (new_bounds.bottom() > bottom)
- new_bounds.set_y(bottom - new_bounds.height());
- }
- panel->SetPanelBoundsInstantly(new_bounds);
-
- if (delta_x) {
- // Checks and processes other affected panels.
- if (delta_x > 0)
- DragRight(panel);
- else
- DragLeft(panel);
-
- // Layout refresh will automatically recompute the bounds of all affected
- // panels due to their position changes.
- collection->RefreshLayout();
- }
-}
-
-// static
-void DockedPanelDragHandler::DragLeft(Panel* panel) {
- DockedPanelCollection* collection =
- static_cast<DockedPanelCollection*>(panel->collection());
-
- // This is the left corner of the dragging panel. We use it to check against
- // all the panels on its left.
- int dragging_panel_left_boundary = panel->GetBounds().x();
-
- // Checks the panels to the left of the dragging panel.
- DockedPanelCollection::Panels::iterator dragging_panel_iterator =
- find(collection->panels_.begin(), collection->panels_.end(), panel);
- DockedPanelCollection::Panels::iterator current_panel_iterator =
- dragging_panel_iterator;
- ++current_panel_iterator;
- for (; current_panel_iterator != collection->panels_.end();
- ++current_panel_iterator) {
- Panel* current_panel = *current_panel_iterator;
-
- // Can we swap dragging panel with its left panel? The criterion is that
- // the left corner of dragging panel should pass the middle position of
- // its left panel.
- if (dragging_panel_left_boundary > current_panel->GetBounds().x() +
- current_panel->GetBounds().width() / 2)
- break;
-
- // Swaps the contents and makes |dragging_panel_iterator| refers to the new
- // position.
- *dragging_panel_iterator = current_panel;
- *current_panel_iterator = panel;
- dragging_panel_iterator = current_panel_iterator;
- }
-}
-
-// static
-void DockedPanelDragHandler::DragRight(Panel* panel) {
- DockedPanelCollection* collection =
- static_cast<DockedPanelCollection*>(panel->collection());
-
- // This is the right corner of the dragging panel. We use it to check against
- // all the panels on its right.
- int dragging_panel_right_boundary = panel->GetBounds().x() +
- panel->GetBounds().width() - 1;
-
- // Checks the panels to the right of the dragging panel.
- DockedPanelCollection::Panels::iterator dragging_panel_iterator =
- find(collection->panels_.begin(), collection->panels_.end(), panel);
- DockedPanelCollection::Panels::iterator current_panel_iterator =
- dragging_panel_iterator;
- while (current_panel_iterator != collection->panels_.begin()) {
- current_panel_iterator--;
- Panel* current_panel = *current_panel_iterator;
-
- // Can we swap dragging panel with its right panel? The criterion is that
- // the left corner of dragging panel should pass the middle position of
- // its right panel.
- if (dragging_panel_right_boundary < current_panel->GetBounds().x() +
- current_panel->GetBounds().width() / 2)
- break;
-
- // Swaps the contents and makes |dragging_panel_iterator| refers to the new
- // position.
- *dragging_panel_iterator = current_panel;
- *current_panel_iterator = panel;
- dragging_panel_iterator = current_panel_iterator;
- }
-}
« no previous file with comments | « chrome/browser/ui/panels/docked_panel_drag_handler.h ('k') | chrome/browser/ui/panels/native_panel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698