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

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

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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
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/libgtk2ui/app_indicator_icon.h" 5 #include "chrome/browser/ui/libgtk2ui/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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 = NULL;
83 83
84 void EnsureMethodsLoaded() { 84 void EnsureMethodsLoaded() {
85 if (g_attempted_load) 85 if (g_attempted_load)
86 return; 86 return;
87 87
88 g_attempted_load = true; 88 g_attempted_load = true;
89 89
90 // Only use libappindicator where it is needed to support dbus based status 90 // Only use libappindicator where it is needed to support dbus based status
91 // icons. In particular, libappindicator does not support a click action. 91 // icons. In particular, libappindicator does not support a click action.
92 scoped_ptr<base::Environment> env(base::Environment::Create()); 92 std::unique_ptr<base::Environment> env(base::Environment::Create());
93 base::nix::DesktopEnvironment environment = 93 base::nix::DesktopEnvironment environment =
94 base::nix::GetDesktopEnvironment(env.get()); 94 base::nix::GetDesktopEnvironment(env.get());
95 if (environment != base::nix::DESKTOP_ENVIRONMENT_KDE4 && 95 if (environment != base::nix::DESKTOP_ENVIRONMENT_KDE4 &&
96 environment != base::nix::DESKTOP_ENVIRONMENT_KDE5 && 96 environment != base::nix::DESKTOP_ENVIRONMENT_KDE5 &&
97 environment != base::nix::DESKTOP_ENVIRONMENT_UNITY) { 97 environment != base::nix::DESKTOP_ENVIRONMENT_UNITY) {
98 return; 98 return;
99 } 99 }
100 100
101 void* indicator_lib = nullptr; 101 void* indicator_lib = nullptr;
102 102
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 namespace libgtk2ui { 174 namespace libgtk2ui {
175 175
176 AppIndicatorIcon::AppIndicatorIcon(std::string id, 176 AppIndicatorIcon::AppIndicatorIcon(std::string id,
177 const gfx::ImageSkia& image, 177 const gfx::ImageSkia& image,
178 const base::string16& tool_tip) 178 const base::string16& tool_tip)
179 : id_(id), 179 : id_(id),
180 icon_(NULL), 180 icon_(NULL),
181 menu_model_(NULL), 181 menu_model_(NULL),
182 icon_change_count_(0), 182 icon_change_count_(0),
183 weak_factory_(this) { 183 weak_factory_(this) {
184 scoped_ptr<base::Environment> env(base::Environment::Create()); 184 std::unique_ptr<base::Environment> env(base::Environment::Create());
185 desktop_env_ = base::nix::GetDesktopEnvironment(env.get()); 185 desktop_env_ = base::nix::GetDesktopEnvironment(env.get());
186 186
187 EnsureMethodsLoaded(); 187 EnsureMethodsLoaded();
188 tool_tip_ = base::UTF16ToUTF8(tool_tip); 188 tool_tip_ = base::UTF16ToUTF8(tool_tip);
189 SetImage(image); 189 SetImage(image);
190 } 190 }
191 AppIndicatorIcon::~AppIndicatorIcon() { 191 AppIndicatorIcon::~AppIndicatorIcon() {
192 if (icon_) { 192 if (icon_) {
193 app_indicator_set_status(icon_, APP_INDICATOR_STATUS_PASSIVE); 193 app_indicator_set_status(icon_, APP_INDICATOR_STATUS_PASSIVE);
194 g_object_unref(icon_); 194 g_object_unref(icon_);
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 base::Bind(&AppIndicatorIcon::OnClickActionReplacementMenuItemActivated, 388 base::Bind(&AppIndicatorIcon::OnClickActionReplacementMenuItemActivated,
389 base::Unretained(this))); 389 base::Unretained(this)));
390 } 390 }
391 391
392 void AppIndicatorIcon::OnClickActionReplacementMenuItemActivated() { 392 void AppIndicatorIcon::OnClickActionReplacementMenuItemActivated() {
393 if (delegate()) 393 if (delegate())
394 delegate()->OnClick(); 394 delegate()->OnClick();
395 } 395 }
396 396
397 } // namespace libgtk2ui 397 } // namespace libgtk2ui
OLDNEW
« no previous file with comments | « chrome/browser/ui/libgtk2ui/app_indicator_icon.h ('k') | chrome/browser/ui/libgtk2ui/gconf_listener.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698