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

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

Issue 8505047: Fix panels being removed from PanelManager prematurely. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Unit test. Created 9 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 29 matching lines...) Expand all
40 restored_height_(bounds.height()) { 40 restored_height_(bounds.height()) {
41 native_panel_ = CreateNativePanel(browser, this, bounds); 41 native_panel_ = CreateNativePanel(browser, this, bounds);
42 42
43 registrar_.Add(this, 43 registrar_.Add(this,
44 content::NOTIFICATION_TAB_ADDED, 44 content::NOTIFICATION_TAB_ADDED,
45 content::Source<TabContentsDelegate>(browser)); 45 content::Source<TabContentsDelegate>(browser));
46 } 46 }
47 47
48 Panel::~Panel() { 48 Panel::~Panel() {
49 // Invoked by native panel so do not access native_panel_ here. 49 // Invoked by native panel so do not access native_panel_ here.
50 content::NotificationService::current()->Notify(
51 chrome::NOTIFICATION_PANEL_DELETED,
52 content::Source<Panel>(this),
53 content::NotificationService::NoDetails());
50 } 54 }
51 55
52 PanelManager* Panel::manager() const { 56 PanelManager* Panel::manager() const {
53 return PanelManager::GetInstance(); 57 return PanelManager::GetInstance();
54 } 58 }
55 59
56 60
57 const Extension* Panel::GetExtension() const { 61 const Extension* Panel::GetExtension() const {
58 return GetExtensionFromBrowser(browser()); 62 return GetExtensionFromBrowser(browser());
59 } 63 }
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 165
162 void Panel::SetBounds(const gfx::Rect& bounds) { 166 void Panel::SetBounds(const gfx::Rect& bounds) {
163 // Ignore any SetBounds requests since the bounds are completely controlled 167 // Ignore any SetBounds requests since the bounds are completely controlled
164 // by panel manager. 168 // by panel manager.
165 } 169 }
166 170
167 // Close() may be called multiple times if the browser window is not ready to 171 // Close() may be called multiple times if the browser window is not ready to
168 // close on the first attempt. 172 // close on the first attempt.
169 void Panel::Close() { 173 void Panel::Close() {
170 native_panel_->ClosePanel(); 174 native_panel_->ClosePanel();
171
172 // TODO(dimich): Only implemented fully async on Mac. Need to update other
173 // platforms. The panel should be removed from PanelManager when and if it
174 // was actually closed. The closing can be cancelled because of onbeforeunload
175 // handler on the web page. http://crbug.com/102720
176 #if !defined(OS_MACOSX)
177 manager()->Remove(this);
178 #endif
179 } 175 }
180 176
181 void Panel::Activate() { 177 void Panel::Activate() {
182 // Make sure the panel is expanded when activated programmatically, 178 // Make sure the panel is expanded when activated programmatically,
183 // so the user input does not go into collapsed window. 179 // so the user input does not go into collapsed window.
184 SetExpansionState(Panel::EXPANDED); 180 SetExpansionState(Panel::EXPANDED);
185 native_panel_->ActivatePanel(); 181 native_panel_->ActivatePanel();
186 } 182 }
187 183
188 void Panel::Deactivate() { 184 void Panel::Deactivate() {
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 RequestRenderViewHostToDisableScrollbars(GetRenderViewHost()); 589 RequestRenderViewHostToDisableScrollbars(GetRenderViewHost());
594 } 590 }
595 591
596 Browser* Panel::browser() const { 592 Browser* Panel::browser() const {
597 return native_panel_->GetPanelBrowser(); 593 return native_panel_->GetPanelBrowser();
598 } 594 }
599 595
600 void Panel::DestroyBrowser() { 596 void Panel::DestroyBrowser() {
601 native_panel_->DestroyPanelBrowser(); 597 native_panel_->DestroyPanelBrowser();
602 } 598 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/panels/panel_browser_view.cc » ('j') | chrome/browser/ui/panels/panel_browsertest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698