Chromium Code Reviews| 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/detached_panel_collection.h" | 5 #include "chrome/browser/ui/panels/detached_panel_collection.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "chrome/browser/ui/panels/panel_drag_controller.h" | 9 #include "chrome/browser/ui/panels/panel_drag_controller.h" |
| 10 #include "chrome/browser/ui/panels/panel_manager.h" | 10 #include "chrome/browser/ui/panels/panel_manager.h" |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 197 bool DetachedPanelCollection::HasPanel(Panel* panel) const { | 197 bool DetachedPanelCollection::HasPanel(Panel* panel) const { |
| 198 return panels_.find(panel) != panels_.end(); | 198 return panels_.find(panel) != panels_.end(); |
| 199 } | 199 } |
| 200 | 200 |
| 201 void DetachedPanelCollection::UpdatePanelOnCollectionChange(Panel* panel) { | 201 void DetachedPanelCollection::UpdatePanelOnCollectionChange(Panel* panel) { |
| 202 panel->set_attention_mode( | 202 panel->set_attention_mode( |
| 203 static_cast<Panel::AttentionMode>(Panel::USE_PANEL_ATTENTION | | 203 static_cast<Panel::AttentionMode>(Panel::USE_PANEL_ATTENTION | |
| 204 Panel::USE_SYSTEM_ATTENTION)); | 204 Panel::USE_SYSTEM_ATTENTION)); |
| 205 panel->SetAlwaysOnTop(false); | 205 panel->SetAlwaysOnTop(false); |
| 206 panel->EnableResizeByMouse(true); | 206 panel->EnableResizeByMouse(true); |
| 207 panel->UpdateMinimizeRestoreButtonVisibility(); | 207 panel->UpdateMinimizeRestoreButtonVisibility(); |
|
Dmitry Titov
2013/01/10 00:16:24
This is where I would add a new method on Panel, U
jianli
2013/01/10 02:05:37
Changed to adding new method OnCollectionChanged()
| |
| 208 panel->UpdateStackingProperty(); | |
| 208 } | 209 } |
| 209 | 210 |
| 210 void DetachedPanelCollection::OnPanelActiveStateChanged(Panel* panel) { | 211 void DetachedPanelCollection::OnPanelActiveStateChanged(Panel* panel) { |
| 211 } | 212 } |
| 212 | 213 |
| 213 gfx::Point DetachedPanelCollection::GetDefaultPanelOrigin() { | 214 gfx::Point DetachedPanelCollection::GetDefaultPanelOrigin() { |
| 214 if (!default_panel_origin_.x() && !default_panel_origin_.y()) { | 215 if (!default_panel_origin_.x() && !default_panel_origin_.y()) { |
| 215 gfx::Rect display_area = | 216 gfx::Rect display_area = |
| 216 panel_manager_->display_settings_provider()->GetDisplayArea(); | 217 panel_manager_->display_settings_provider()->GetDisplayArea(); |
| 217 default_panel_origin_.SetPoint(kPanelTilePixels + display_area.x(), | 218 default_panel_origin_.SetPoint(kPanelTilePixels + display_area.x(), |
| 218 kPanelTilePixels + display_area.y()); | 219 kPanelTilePixels + display_area.y()); |
| 219 } | 220 } |
| 220 return default_panel_origin_; | 221 return default_panel_origin_; |
| 221 } | 222 } |
| 222 | 223 |
| 223 void DetachedPanelCollection::ComputeNextDefaultPanelOrigin() { | 224 void DetachedPanelCollection::ComputeNextDefaultPanelOrigin() { |
| 224 default_panel_origin_.Offset(kPanelTilePixels, kPanelTilePixels); | 225 default_panel_origin_.Offset(kPanelTilePixels, kPanelTilePixels); |
| 225 gfx::Rect display_area = | 226 gfx::Rect display_area = |
| 226 panel_manager_->display_settings_provider()->GetDisplayArea(); | 227 panel_manager_->display_settings_provider()->GetDisplayArea(); |
| 227 if (!display_area.Contains(default_panel_origin_)) { | 228 if (!display_area.Contains(default_panel_origin_)) { |
| 228 default_panel_origin_.SetPoint(kPanelTilePixels + display_area.x(), | 229 default_panel_origin_.SetPoint(kPanelTilePixels + display_area.x(), |
| 229 kPanelTilePixels + display_area.y()); | 230 kPanelTilePixels + display_area.y()); |
| 230 } | 231 } |
| 231 } | 232 } |
| OLD | NEW |