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), | 53 old_expansion_state_(EXPANDED) { |
54 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()); |
64 initialized_ = true; | 63 initialized_ = true; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 | 135 |
137 DCHECK(min_size.width() <= max_size.width()); | 136 DCHECK(min_size.width() <= max_size.width()); |
138 DCHECK(min_size.height() <= max_size.height()); | 137 DCHECK(min_size.height() <= max_size.height()); |
139 min_size_ = min_size; | 138 min_size_ = min_size; |
140 max_size_ = max_size; | 139 max_size_ = max_size; |
141 | 140 |
142 ConfigureAutoResize(browser()->GetSelectedWebContents()); | 141 ConfigureAutoResize(browser()->GetSelectedWebContents()); |
143 } | 142 } |
144 | 143 |
145 void Panel::SetAppIconVisibility(bool visible) { | 144 void Panel::SetAppIconVisibility(bool visible) { |
146 if (app_icon_visible_ == visible) | |
147 return; | |
148 app_icon_visible_ = visible; | |
149 native_panel_->SetPanelAppIconVisibility(visible); | 145 native_panel_->SetPanelAppIconVisibility(visible); |
150 } | 146 } |
151 | 147 |
| 148 void Panel::SetAlwaysOnTop(bool on_top) { |
| 149 native_panel_->SetPanelAlwaysOnTop(on_top); |
| 150 } |
| 151 |
152 void Panel::MoveToStrip(PanelStrip* new_strip) { | 152 void Panel::MoveToStrip(PanelStrip* new_strip) { |
153 DCHECK_NE(panel_strip_, new_strip); | 153 DCHECK_NE(panel_strip_, new_strip); |
154 if (panel_strip_) | 154 if (panel_strip_) |
155 panel_strip_->RemovePanel(this); | 155 panel_strip_->RemovePanel(this); |
156 | 156 |
157 panel_strip_ = new_strip; | 157 panel_strip_ = new_strip; |
158 panel_strip_->AddPanel(this); | 158 panel_strip_->AddPanel(this); |
159 | 159 |
160 content::NotificationService::current()->Notify( | 160 content::NotificationService::current()->Notify( |
161 chrome::NOTIFICATION_PANEL_CHANGED_LAYOUT_MODE, | 161 chrome::NOTIFICATION_PANEL_CHANGED_LAYOUT_MODE, |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 native_panel_->ContentSizeFromWindowSize(max_size_)); | 685 native_panel_->ContentSizeFromWindowSize(max_size_)); |
686 } | 686 } |
687 | 687 |
688 void Panel::OnWindowSizeAvailable() { | 688 void Panel::OnWindowSizeAvailable() { |
689 ConfigureAutoResize(browser()->GetSelectedWebContents()); | 689 ConfigureAutoResize(browser()->GetSelectedWebContents()); |
690 } | 690 } |
691 | 691 |
692 void Panel::DestroyBrowser() { | 692 void Panel::DestroyBrowser() { |
693 native_panel_->DestroyPanelBrowser(); | 693 native_panel_->DestroyPanelBrowser(); |
694 } | 694 } |
OLD | NEW |