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

Side by Side Diff: chrome/browser/ui/libgtkui/app_indicator_icon_menu.cc

Issue 2707313002: Gtk: Change NULL to nullptr (Closed)
Patch Set: Created 3 years, 10 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/libgtkui/app_indicator_icon_menu.h" 5 #include "chrome/browser/ui/libgtkui/app_indicator_icon_menu.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/debug/leak_annotations.h" 10 #include "base/debug/leak_annotations.h"
11 #include "chrome/browser/ui/libgtkui/menu_util.h" 11 #include "chrome/browser/ui/libgtkui/menu_util.h"
12 #include "ui/base/models/menu_model.h" 12 #include "ui/base/models/menu_model.h"
13 13
14 namespace libgtkui { 14 namespace libgtkui {
15 15
16 AppIndicatorIconMenu::AppIndicatorIconMenu(ui::MenuModel* model) 16 AppIndicatorIconMenu::AppIndicatorIconMenu(ui::MenuModel* model)
17 : menu_model_(model), 17 : menu_model_(model),
18 click_action_replacement_menu_item_added_(false), 18 click_action_replacement_menu_item_added_(false),
19 gtk_menu_(NULL), 19 gtk_menu_(nullptr),
20 block_activation_(false) { 20 block_activation_(false) {
21 { 21 {
22 ANNOTATE_SCOPED_MEMORY_LEAK; // http://crbug.com/378770 22 ANNOTATE_SCOPED_MEMORY_LEAK; // http://crbug.com/378770
23 gtk_menu_ = gtk_menu_new(); 23 gtk_menu_ = gtk_menu_new();
24 } 24 }
25 g_object_ref_sink(gtk_menu_); 25 g_object_ref_sink(gtk_menu_);
26 if (menu_model_) { 26 if (menu_model_) {
27 BuildSubmenuFromModel(menu_model_, 27 BuildSubmenuFromModel(menu_model_,
28 gtk_menu_, 28 gtk_menu_,
29 G_CALLBACK(OnMenuItemActivatedThunk), 29 G_CALLBACK(OnMenuItemActivatedThunk),
(...skipping 10 matching lines...) Expand all
40 40
41 void AppIndicatorIconMenu::UpdateClickActionReplacementMenuItem( 41 void AppIndicatorIconMenu::UpdateClickActionReplacementMenuItem(
42 const char* label, 42 const char* label,
43 const base::Closure& callback) { 43 const base::Closure& callback) {
44 click_action_replacement_callback_ = callback; 44 click_action_replacement_callback_ = callback;
45 45
46 if (click_action_replacement_menu_item_added_) { 46 if (click_action_replacement_menu_item_added_) {
47 GList* children = gtk_container_get_children(GTK_CONTAINER(gtk_menu_)); 47 GList* children = gtk_container_get_children(GTK_CONTAINER(gtk_menu_));
48 for (GList* child = children; child; child = g_list_next(child)) { 48 for (GList* child = children; child; child = g_list_next(child)) {
49 if (g_object_get_data(G_OBJECT(child->data), "click-action-item") != 49 if (g_object_get_data(G_OBJECT(child->data), "click-action-item") !=
50 NULL) { 50 nullptr) {
51 gtk_menu_item_set_label(GTK_MENU_ITEM(child->data), label); 51 gtk_menu_item_set_label(GTK_MENU_ITEM(child->data), label);
52 break; 52 break;
53 } 53 }
54 } 54 }
55 g_list_free(children); 55 g_list_free(children);
56 } else { 56 } else {
57 click_action_replacement_menu_item_added_ = true; 57 click_action_replacement_menu_item_added_ = true;
58 58
59 // If |menu_model_| is non empty, add a separator to separate the 59 // If |menu_model_| is non empty, add a separator to separate the
60 // "click action replacement menu item" from the other menu items. 60 // "click action replacement menu item" from the other menu items.
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 int id; 114 int id;
115 if (!GetMenuItemID(menu_item, &id)) 115 if (!GetMenuItemID(menu_item, &id))
116 return; 116 return;
117 117
118 // The menu item can still be activated by hotkeys even if it is disabled. 118 // The menu item can still be activated by hotkeys even if it is disabled.
119 if (menu_model_->IsEnabledAt(id)) 119 if (menu_model_->IsEnabledAt(id))
120 ExecuteCommand(model, id); 120 ExecuteCommand(model, id);
121 } 121 }
122 122
123 } // namespace libgtkui 123 } // namespace libgtkui
OLDNEW
« no previous file with comments | « chrome/browser/ui/libgtkui/app_indicator_icon.cc ('k') | chrome/browser/ui/libgtkui/chrome_gtk_frame.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698