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

Side by Side Diff: chrome/browser/ui/panels/panel_manager.cc

Issue 8774013: Add panel overflow logic to panel strip. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/panels/panel_manager.h" 5 #include "chrome/browser/ui/panels/panel_manager.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/browser_list.h" 10 #include "chrome/browser/ui/browser_list.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 69
70 void PanelManager::Layout() { 70 void PanelManager::Layout() {
71 int height = 71 int height =
72 static_cast<int>(adjusted_work_area_.height() * kPanelStripHeightFactor); 72 static_cast<int>(adjusted_work_area_.height() * kPanelStripHeightFactor);
73 gfx::Rect panel_strip_bounds; 73 gfx::Rect panel_strip_bounds;
74 panel_strip_bounds.set_x(adjusted_work_area_.x() + kPanelStripLeftMargin); 74 panel_strip_bounds.set_x(adjusted_work_area_.x() + kPanelStripLeftMargin);
75 panel_strip_bounds.set_y(adjusted_work_area_.bottom() - height); 75 panel_strip_bounds.set_y(adjusted_work_area_.bottom() - height);
76 panel_strip_bounds.set_width(adjusted_work_area_.width() - 76 panel_strip_bounds.set_width(adjusted_work_area_.width() -
77 kPanelStripLeftMargin - kPanelStripRightMargin); 77 kPanelStripLeftMargin - kPanelStripRightMargin);
78 panel_strip_bounds.set_height(height); 78 panel_strip_bounds.set_height(height);
79 panel_strip_->SetBounds(panel_strip_bounds); 79 panel_strip_->SetDisplayArea(panel_strip_bounds);
80 } 80 }
81 81
82 Panel* PanelManager::CreatePanel(Browser* browser) { 82 Panel* PanelManager::CreatePanel(Browser* browser) {
83 int width = browser->override_bounds().width(); 83 int width = browser->override_bounds().width();
84 int height = browser->override_bounds().height(); 84 int height = browser->override_bounds().height();
85 Panel* panel = new Panel(browser, gfx::Size(width, height)); 85 Panel* panel = new Panel(browser, gfx::Size(width, height));
86 panel_strip_->AddPanel(panel); 86 panel_strip_->AddPanel(panel);
87 87
88 content::NotificationService::current()->Notify( 88 content::NotificationService::current()->Notify(
89 chrome::NOTIFICATION_PANEL_ADDED, 89 chrome::NOTIFICATION_PANEL_ADDED,
90 content::Source<Panel>(panel), 90 content::Source<Panel>(panel),
91 content::NotificationService::NoDetails()); 91 content::NotificationService::NoDetails());
92 92
93 return panel; 93 return panel;
94 } 94 }
95 95
96 int PanelManager::StartingRightPosition() const { 96 int PanelManager::StartingRightPosition() const {
97 return panel_strip_->StartingRightPosition(); 97 return panel_strip_->StartingRightPosition();
98 } 98 }
99 99
100 void PanelManager::Remove(Panel* panel) { 100 void PanelManager::Remove(Panel* panel) {
101 if (panel_strip_->Remove(panel)) 101 if (panel_strip_->Remove(panel))
102 return; 102 return;
103 // TODO(jianli): else try removing from overflow strip 103 // TODO(jianli): else try removing from overflow strip
104 } 104 }
105 105
106 void PanelManager::OnPanelRemoved(Panel* panel) {
107 content::NotificationService::current()->Notify(
108 chrome::NOTIFICATION_PANEL_REMOVED,
109 content::Source<Panel>(panel),
110 content::NotificationService::NoDetails());
111 }
112
113 void PanelManager::StartDragging(Panel* panel) { 106 void PanelManager::StartDragging(Panel* panel) {
114 panel_strip_->StartDragging(panel); 107 panel_strip_->StartDragging(panel);
115 } 108 }
116 109
117 void PanelManager::Drag(int delta_x) { 110 void PanelManager::Drag(int delta_x) {
118 panel_strip_->Drag(delta_x); 111 panel_strip_->Drag(delta_x);
119 } 112 }
120 113
121 void PanelManager::EndDragging(bool cancelled) { 114 void PanelManager::EndDragging(bool cancelled) {
122 panel_strip_->EndDragging(cancelled); 115 panel_strip_->EndDragging(cancelled);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 // TODO(jianli): + overflow_strip_->num_panels(); 196 // TODO(jianli): + overflow_strip_->num_panels();
204 } 197 }
205 198
206 bool PanelManager::is_dragging_panel() const { 199 bool PanelManager::is_dragging_panel() const {
207 return panel_strip_->is_dragging_panel(); 200 return panel_strip_->is_dragging_panel();
208 } 201 }
209 202
210 const PanelManager::Panels& PanelManager::panels() const { 203 const PanelManager::Panels& PanelManager::panels() const {
211 return panel_strip_->panels(); 204 return panel_strip_->panels();
212 } 205 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698