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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 } | 150 } |
151 | 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 native_panel_->PreventActivationByOS(panel_strip_->TreatAllPanelsAsMinimized() |
| 161 || expansion_state_ != EXPANDED); |
| 162 |
160 content::NotificationService::current()->Notify( | 163 content::NotificationService::current()->Notify( |
161 chrome::NOTIFICATION_PANEL_CHANGED_LAYOUT_MODE, | 164 chrome::NOTIFICATION_PANEL_CHANGED_LAYOUT_MODE, |
162 content::Source<Panel>(this), | 165 content::Source<Panel>(this), |
163 content::NotificationService::NoDetails()); | 166 content::NotificationService::NoDetails()); |
164 } | 167 } |
165 | 168 |
166 void Panel::SetExpansionState(ExpansionState new_state) { | 169 void Panel::SetExpansionState(ExpansionState new_state) { |
167 if (expansion_state_ == new_state) | 170 if (expansion_state_ == new_state) |
168 return; | 171 return; |
169 old_expansion_state_ = expansion_state_; | 172 old_expansion_state_ = expansion_state_; |
170 expansion_state_ = new_state; | 173 expansion_state_ = new_state; |
171 | 174 |
172 manager()->OnPanelExpansionStateChanged(this); | 175 manager()->OnPanelExpansionStateChanged(this); |
173 | 176 |
174 // The minimized panel should not get the focus. | 177 // The minimized panel should not get the focus. |
175 if (expansion_state_ == MINIMIZED) | 178 if (expansion_state_ == MINIMIZED) |
176 Deactivate(); | 179 Deactivate(); |
177 | 180 |
| 181 native_panel_->PreventActivationByOS(panel_strip_->TreatAllPanelsAsMinimized() |
| 182 || expansion_state_ != EXPANDED); |
| 183 |
178 content::NotificationService::current()->Notify( | 184 content::NotificationService::current()->Notify( |
179 chrome::NOTIFICATION_PANEL_CHANGED_EXPANSION_STATE, | 185 chrome::NOTIFICATION_PANEL_CHANGED_EXPANSION_STATE, |
180 content::Source<Panel>(this), | 186 content::Source<Panel>(this), |
181 content::NotificationService::NoDetails()); | 187 content::NotificationService::NoDetails()); |
182 } | 188 } |
183 | 189 |
184 bool Panel::IsDrawingAttention() const { | 190 bool Panel::IsDrawingAttention() const { |
185 return native_panel_->IsDrawingAttention(); | 191 return native_panel_->IsDrawingAttention(); |
186 } | 192 } |
187 | 193 |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 native_panel_->ContentSizeFromWindowSize(max_size_)); | 691 native_panel_->ContentSizeFromWindowSize(max_size_)); |
686 } | 692 } |
687 | 693 |
688 void Panel::OnWindowSizeAvailable() { | 694 void Panel::OnWindowSizeAvailable() { |
689 ConfigureAutoResize(browser()->GetSelectedWebContents()); | 695 ConfigureAutoResize(browser()->GetSelectedWebContents()); |
690 } | 696 } |
691 | 697 |
692 void Panel::DestroyBrowser() { | 698 void Panel::DestroyBrowser() { |
693 native_panel_->DestroyPanelBrowser(); | 699 native_panel_->DestroyPanelBrowser(); |
694 } | 700 } |
OLD | NEW |