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

Side by Side Diff: chrome/browser/gtk/tabs/tab_gtk.cc

Issue 159166: gtk: Two fixes for the tab leak:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/tabs/tab_gtk.h" 5 #include "chrome/browser/gtk/tabs/tab_gtk.h"
6 6
7 #include "app/gfx/path.h" 7 #include "app/gfx/path.h"
8 #include "app/l10n_util.h" 8 #include "app/l10n_util.h"
9 #include "app/resource_bundle.h" 9 #include "app/resource_bundle.h"
10 #include "chrome/browser/gtk/gtk_dnd_util.h" 10 #include "chrome/browser/gtk/gtk_dnd_util.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 106
107 /////////////////////////////////////////////////////////////////////////////// 107 ///////////////////////////////////////////////////////////////////////////////
108 // TabGtk, public: 108 // TabGtk, public:
109 109
110 TabGtk::TabGtk(TabDelegate* delegate) 110 TabGtk::TabGtk(TabDelegate* delegate)
111 : TabRendererGtk(delegate->GetThemeProvider()), 111 : TabRendererGtk(delegate->GetThemeProvider()),
112 delegate_(delegate), 112 delegate_(delegate),
113 closing_(false), 113 closing_(false),
114 dragging_(false) { 114 dragging_(false) {
115 event_box_ = gtk_event_box_new(); 115 event_box_ = gtk_event_box_new();
116 g_object_ref(event_box_);
117 gtk_event_box_set_visible_window(GTK_EVENT_BOX(event_box_), FALSE); 116 gtk_event_box_set_visible_window(GTK_EVENT_BOX(event_box_), FALSE);
118 gtk_drag_source_set(event_box_, GDK_BUTTON1_MASK, 117 gtk_drag_source_set(event_box_, GDK_BUTTON1_MASK,
119 NULL, 0, GDK_ACTION_MOVE); 118 NULL, 0, GDK_ACTION_MOVE);
120 GtkDndUtil::SetSourceTargetListFromCodeMask(event_box_, 119 GtkDndUtil::SetSourceTargetListFromCodeMask(event_box_,
121 GtkDndUtil::CHROME_TAB); 120 GtkDndUtil::CHROME_TAB);
122 g_signal_connect(G_OBJECT(event_box_), "button-press-event", 121 g_signal_connect(G_OBJECT(event_box_), "button-press-event",
123 G_CALLBACK(OnMousePress), this); 122 G_CALLBACK(OnMousePress), this);
124 g_signal_connect(G_OBJECT(event_box_), "button-release-event", 123 g_signal_connect(G_OBJECT(event_box_), "button-release-event",
125 G_CALLBACK(OnMouseRelease), this); 124 G_CALLBACK(OnMouseRelease), this);
126 g_signal_connect(G_OBJECT(event_box_), "enter-notify-event", 125 g_signal_connect(G_OBJECT(event_box_), "enter-notify-event",
(...skipping 16 matching lines...) Expand all
143 } 142 }
144 143
145 TabGtk::~TabGtk() { 144 TabGtk::~TabGtk() {
146 if (menu_controller_.get()) { 145 if (menu_controller_.get()) {
147 // The menu is showing. Close the menu. 146 // The menu is showing. Close the menu.
148 menu_controller_->Cancel(); 147 menu_controller_->Cancel();
149 148
150 // Invoke this so that we hide the highlight. 149 // Invoke this so that we hide the highlight.
151 ContextMenuClosed(); 150 ContextMenuClosed();
152 } 151 }
153
154 gtk_widget_destroy(event_box_);
155 } 152 }
156 153
157 // static 154 // static
158 gboolean TabGtk::OnMousePress(GtkWidget* widget, GdkEventButton* event, 155 gboolean TabGtk::OnMousePress(GtkWidget* widget, GdkEventButton* event,
159 TabGtk* tab) { 156 TabGtk* tab) {
160 if (event->button == 1) { 157 if (event->button == 1) {
161 // Store whether or not we were selected just now... we only want to be 158 // Store whether or not we were selected just now... we only want to be
162 // able to drag foreground tabs, so we don't start dragging the tab if 159 // able to drag foreground tabs, so we don't start dragging the tab if
163 // it was in the background. 160 // it was in the background.
164 bool just_selected = !tab->IsSelected(); 161 bool just_selected = !tab->IsSelected();
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 if (!menu_controller_.get()) 292 if (!menu_controller_.get())
296 menu_controller_.reset(new ContextMenuController(this)); 293 menu_controller_.reset(new ContextMenuController(this));
297 294
298 menu_controller_->RunMenu(); 295 menu_controller_->RunMenu();
299 } 296 }
300 297
301 void TabGtk::ContextMenuClosed() { 298 void TabGtk::ContextMenuClosed() {
302 delegate()->StopAllHighlighting(); 299 delegate()->StopAllHighlighting();
303 menu_controller_.reset(); 300 menu_controller_.reset();
304 } 301 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/gtk/tabs/tab_strip_gtk.cc » ('j') | chrome/browser/gtk/tabs/tab_strip_gtk.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698