Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: chrome/browser/ui/panels/panel.cc

Issue 9463022: Minimized panels should not open on Windows when activated by the OS (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: merged with the cleanup patch Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 56
57 Panel::~Panel() { 57 Panel::~Panel() {
58 // Invoked by native panel destructor. Do not access native_panel_ here. 58 // Invoked by native panel destructor. Do not access native_panel_ here.
59 } 59 }
60 60
61 void Panel::Initialize(const gfx::Rect& bounds) { 61 void Panel::Initialize(const gfx::Rect& bounds) {
62 DCHECK(!initialized_); 62 DCHECK(!initialized_);
63 DCHECK(!bounds.IsEmpty()); 63 DCHECK(!bounds.IsEmpty());
64 initialized_ = true; 64 initialized_ = true;
65 native_panel_ = CreateNativePanel(browser_, this, bounds); 65 native_panel_ = CreateNativePanel(browser_, this, bounds);
66 if (panel_strip_ != NULL)
67 native_panel_->PreventActivationByOS(panel_strip_->IsPanelMinimized(this));
66 } 68 }
67 69
68 void Panel::OnNativePanelClosed() { 70 void Panel::OnNativePanelClosed() {
69 if (auto_resizable_) 71 if (auto_resizable_)
70 native_panel_->GetPanelBrowser()->tabstrip_model()->RemoveObserver(this); 72 native_panel_->GetPanelBrowser()->tabstrip_model()->RemoveObserver(this);
71 manager()->OnPanelClosed(this); 73 manager()->OnPanelClosed(this);
72 DCHECK(!panel_strip_); 74 DCHECK(!panel_strip_);
73 } 75 }
74 76
75 PanelManager* Panel::manager() const { 77 PanelManager* Panel::manager() const {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 ConfigureAutoResize(browser()->GetSelectedWebContents()); 151 ConfigureAutoResize(browser()->GetSelectedWebContents());
150 } 152 }
151 153
152 void Panel::SetAppIconVisibility(bool visible) { 154 void Panel::SetAppIconVisibility(bool visible) {
153 if (app_icon_visible_ == visible) 155 if (app_icon_visible_ == visible)
154 return; 156 return;
155 app_icon_visible_ = visible; 157 app_icon_visible_ = visible;
156 native_panel_->SetPanelAppIconVisibility(visible); 158 native_panel_->SetPanelAppIconVisibility(visible);
157 } 159 }
158 160
161 void Panel::set_panel_strip(PanelStrip* new_strip) {
162 panel_strip_ = new_strip;
163 if (panel_strip_ != NULL && initialized_)
164 native_panel_->PreventActivationByOS(panel_strip_->IsPanelMinimized(this));
jennb 2012/03/06 21:56:44 This makes more sense in AddPanel where the panel
165 }
166
159 void Panel::SetExpansionState(ExpansionState new_state) { 167 void Panel::SetExpansionState(ExpansionState new_state) {
160 if (expansion_state_ == new_state) 168 if (expansion_state_ == new_state)
161 return; 169 return;
162 old_expansion_state_ = expansion_state_; 170 old_expansion_state_ = expansion_state_;
163 expansion_state_ = new_state; 171 expansion_state_ = new_state;
164 172
165 manager()->OnPanelExpansionStateChanged(this); 173 manager()->OnPanelExpansionStateChanged(this);
166 174
167 // The minimized panel should not get the focus. 175 // The minimized panel should not get the focus.
168 if (expansion_state_ == MINIMIZED) 176 if (expansion_state_ == MINIMIZED)
169 Deactivate(); 177 Deactivate();
170 178
179 DCHECK(initialized_ && panel_strip_ != NULL);
jennb 2012/03/06 21:56:44 Move this to the beginning of the method? Both the
180 native_panel_->PreventActivationByOS(panel_strip_->IsPanelMinimized(this));
181
171 content::NotificationService::current()->Notify( 182 content::NotificationService::current()->Notify(
172 chrome::NOTIFICATION_PANEL_CHANGED_EXPANSION_STATE, 183 chrome::NOTIFICATION_PANEL_CHANGED_EXPANSION_STATE,
173 content::Source<Panel>(this), 184 content::Source<Panel>(this),
174 content::NotificationService::NoDetails()); 185 content::NotificationService::NoDetails());
175 } 186 }
176 187
177 bool Panel::IsDrawingAttention() const { 188 bool Panel::IsDrawingAttention() const {
178 return native_panel_->IsDrawingAttention(); 189 return native_panel_->IsDrawingAttention();
179 } 190 }
180 191
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 native_panel_->ContentSizeFromWindowSize(max_size_)); 688 native_panel_->ContentSizeFromWindowSize(max_size_));
678 } 689 }
679 690
680 void Panel::OnWindowSizeAvailable() { 691 void Panel::OnWindowSizeAvailable() {
681 ConfigureAutoResize(browser()->GetSelectedWebContents()); 692 ConfigureAutoResize(browser()->GetSelectedWebContents());
682 } 693 }
683 694
684 void Panel::DestroyBrowser() { 695 void Panel::DestroyBrowser() {
685 native_panel_->DestroyPanelBrowser(); 696 native_panel_->DestroyPanelBrowser();
686 } 697 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698