| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 Panel::Panel(Browser* browser, const gfx::Size& requested_size) | 46 Panel::Panel(Browser* browser, const gfx::Size& requested_size) |
| 47 : browser_(browser), | 47 : browser_(browser), |
| 48 panel_strip_(NULL), | 48 panel_strip_(NULL), |
| 49 initialized_(false), | 49 initialized_(false), |
| 50 has_temporary_layout_(false), | 50 has_temporary_layout_(false), |
| 51 restored_size_(requested_size), | 51 restored_size_(requested_size), |
| 52 auto_resizable_(false), | 52 auto_resizable_(false), |
| 53 always_on_top_(false), | 53 always_on_top_(false), |
| 54 in_preview_mode_(false), | 54 in_preview_mode_(false), |
| 55 expansion_state_(EXPANDED), | 55 expansion_state_(EXPANDED) { |
| 56 old_expansion_state_(EXPANDED) { | |
| 57 } | 56 } |
| 58 | 57 |
| 59 Panel::~Panel() { | 58 Panel::~Panel() { |
| 60 // Invoked by native panel destructor. Do not access native_panel_ here. | 59 // Invoked by native panel destructor. Do not access native_panel_ here. |
| 61 } | 60 } |
| 62 | 61 |
| 63 void Panel::Initialize(const gfx::Rect& bounds) { | 62 void Panel::Initialize(const gfx::Rect& bounds) { |
| 64 DCHECK(!initialized_); | 63 DCHECK(!initialized_); |
| 65 DCHECK(!bounds.IsEmpty()); | 64 DCHECK(!bounds.IsEmpty()); |
| 66 initialized_ = true; | 65 initialized_ = true; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 | 170 |
| 172 void Panel::SetPanelStrip(PanelStrip* new_strip) { | 171 void Panel::SetPanelStrip(PanelStrip* new_strip) { |
| 173 panel_strip_ = new_strip; | 172 panel_strip_ = new_strip; |
| 174 if (panel_strip_ != NULL && initialized_) | 173 if (panel_strip_ != NULL && initialized_) |
| 175 native_panel_->PreventActivationByOS(panel_strip_->IsPanelMinimized(this)); | 174 native_panel_->PreventActivationByOS(panel_strip_->IsPanelMinimized(this)); |
| 176 } | 175 } |
| 177 | 176 |
| 178 void Panel::SetExpansionState(ExpansionState new_state) { | 177 void Panel::SetExpansionState(ExpansionState new_state) { |
| 179 if (expansion_state_ == new_state) | 178 if (expansion_state_ == new_state) |
| 180 return; | 179 return; |
| 181 old_expansion_state_ = expansion_state_; | |
| 182 expansion_state_ = new_state; | 180 expansion_state_ = new_state; |
| 183 | 181 |
| 184 manager()->OnPanelExpansionStateChanged(this); | 182 manager()->OnPanelExpansionStateChanged(this); |
| 185 | 183 |
| 186 // The minimized panel should not get the focus. | 184 // The minimized panel should not get the focus. |
| 187 if (expansion_state_ == MINIMIZED) | 185 if (expansion_state_ == MINIMIZED) |
| 188 Deactivate(); | 186 Deactivate(); |
| 189 | 187 |
| 190 DCHECK(initialized_ && panel_strip_ != NULL); | 188 DCHECK(initialized_ && panel_strip_ != NULL); |
| 191 native_panel_->PreventActivationByOS(panel_strip_->IsPanelMinimized(this)); | 189 native_panel_->PreventActivationByOS(panel_strip_->IsPanelMinimized(this)); |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 703 native_panel_->ContentSizeFromWindowSize(max_size_)); | 701 native_panel_->ContentSizeFromWindowSize(max_size_)); |
| 704 } | 702 } |
| 705 | 703 |
| 706 void Panel::OnWindowSizeAvailable() { | 704 void Panel::OnWindowSizeAvailable() { |
| 707 ConfigureAutoResize(browser()->GetSelectedWebContents()); | 705 ConfigureAutoResize(browser()->GetSelectedWebContents()); |
| 708 } | 706 } |
| 709 | 707 |
| 710 void Panel::DestroyBrowser() { | 708 void Panel::DestroyBrowser() { |
| 711 native_panel_->DestroyPanelBrowser(); | 709 native_panel_->DestroyPanelBrowser(); |
| 712 } | 710 } |
| OLD | NEW |