| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 if (height < min_size.height()) | 180 if (height < min_size.height()) |
| 181 height = min_size.height(); | 181 height = min_size.height(); |
| 182 else if (height > max_size.height()) | 182 else if (height > max_size.height()) |
| 183 height = max_size.height(); | 183 height = max_size.height(); |
| 184 | 184 |
| 185 gfx::Rect bounds(width, height); | 185 gfx::Rect bounds(width, height); |
| 186 if (CREATE_AS_DOCKED == mode) { | 186 if (CREATE_AS_DOCKED == mode) { |
| 187 bounds.set_origin(docked_strip_->GetDefaultPositionForPanel(bounds.size())); | 187 bounds.set_origin(docked_strip_->GetDefaultPositionForPanel(bounds.size())); |
| 188 } else { | 188 } else { |
| 189 bounds.set_origin(requested_bounds.origin()); | 189 bounds.set_origin(requested_bounds.origin()); |
| 190 bounds = bounds.AdjustToFit(display_settings_provider_->GetDisplayArea()); | 190 bounds.AdjustToFit(display_settings_provider_->GetDisplayArea()); |
| 191 } | 191 } |
| 192 | 192 |
| 193 // Create the panel. | 193 // Create the panel. |
| 194 Panel* panel = new Panel(app_name, min_size, max_size); | 194 Panel* panel = new Panel(app_name, min_size, max_size); |
| 195 panel->Initialize(profile, url, bounds); | 195 panel->Initialize(profile, url, bounds); |
| 196 | 196 |
| 197 // Auto resizable feature is enabled only if no initial size is requested. | 197 // Auto resizable feature is enabled only if no initial size is requested. |
| 198 if (auto_sizing_enabled() && requested_bounds.width() == 0 && | 198 if (auto_sizing_enabled() && requested_bounds.width() == 0 && |
| 199 requested_bounds.height() == 0) { | 199 requested_bounds.height() == 0) { |
| 200 panel->SetAutoResizable(true); | 200 panel->SetAutoResizable(true); |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 void PanelManager::SetMouseWatcher(PanelMouseWatcher* watcher) { | 339 void PanelManager::SetMouseWatcher(PanelMouseWatcher* watcher) { |
| 340 panel_mouse_watcher_.reset(watcher); | 340 panel_mouse_watcher_.reset(watcher); |
| 341 } | 341 } |
| 342 | 342 |
| 343 void PanelManager::OnPanelAnimationEnded(Panel* panel) { | 343 void PanelManager::OnPanelAnimationEnded(Panel* panel) { |
| 344 content::NotificationService::current()->Notify( | 344 content::NotificationService::current()->Notify( |
| 345 chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED, | 345 chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED, |
| 346 content::Source<Panel>(panel), | 346 content::Source<Panel>(panel), |
| 347 content::NotificationService::NoDetails()); | 347 content::NotificationService::NoDetails()); |
| 348 } | 348 } |
| OLD | NEW |