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

Side by Side Diff: ash/system/chromeos/network/vpn_list_view.cc

Issue 1867223004: Convert //ash from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "ash/system/chromeos/network/vpn_list_view.h" 5 #include "ash/system/chromeos/network/vpn_list_view.h"
6 6
7 #include <memory>
7 #include <utility> 8 #include <utility>
8 #include <vector> 9 #include <vector>
9 10
10 #include "ash/metrics/user_metrics_recorder.h" 11 #include "ash/metrics/user_metrics_recorder.h"
11 #include "ash/shell.h" 12 #include "ash/shell.h"
12 #include "ash/system/chromeos/network/vpn_delegate.h" 13 #include "ash/system/chromeos/network/vpn_delegate.h"
13 #include "ash/system/tray/hover_highlight_view.h" 14 #include "ash/system/tray/hover_highlight_view.h"
14 #include "ash/system/tray/system_tray_delegate.h" 15 #include "ash/system/tray/system_tray_delegate.h"
15 #include "ash/system/tray/tray_constants.h" 16 #include "ash/system/tray/tray_constants.h"
16 #include "ash/system/tray/tray_popup_label_button.h" 17 #include "ash/system/tray/tray_popup_label_button.h"
17 #include "base/bind.h" 18 #include "base/bind.h"
18 #include "base/bind_helpers.h" 19 #include "base/bind_helpers.h"
19 #include "base/logging.h" 20 #include "base/logging.h"
20 #include "base/memory/scoped_ptr.h"
21 #include "base/strings/utf_string_conversions.h" 21 #include "base/strings/utf_string_conversions.h"
22 #include "base/values.h" 22 #include "base/values.h"
23 #include "chromeos/network/network_connection_handler.h" 23 #include "chromeos/network/network_connection_handler.h"
24 #include "chromeos/network/network_handler.h" 24 #include "chromeos/network/network_handler.h"
25 #include "chromeos/network/network_state.h" 25 #include "chromeos/network/network_state.h"
26 #include "chromeos/network/network_type_pattern.h" 26 #include "chromeos/network/network_type_pattern.h"
27 #include "grit/ash_strings.h" 27 #include "grit/ash_strings.h"
28 #include "ui/base/l10n/l10n_util.h" 28 #include "ui/base/l10n/l10n_util.h"
29 #include "ui/chromeos/network/network_icon.h" 29 #include "ui/chromeos/network/network_icon.h"
30 #include "ui/chromeos/network/network_icon_animation.h" 30 #include "ui/chromeos/network/network_icon_animation.h"
(...skipping 11 matching lines...) Expand all
42 42
43 namespace ash { 43 namespace ash {
44 44
45 namespace { 45 namespace {
46 46
47 bool IsConnectedOrConnecting(const chromeos::NetworkState* network) { 47 bool IsConnectedOrConnecting(const chromeos::NetworkState* network) {
48 return network->IsConnectedState() || network->IsConnectingState(); 48 return network->IsConnectedState() || network->IsConnectingState();
49 } 49 }
50 50
51 void IgnoreDisconnectError(const std::string& error_name, 51 void IgnoreDisconnectError(const std::string& error_name,
52 scoped_ptr<base::DictionaryValue> error_data) { 52 std::unique_ptr<base::DictionaryValue> error_data) {}
53 }
54 53
55 // The base class of all list entries, a |HoverHighlightView| with no border. 54 // The base class of all list entries, a |HoverHighlightView| with no border.
56 class VPNListEntryBase : public HoverHighlightView { 55 class VPNListEntryBase : public HoverHighlightView {
57 public: 56 public:
58 // When the user clicks the entry, the |parent|'s OnViewClicked() will be 57 // When the user clicks the entry, the |parent|'s OnViewClicked() will be
59 // invoked. 58 // invoked.
60 explicit VPNListEntryBase(VPNListView* parent); 59 explicit VPNListEntryBase(VPNListView* parent);
61 60
62 private: 61 private:
63 DISALLOW_COPY_AND_ASSIGN(VPNListEntryBase); 62 DISALLOW_COPY_AND_ASSIGN(VPNListEntryBase);
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 if (system_tray_delegate) { 244 if (system_tray_delegate) {
246 VPNDelegate* const vpn_delegate = system_tray_delegate->GetVPNDelegate(); 245 VPNDelegate* const vpn_delegate = system_tray_delegate->GetVPNDelegate();
247 if (vpn_delegate) 246 if (vpn_delegate)
248 vpn_delegate->RemoveObserver(this); 247 vpn_delegate->RemoveObserver(this);
249 } 248 }
250 } 249 }
251 250
252 void VPNListView::Update() { 251 void VPNListView::Update() {
253 // Before updating the list, determine whether the user was hovering over one 252 // Before updating the list, determine whether the user was hovering over one
254 // of the VPN provider or network entries. 253 // of the VPN provider or network entries.
255 scoped_ptr<VPNProvider::Key> hovered_provider_key; 254 std::unique_ptr<VPNProvider::Key> hovered_provider_key;
256 std::string hovered_network_service_path; 255 std::string hovered_network_service_path;
257 for (const std::pair<const views::View* const, VPNProvider::Key>& provider : 256 for (const std::pair<const views::View* const, VPNProvider::Key>& provider :
258 provider_view_key_map_) { 257 provider_view_key_map_) {
259 if (static_cast<const HoverHighlightView*>(provider.first)->hover()) { 258 if (static_cast<const HoverHighlightView*>(provider.first)->hover()) {
260 hovered_provider_key.reset(new VPNProvider::Key(provider.second)); 259 hovered_provider_key.reset(new VPNProvider::Key(provider.second));
261 break; 260 break;
262 } 261 }
263 } 262 }
264 if (!hovered_provider_key) { 263 if (!hovered_provider_key) {
265 for (const std::pair<const views::View*, std::string>& entry : 264 for (const std::pair<const views::View*, std::string>& entry :
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 } 413 }
415 } 414 }
416 415
417 // Add providers without any configured networks, in the order that the 416 // Add providers without any configured networks, in the order that the
418 // providers were returned by the extensions system. 417 // providers were returned by the extensions system.
419 for (const VPNProvider& provider : providers) 418 for (const VPNProvider& provider : providers)
420 AddProviderAndNetworks(provider.key, provider.name, networks); 419 AddProviderAndNetworks(provider.key, provider.name, networks);
421 } 420 }
422 421
423 } // namespace ash 422 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698