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

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

Issue 9500003: Add a button to exit managed mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 8 years, 8 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) 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_button_gtk.h" 5 #include "chrome/browser/ui/gtk/avatar_menu_button_gtk.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "chrome/browser/managed_mode.h"
8 #include "chrome/browser/profiles/profile_metrics.h" 9 #include "chrome/browser/profiles/profile_metrics.h"
9 #include "chrome/browser/profiles/profile_info_util.h" 10 #include "chrome/browser/profiles/profile_info_util.h"
10 #include "chrome/browser/ui/gtk/avatar_menu_bubble_gtk.h" 11 #include "chrome/browser/ui/gtk/avatar_menu_bubble_gtk.h"
11 #include "chrome/browser/ui/gtk/bubble/bubble_gtk.h" 12 #include "chrome/browser/ui/gtk/bubble/bubble_gtk.h"
12 #include "ui/gfx/gtk_util.h" 13 #include "ui/gfx/gtk_util.h"
13 14
14 AvatarMenuButtonGtk::AvatarMenuButtonGtk(Browser* browser) 15 AvatarMenuButtonGtk::AvatarMenuButtonGtk(Browser* browser)
15 : image_(NULL), 16 : image_(NULL),
16 browser_(browser), 17 browser_(browser),
17 arrow_location_(BubbleGtk::ARROW_LOCATION_TOP_LEFT), 18 arrow_location_(BubbleGtk::ARROW_LOCATION_TOP_LEFT),
(...skipping 21 matching lines...) Expand all
39 icon_.reset(new gfx::Image(image)); 40 icon_.reset(new gfx::Image(image));
40 is_gaia_picture_ = is_gaia_picture; 41 is_gaia_picture_ = is_gaia_picture;
41 UpdateButtonIcon(); 42 UpdateButtonIcon();
42 } 43 }
43 44
44 gboolean AvatarMenuButtonGtk::OnButtonPressed(GtkWidget* widget, 45 gboolean AvatarMenuButtonGtk::OnButtonPressed(GtkWidget* widget,
45 GdkEventButton* event) { 46 GdkEventButton* event) {
46 if (event->button != 1) 47 if (event->button != 1)
47 return FALSE; 48 return FALSE;
48 49
50 if (ManagedMode::IsInManagedMode()) {
51 ManagedMode::LeaveManagedMode();
52 return TRUE;
53 }
54
49 ShowAvatarBubble(); 55 ShowAvatarBubble();
50 ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::ICON_AVATAR_BUBBLE); 56 ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::ICON_AVATAR_BUBBLE);
51 return TRUE; 57 return TRUE;
52 } 58 }
53 59
54 void AvatarMenuButtonGtk::OnSizeAllocate(GtkWidget* widget, 60 void AvatarMenuButtonGtk::OnSizeAllocate(GtkWidget* widget,
55 GtkAllocation* allocation) { 61 GtkAllocation* allocation) {
56 if (allocation->height != old_height_) 62 if (allocation->height != old_height_)
57 UpdateButtonIcon(); 63 UpdateButtonIcon();
58 } 64 }
(...skipping 10 matching lines...) Expand all
69 75
70 GtkAllocation allocation; 76 GtkAllocation allocation;
71 gtk_widget_get_allocation(widget(), &allocation); 77 gtk_widget_get_allocation(widget(), &allocation);
72 old_height_ = allocation.height; 78 old_height_ = allocation.height;
73 gfx::Image icon = profiles::GetAvatarIconForTitleBar(*icon_, is_gaia_picture_, 79 gfx::Image icon = profiles::GetAvatarIconForTitleBar(*icon_, is_gaia_picture_,
74 profiles::kAvatarIconWidth, old_height_); 80 profiles::kAvatarIconWidth, old_height_);
75 gtk_image_set_from_pixbuf(GTK_IMAGE(image_), icon.ToGdkPixbuf()); 81 gtk_image_set_from_pixbuf(GTK_IMAGE(image_), icon.ToGdkPixbuf());
76 gtk_misc_set_alignment(GTK_MISC(image_), 0.0, 1.0); 82 gtk_misc_set_alignment(GTK_MISC(image_), 0.0, 1.0);
77 gtk_widget_set_size_request(image_, -1, 0); 83 gtk_widget_set_size_request(image_, -1, 0);
78 } 84 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698