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

Side by Side Diff: chrome/browser/ui/ash/networking_config_delegate_chromeos.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ash/networking_config_delegate_chromeos.h" 5 #include "chrome/browser/ui/ash/networking_config_delegate_chromeos.h"
6 6
7 #include <memory>
7 #include <string> 8 #include <string>
8 9
9 #include "base/memory/scoped_ptr.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
11 #include "chrome/browser/profiles/profile_manager.h" 11 #include "chrome/browser/profiles/profile_manager.h"
12 #include "chromeos/network/network_state.h" 12 #include "chromeos/network/network_state.h"
13 #include "chromeos/network/network_state_handler.h" 13 #include "chromeos/network/network_state_handler.h"
14 #include "extensions/browser/api/networking_config/networking_config_service.h" 14 #include "extensions/browser/api/networking_config/networking_config_service.h"
15 #include "extensions/browser/api/networking_config/networking_config_service_fac tory.h" 15 #include "extensions/browser/api/networking_config/networking_config_service_fac tory.h"
16 #include "extensions/browser/extension_registry.h" 16 #include "extensions/browser/extension_registry.h"
17 #include "extensions/common/extension.h" 17 #include "extensions/common/extension.h"
18 18
19 namespace chromeos { 19 namespace chromeos {
20 20
21 NetworkingConfigDelegateChromeos::NetworkingConfigDelegateChromeos() { 21 NetworkingConfigDelegateChromeos::NetworkingConfigDelegateChromeos() {
22 } 22 }
23 23
24 NetworkingConfigDelegateChromeos::~NetworkingConfigDelegateChromeos() { 24 NetworkingConfigDelegateChromeos::~NetworkingConfigDelegateChromeos() {
25 } 25 }
26 26
27 scoped_ptr<const ash::NetworkingConfigDelegate::ExtensionInfo> 27 std::unique_ptr<const ash::NetworkingConfigDelegate::ExtensionInfo>
28 NetworkingConfigDelegateChromeos::LookUpExtensionForNetwork( 28 NetworkingConfigDelegateChromeos::LookUpExtensionForNetwork(
29 const std::string& service_path) { 29 const std::string& service_path) {
30 chromeos::NetworkStateHandler* handler = 30 chromeos::NetworkStateHandler* handler =
31 chromeos::NetworkHandler::Get()->network_state_handler(); 31 chromeos::NetworkHandler::Get()->network_state_handler();
32 const chromeos::NetworkState* network_state = 32 const chromeos::NetworkState* network_state =
33 handler->GetNetworkState(service_path); 33 handler->GetNetworkState(service_path);
34 if (!network_state) 34 if (!network_state)
35 return nullptr; 35 return nullptr;
36 std::string hex_ssid = network_state->GetHexSsid(); 36 std::string hex_ssid = network_state->GetHexSsid();
37 Profile* profile = ProfileManager::GetActiveUserProfile(); 37 Profile* profile = ProfileManager::GetActiveUserProfile();
38 extensions::NetworkingConfigService* networking_config_service = 38 extensions::NetworkingConfigService* networking_config_service =
39 extensions::NetworkingConfigServiceFactory::GetForBrowserContext(profile); 39 extensions::NetworkingConfigServiceFactory::GetForBrowserContext(profile);
40 const std::string extension_id = 40 const std::string extension_id =
41 networking_config_service->LookupExtensionIdForHexSsid(hex_ssid); 41 networking_config_service->LookupExtensionIdForHexSsid(hex_ssid);
42 if (extension_id.empty()) 42 if (extension_id.empty())
43 return nullptr; 43 return nullptr;
44 std::string extension_name = LookUpExtensionName(profile, extension_id); 44 std::string extension_name = LookUpExtensionName(profile, extension_id);
45 if (extension_name.empty()) 45 if (extension_name.empty())
46 return scoped_ptr<const ash::NetworkingConfigDelegate::ExtensionInfo>(); 46 return std::unique_ptr<
47 scoped_ptr<const ash::NetworkingConfigDelegate::ExtensionInfo> extension_info( 47 const ash::NetworkingConfigDelegate::ExtensionInfo>();
48 new const ash::NetworkingConfigDelegate::ExtensionInfo(extension_id, 48 std::unique_ptr<const ash::NetworkingConfigDelegate::ExtensionInfo>
49 extension_name)); 49 extension_info(new const ash::NetworkingConfigDelegate::ExtensionInfo(
50 extension_id, extension_name));
50 return extension_info; 51 return extension_info;
51 } 52 }
52 53
53 std::string NetworkingConfigDelegateChromeos::LookUpExtensionName( 54 std::string NetworkingConfigDelegateChromeos::LookUpExtensionName(
54 content::BrowserContext* context, 55 content::BrowserContext* context,
55 std::string extension_id) const { 56 std::string extension_id) const {
56 extensions::ExtensionRegistry* extension_registry = 57 extensions::ExtensionRegistry* extension_registry =
57 extensions::ExtensionRegistry::Get(context); 58 extensions::ExtensionRegistry::Get(context);
58 DCHECK(extension_registry); 59 DCHECK(extension_registry);
59 const extensions::Extension* extension = extension_registry->GetExtensionById( 60 const extensions::Extension* extension = extension_registry->GetExtensionById(
60 extension_id, extensions::ExtensionRegistry::ENABLED); 61 extension_id, extensions::ExtensionRegistry::ENABLED);
61 if (extension == nullptr) 62 if (extension == nullptr)
62 return std::string(); 63 return std::string();
63 return extension->name(); 64 return extension->name();
64 } 65 }
65 66
66 } // namespace chromeos 67 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698