summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/panels/detached_panel_drag_handler.cc
blob: 407f811f94dc0b19834ca372aba9cf8b6ca2679e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// 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/detached_panel_drag_handler.h"

#include "base/logging.h"
#include "chrome/browser/ui/panels/panel.h"
#include "chrome/browser/ui/panels/panel_collection.h"
#include "ui/gfx/point.h"
#include "ui/gfx/rect.h"

// static
void DetachedPanelDragHandler::HandleDrag(Panel* panel,
                                          const gfx::Point& target_position) {
  DCHECK_EQ(PanelCollection::DETACHED, panel->collection()->type());

  gfx::Rect new_bounds(panel->GetBounds());
  new_bounds.set_origin(target_position);
  panel->SetPanelBoundsInstantly(new_bounds);
}