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

Side by Side Diff: chrome/browser/ui/gtk/avatar_menu_bubble_gtk.cc

Issue 8370021: Make avatar menu bubble as singleton and destroy all the menu items and menu model when bubble cl... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' 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/gtk/avatar_menu_bubble_gtk.h" 5 #include "chrome/browser/ui/gtk/avatar_menu_bubble_gtk.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/profiles/avatar_menu_model.h" 9 #include "chrome/browser/profiles/avatar_menu_model.h"
10 #include "chrome/browser/profiles/profile_info_cache.h" 10 #include "chrome/browser/profiles/profile_info_cache.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 OnAvatarMenuModelChanged(avatar_menu_model_.get()); 47 OnAvatarMenuModelChanged(avatar_menu_model_.get());
48 48
49 bubble_ = BubbleGtk::Show(anchor, 49 bubble_ = BubbleGtk::Show(anchor,
50 rect, 50 rect,
51 contents_, 51 contents_,
52 arrow, 52 arrow,
53 true, // |match_system_theme| 53 true, // |match_system_theme|
54 true, // |grab_input| 54 true, // |grab_input|
55 theme_service_, 55 theme_service_,
56 this); // |delegate| 56 this); // |delegate|
57 g_signal_connect(contents_, "destroy",
58 G_CALLBACK(&OnDestroyThunk), this);
57 } 59 }
58 60
59 AvatarMenuBubbleGtk::~AvatarMenuBubbleGtk() { 61 AvatarMenuBubbleGtk::~AvatarMenuBubbleGtk() {
60 STLDeleteContainerPointers(items_.begin(), items_.end()); 62 STLDeleteContainerPointers(items_.begin(), items_.end());
61 } 63 }
62 64
65 void AvatarMenuBubbleGtk::OnDestroy(GtkWidget* widget) {
66 // We are self deleting, we have a destroy signal setup to catch when we
67 // destroyed (via the BubbleGtk being destroyed), and delete ourself.
68 delete this;
69 }
70
63 void AvatarMenuBubbleGtk::BubbleClosing(BubbleGtk* bubble, 71 void AvatarMenuBubbleGtk::BubbleClosing(BubbleGtk* bubble,
64 bool closed_by_escape) { 72 bool closed_by_escape) {
65 } 73 }
66 74
67 void AvatarMenuBubbleGtk::OnAvatarMenuModelChanged( 75 void AvatarMenuBubbleGtk::OnAvatarMenuModelChanged(
68 AvatarMenuModel* avatar_menu_model) { 76 AvatarMenuModel* avatar_menu_model) {
69 STLDeleteContainerPointers(items_.begin(), items_.end()); 77 STLDeleteContainerPointers(items_.begin(), items_.end());
70 items_.clear(); 78 items_.clear();
71 minimum_width_ = kBubbleMinWidth; 79 minimum_width_ = kBubbleMinWidth;
72 80
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 g_signal_connect(new_profile_link, "clicked", 134 g_signal_connect(new_profile_link, "clicked",
127 G_CALLBACK(OnNewProfileLinkClickedThunk), this); 135 G_CALLBACK(OnNewProfileLinkClickedThunk), this);
128 136
129 GtkWidget* link_align = gtk_alignment_new(0, 0, 0, 0); 137 GtkWidget* link_align = gtk_alignment_new(0, 0, 0, 0);
130 gtk_alignment_set_padding(GTK_ALIGNMENT(link_align), 138 gtk_alignment_set_padding(GTK_ALIGNMENT(link_align),
131 0, 0, kNewProfileLinkLeftPadding, 0); 139 0, 0, kNewProfileLinkLeftPadding, 0);
132 gtk_container_add(GTK_CONTAINER(link_align), new_profile_link); 140 gtk_container_add(GTK_CONTAINER(link_align), new_profile_link);
133 141
134 gtk_box_pack_start(GTK_BOX(contents_), link_align, FALSE, FALSE, 0); 142 gtk_box_pack_start(GTK_BOX(contents_), link_align, FALSE, FALSE, 0);
135 } 143 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/avatar_menu_bubble_gtk.h ('k') | chrome/browser/ui/gtk/avatar_menu_item_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698