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

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

Issue 10919046: Allow panels to be created as detached panels. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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/detached_panel_strip.h ('k') | chrome/browser/ui/panels/panel_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/panels/detached_panel_strip.cc
diff --git a/chrome/browser/ui/panels/detached_panel_strip.cc b/chrome/browser/ui/panels/detached_panel_strip.cc
index b3c6394fbc9a69bee9c85beae1b4ba8e1b7d357e..b159ce9ef522f9c05c434dbbf3dea1d982cbaf0f 100644
--- a/chrome/browser/ui/panels/detached_panel_strip.cc
+++ b/chrome/browser/ui/panels/detached_panel_strip.cc
@@ -9,6 +9,12 @@
#include "chrome/browser/ui/panels/panel_drag_controller.h"
#include "chrome/browser/ui/panels/panel_manager.h"
+namespace {
+// How much horizontal and vertical offset there is between newly opened
+// detached panels.
+const int kPanelTilePixels = 10;
jianli 2012/08/31 23:25:55 Why choosing 10? Could different platforms have di
jennb 2012/08/31 23:31:14 kWindowTilePixels in WindowSizer is always 10. Tha
+} // namespace
+
DetachedPanelStrip::DetachedPanelStrip(PanelManager* panel_manager)
: PanelStrip(PanelStrip::DETACHED),
panel_manager_(panel_manager) {
@@ -66,6 +72,11 @@ void DetachedPanelStrip::AddPanel(Panel* panel,
DCHECK_NE(this, panel->panel_strip());
panel->set_panel_strip(this);
panels_.insert(panel);
+
+ // Offset the default position of the next detached panel if the current
+ // default position is used.
+ if (panel->GetBounds().origin() == default_panel_origin_)
+ default_panel_origin_.Offset(kPanelTilePixels, kPanelTilePixels);
}
void DetachedPanelStrip::RemovePanel(Panel* panel) {
@@ -228,3 +239,12 @@ void DetachedPanelStrip::UpdatePanelOnStripChange(Panel* panel) {
void DetachedPanelStrip::OnPanelActiveStateChanged(Panel* panel) {
}
+const gfx::Point& DetachedPanelStrip::GetDefaultPanelOrigin() {
+ if (!default_panel_origin_.x() && !default_panel_origin_.y()) {
+ gfx::Rect display_area =
+ panel_manager_->display_settings_provider()->GetDisplayArea();
+ default_panel_origin_.SetPoint(kPanelTilePixels + display_area.x(),
jianli 2012/08/31 23:25:55 Why starting from left top corner? Would it be bet
jennb 2012/08/31 23:31:14 This is the first position only. After that, it st
+ kPanelTilePixels + display_area.y());
jianli 2012/08/31 23:25:55 nit: space
jennb 2012/08/31 23:31:14 Done.
+ }
+ return default_panel_origin_;
+}
« no previous file with comments | « chrome/browser/ui/panels/detached_panel_strip.h ('k') | chrome/browser/ui/panels/panel_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698