| 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.h" | 5 #include "chrome/browser/ui/panels/panel.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "chrome/browser/ui/panels/docked_panel_strip.h" | 9 #include "chrome/browser/ui/panels/docked_panel_strip.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 // * cannot grow or shrink to go beyond [min_height, max_height] | 150 // * cannot grow or shrink to go beyond [min_height, max_height] |
| 151 int new_height = size.height(); | 151 int new_height = size.height(); |
| 152 if (new_height > max_size_.height()) | 152 if (new_height > max_size_.height()) |
| 153 new_height = max_size_.height(); | 153 new_height = max_size_.height(); |
| 154 if (new_height < min_size_.height()) | 154 if (new_height < min_size_.height()) |
| 155 new_height = min_size_.height(); | 155 new_height = min_size_.height(); |
| 156 | 156 |
| 157 return gfx::Size(new_width, new_height); | 157 return gfx::Size(new_width, new_height); |
| 158 } | 158 } |
| 159 | 159 |
| 160 | |
| 161 void Panel::SetAppIconVisibility(bool visible) { | |
| 162 native_panel_->SetPanelAppIconVisibility(visible); | |
| 163 } | |
| 164 | |
| 165 void Panel::SetAlwaysOnTop(bool on_top) { | 160 void Panel::SetAlwaysOnTop(bool on_top) { |
| 166 if (always_on_top_ == on_top) | 161 if (always_on_top_ == on_top) |
| 167 return; | 162 return; |
| 168 always_on_top_ = on_top; | 163 always_on_top_ = on_top; |
| 169 native_panel_->SetPanelAlwaysOnTop(on_top); | 164 native_panel_->SetPanelAlwaysOnTop(on_top); |
| 170 } | 165 } |
| 171 | 166 |
| 172 void Panel::EnableResizeByMouse(bool enable) { | 167 void Panel::EnableResizeByMouse(bool enable) { |
| 173 DCHECK(native_panel_); | 168 DCHECK(native_panel_); |
| 174 native_panel_->EnableResizeByMouse(enable); | 169 native_panel_->EnableResizeByMouse(enable); |
| 175 } | 170 } |
| 176 | 171 |
| 172 void Panel::UpdateMinimizeRestoreButtonVisibility() { |
| 173 native_panel_->UpdatePanelMinimizeRestoreButtonVisibility(); |
| 174 } |
| 175 |
| 177 void Panel::SetPreviewMode(bool in_preview) { | 176 void Panel::SetPreviewMode(bool in_preview) { |
| 178 DCHECK_NE(in_preview_mode_, in_preview); | 177 DCHECK_NE(in_preview_mode_, in_preview); |
| 179 in_preview_mode_ = in_preview; | 178 in_preview_mode_ = in_preview; |
| 180 } | 179 } |
| 181 | 180 |
| 182 void Panel::SetPanelStrip(PanelStrip* new_strip) { | |
| 183 panel_strip_ = new_strip; | |
| 184 if (panel_strip_ != NULL && initialized_) | |
| 185 native_panel_->PreventActivationByOS(panel_strip_->IsPanelMinimized(this)); | |
| 186 } | |
| 187 | |
| 188 void Panel::SetExpansionState(ExpansionState new_state) { | 181 void Panel::SetExpansionState(ExpansionState new_state) { |
| 189 if (expansion_state_ == new_state) | 182 if (expansion_state_ == new_state) |
| 190 return; | 183 return; |
| 191 expansion_state_ = new_state; | 184 expansion_state_ = new_state; |
| 192 | 185 |
| 193 manager()->OnPanelExpansionStateChanged(this); | 186 manager()->OnPanelExpansionStateChanged(this); |
| 194 | 187 |
| 195 DCHECK(initialized_ && panel_strip_ != NULL); | 188 DCHECK(initialized_ && panel_strip_ != NULL); |
| 196 native_panel_->PreventActivationByOS(panel_strip_->IsPanelMinimized(this)); | 189 native_panel_->PreventActivationByOS(panel_strip_->IsPanelMinimized(this)); |
| 190 UpdateMinimizeRestoreButtonVisibility(); |
| 197 | 191 |
| 198 content::NotificationService::current()->Notify( | 192 content::NotificationService::current()->Notify( |
| 199 chrome::NOTIFICATION_PANEL_CHANGED_EXPANSION_STATE, | 193 chrome::NOTIFICATION_PANEL_CHANGED_EXPANSION_STATE, |
| 200 content::Source<Panel>(this), | 194 content::Source<Panel>(this), |
| 201 content::NotificationService::NoDetails()); | 195 content::NotificationService::NoDetails()); |
| 202 } | 196 } |
| 203 | 197 |
| 204 bool Panel::IsDrawingAttention() const { | 198 bool Panel::IsDrawingAttention() const { |
| 205 return native_panel_->IsDrawingAttention(); | 199 return native_panel_->IsDrawingAttention(); |
| 206 } | 200 } |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 763 | 757 |
| 764 if (modifier == panel::APPLY_TO_ALL) | 758 if (modifier == panel::APPLY_TO_ALL) |
| 765 panel_strip_->RestoreAll(); | 759 panel_strip_->RestoreAll(); |
| 766 else | 760 else |
| 767 Restore(); | 761 Restore(); |
| 768 } | 762 } |
| 769 | 763 |
| 770 void Panel::DestroyBrowser() { | 764 void Panel::DestroyBrowser() { |
| 771 native_panel_->DestroyPanelBrowser(); | 765 native_panel_->DestroyPanelBrowser(); |
| 772 } | 766 } |
| OLD | NEW |