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

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

Issue 2707313002: Gtk: Change NULL to nullptr (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « no previous file | chrome/browser/ui/libgtkui/app_indicator_icon_menu.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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.h" 5 #include "chrome/browser/ui/libgtkui/app_indicator_icon.h"
6 6
7 #include <dlfcn.h> 7 #include <dlfcn.h>
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 const gchar* icon_desc); 65 const gchar* icon_desc);
66 66
67 typedef void (*app_indicator_set_icon_theme_path_func)( 67 typedef void (*app_indicator_set_icon_theme_path_func)(
68 AppIndicator* self, 68 AppIndicator* self,
69 const gchar* icon_theme_path); 69 const gchar* icon_theme_path);
70 70
71 bool g_attempted_load = false; 71 bool g_attempted_load = false;
72 bool g_opened = false; 72 bool g_opened = false;
73 73
74 // Retrieved functions from libappindicator. 74 // Retrieved functions from libappindicator.
75 app_indicator_new_func app_indicator_new = NULL; 75 app_indicator_new_func app_indicator_new = nullptr;
76 app_indicator_new_with_path_func app_indicator_new_with_path = NULL; 76 app_indicator_new_with_path_func app_indicator_new_with_path = nullptr;
77 app_indicator_set_status_func app_indicator_set_status = NULL; 77 app_indicator_set_status_func app_indicator_set_status = nullptr;
78 app_indicator_set_attention_icon_full_func 78 app_indicator_set_attention_icon_full_func
79 app_indicator_set_attention_icon_full = NULL; 79 app_indicator_set_attention_icon_full = nullptr;
80 app_indicator_set_menu_func app_indicator_set_menu = NULL; 80 app_indicator_set_menu_func app_indicator_set_menu = nullptr;
81 app_indicator_set_icon_full_func app_indicator_set_icon_full = NULL; 81 app_indicator_set_icon_full_func app_indicator_set_icon_full = nullptr;
82 app_indicator_set_icon_theme_path_func app_indicator_set_icon_theme_path = NULL; 82 app_indicator_set_icon_theme_path_func app_indicator_set_icon_theme_path =
83 nullptr;
83 84
84 void EnsureMethodsLoaded() { 85 void EnsureMethodsLoaded() {
85 if (g_attempted_load) 86 if (g_attempted_load)
86 return; 87 return;
87 88
88 g_attempted_load = true; 89 g_attempted_load = true;
89 90
90 // Only use libappindicator where it is needed to support dbus based status 91 // Only use libappindicator where it is needed to support dbus based status
91 // icons. In particular, libappindicator does not support a click action. 92 // icons. In particular, libappindicator does not support a click action.
92 std::unique_ptr<base::Environment> env(base::Environment::Create()); 93 std::unique_ptr<base::Environment> env(base::Environment::Create());
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 } 171 }
171 172
172 } // namespace 173 } // namespace
173 174
174 namespace libgtkui { 175 namespace libgtkui {
175 176
176 AppIndicatorIcon::AppIndicatorIcon(std::string id, 177 AppIndicatorIcon::AppIndicatorIcon(std::string id,
177 const gfx::ImageSkia& image, 178 const gfx::ImageSkia& image,
178 const base::string16& tool_tip) 179 const base::string16& tool_tip)
179 : id_(id), 180 : id_(id),
180 icon_(NULL), 181 icon_(nullptr),
181 menu_model_(NULL), 182 menu_model_(nullptr),
182 icon_change_count_(0), 183 icon_change_count_(0),
183 weak_factory_(this) { 184 weak_factory_(this) {
184 std::unique_ptr<base::Environment> env(base::Environment::Create()); 185 std::unique_ptr<base::Environment> env(base::Environment::Create());
185 desktop_env_ = base::nix::GetDesktopEnvironment(env.get()); 186 desktop_env_ = base::nix::GetDesktopEnvironment(env.get());
186 187
187 EnsureMethodsLoaded(); 188 EnsureMethodsLoaded();
188 tool_tip_ = base::UTF16ToUTF8(tool_tip); 189 tool_tip_ = base::UTF16ToUTF8(tool_tip);
189 SetImage(image); 190 SetImage(image);
190 } 191 }
191 AppIndicatorIcon::~AppIndicatorIcon() { 192 AppIndicatorIcon::~AppIndicatorIcon() {
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 base::Bind(&AppIndicatorIcon::OnClickActionReplacementMenuItemActivated, 389 base::Bind(&AppIndicatorIcon::OnClickActionReplacementMenuItemActivated,
389 base::Unretained(this))); 390 base::Unretained(this)));
390 } 391 }
391 392
392 void AppIndicatorIcon::OnClickActionReplacementMenuItemActivated() { 393 void AppIndicatorIcon::OnClickActionReplacementMenuItemActivated() {
393 if (delegate()) 394 if (delegate())
394 delegate()->OnClick(); 395 delegate()->OnClick();
395 } 396 }
396 397
397 } // namespace libgtkui 398 } // namespace libgtkui
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/libgtkui/app_indicator_icon_menu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698