| 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 "chrome/browser/extensions/extension_prefs.h" | 8 #include "chrome/browser/extensions/extension_prefs.h" |
| 9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 } | 43 } |
| 44 | 44 |
| 45 Panel::Panel(Browser* browser, const gfx::Size& requested_size) | 45 Panel::Panel(Browser* browser, const gfx::Size& requested_size) |
| 46 : browser_(browser), | 46 : browser_(browser), |
| 47 panel_strip_(NULL), | 47 panel_strip_(NULL), |
| 48 initialized_(false), | 48 initialized_(false), |
| 49 has_temporary_layout_(false), | 49 has_temporary_layout_(false), |
| 50 restored_size_(requested_size), | 50 restored_size_(requested_size), |
| 51 auto_resizable_(false), | 51 auto_resizable_(false), |
| 52 expansion_state_(EXPANDED), | 52 expansion_state_(EXPANDED), |
| 53 old_expansion_state_(EXPANDED), | |
| 54 app_icon_visible_(true) { | 53 app_icon_visible_(true) { |
| 55 } | 54 } |
| 56 | 55 |
| 57 Panel::~Panel() { | 56 Panel::~Panel() { |
| 58 // Invoked by native panel destructor. Do not access native_panel_ here. | 57 // Invoked by native panel destructor. Do not access native_panel_ here. |
| 59 } | 58 } |
| 60 | 59 |
| 61 void Panel::Initialize(const gfx::Rect& bounds) { | 60 void Panel::Initialize(const gfx::Rect& bounds) { |
| 62 DCHECK(!initialized_); | 61 DCHECK(!initialized_); |
| 63 DCHECK(!bounds.IsEmpty()); | 62 DCHECK(!bounds.IsEmpty()); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 void Panel::SetAppIconVisibility(bool visible) { | 151 void Panel::SetAppIconVisibility(bool visible) { |
| 153 if (app_icon_visible_ == visible) | 152 if (app_icon_visible_ == visible) |
| 154 return; | 153 return; |
| 155 app_icon_visible_ = visible; | 154 app_icon_visible_ = visible; |
| 156 native_panel_->SetPanelAppIconVisibility(visible); | 155 native_panel_->SetPanelAppIconVisibility(visible); |
| 157 } | 156 } |
| 158 | 157 |
| 159 void Panel::SetExpansionState(ExpansionState new_state) { | 158 void Panel::SetExpansionState(ExpansionState new_state) { |
| 160 if (expansion_state_ == new_state) | 159 if (expansion_state_ == new_state) |
| 161 return; | 160 return; |
| 162 old_expansion_state_ = expansion_state_; | |
| 163 expansion_state_ = new_state; | 161 expansion_state_ = new_state; |
| 164 | 162 |
| 165 manager()->OnPanelExpansionStateChanged(this); | 163 manager()->OnPanelExpansionStateChanged(this); |
| 166 | 164 |
| 167 // The minimized panel should not get the focus. | 165 // The minimized panel should not get the focus. |
| 168 if (expansion_state_ == MINIMIZED) | 166 if (expansion_state_ == MINIMIZED) |
| 169 Deactivate(); | 167 Deactivate(); |
| 170 | 168 |
| 171 content::NotificationService::current()->Notify( | 169 content::NotificationService::current()->Notify( |
| 172 chrome::NOTIFICATION_PANEL_CHANGED_EXPANSION_STATE, | 170 chrome::NOTIFICATION_PANEL_CHANGED_EXPANSION_STATE, |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 native_panel_->ContentSizeFromWindowSize(max_size_)); | 675 native_panel_->ContentSizeFromWindowSize(max_size_)); |
| 678 } | 676 } |
| 679 | 677 |
| 680 void Panel::OnWindowSizeAvailable() { | 678 void Panel::OnWindowSizeAvailable() { |
| 681 ConfigureAutoResize(browser()->GetSelectedWebContents()); | 679 ConfigureAutoResize(browser()->GetSelectedWebContents()); |
| 682 } | 680 } |
| 683 | 681 |
| 684 void Panel::DestroyBrowser() { | 682 void Panel::DestroyBrowser() { |
| 685 native_panel_->DestroyPanelBrowser(); | 683 native_panel_->DestroyPanelBrowser(); |
| 686 } | 684 } |
| OLD | NEW |