Chromium Code Reviews

Side by Side Diff: chrome/browser/gtk/infobar_container_gtk.cc

Issue 62104: Destroy the GTK info bar container widget when the object is destroyed. (Closed)
Patch Set: Created 11 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/gtk/infobar_container_gtk.h" 5 #include "chrome/browser/gtk/infobar_container_gtk.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include "base/gfx/gtk_util.h" 9 #include "base/gfx/gtk_util.h"
10 #include "chrome/browser/browser_window.h" 10 #include "chrome/browser/browser_window.h"
(...skipping 28 matching lines...)
39 InfoBarContainerGtk::InfoBarContainerGtk(BrowserWindow* browser_window) 39 InfoBarContainerGtk::InfoBarContainerGtk(BrowserWindow* browser_window)
40 : browser_window_(browser_window), 40 : browser_window_(browser_window),
41 tab_contents_(NULL), 41 tab_contents_(NULL),
42 container_(gtk_vbox_new(FALSE, 0)) { 42 container_(gtk_vbox_new(FALSE, 0)) {
43 gtk_widget_show(container_.get()); 43 gtk_widget_show(container_.get());
44 } 44 }
45 45
46 InfoBarContainerGtk::~InfoBarContainerGtk() { 46 InfoBarContainerGtk::~InfoBarContainerGtk() {
47 browser_window_ = NULL; 47 browser_window_ = NULL;
48 ChangeTabContents(NULL); 48 ChangeTabContents(NULL);
49
50 container_.Destroy();
49 } 51 }
50 52
51 void InfoBarContainerGtk::ChangeTabContents(TabContents* contents) { 53 void InfoBarContainerGtk::ChangeTabContents(TabContents* contents) {
52 if (tab_contents_) { 54 if (tab_contents_) {
53 NotificationService::current()->RemoveObserver( 55 NotificationService::current()->RemoveObserver(
54 this, NotificationType::TAB_CONTENTS_INFOBAR_ADDED, 56 this, NotificationType::TAB_CONTENTS_INFOBAR_ADDED,
55 Source<TabContents>(tab_contents_)); 57 Source<TabContents>(tab_contents_));
56 NotificationService::current()->RemoveObserver( 58 NotificationService::current()->RemoveObserver(
57 this, NotificationType::TAB_CONTENTS_INFOBAR_REMOVED, 59 this, NotificationType::TAB_CONTENTS_INFOBAR_REMOVED,
58 Source<TabContents>(tab_contents_)); 60 Source<TabContents>(tab_contents_));
(...skipping 50 matching lines...)
109 else 111 else
110 infobar->Open(); 112 infobar->Open();
111 } 113 }
112 114
113 void InfoBarContainerGtk::RemoveInfoBar(InfoBarDelegate* delegate) { 115 void InfoBarContainerGtk::RemoveInfoBar(InfoBarDelegate* delegate) {
114 RemoveInfoBarData remove_info_bar_data = { container_.get(), delegate }; 116 RemoveInfoBarData remove_info_bar_data = { container_.get(), delegate };
115 117
116 gtk_container_foreach(GTK_CONTAINER(container_.get()), 118 gtk_container_foreach(GTK_CONTAINER(container_.get()),
117 AnimateClosingForDelegate, &remove_info_bar_data); 119 AnimateClosingForDelegate, &remove_info_bar_data);
118 } 120 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine