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

Side by Side Diff: chrome/browser/ui/webui/options/browser_options_handler.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/webui/options/browser_options_handler.h" 5 #include "chrome/browser/ui/webui/options/browser_options_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <set> 9 #include <set>
10 10
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 using content::Referrer; 158 using content::Referrer;
159 using extensions::Extension; 159 using extensions::Extension;
160 using extensions::ExtensionRegistry; 160 using extensions::ExtensionRegistry;
161 161
162 namespace { 162 namespace {
163 163
164 #if defined(OS_WIN) 164 #if defined(OS_WIN)
165 void AppendExtensionData(const std::string& key, 165 void AppendExtensionData(const std::string& key,
166 const Extension* extension, 166 const Extension* extension,
167 base::DictionaryValue* dict) { 167 base::DictionaryValue* dict) {
168 scoped_ptr<base::DictionaryValue> details(new base::DictionaryValue); 168 std::unique_ptr<base::DictionaryValue> details(new base::DictionaryValue);
169 details->SetString("id", extension ? extension->id() : std::string()); 169 details->SetString("id", extension ? extension->id() : std::string());
170 details->SetString("name", extension ? extension->name() : std::string()); 170 details->SetString("name", extension ? extension->name() : std::string());
171 dict->Set(key, details.release()); 171 dict->Set(key, details.release());
172 } 172 }
173 #endif // defined(OS_WIN) 173 #endif // defined(OS_WIN)
174 174
175 #if !defined(OS_CHROMEOS) 175 #if !defined(OS_CHROMEOS)
176 bool IsDisabledByPolicy(const BooleanPrefMember& pref) { 176 bool IsDisabledByPolicy(const BooleanPrefMember& pref) {
177 return pref.IsManaged() && !pref.GetValue(); 177 return pref.IsManaged() && !pref.GetValue();
178 } 178 }
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 extension_misc::kChromeVoxExtensionId + 614 extension_misc::kChromeVoxExtensionId +
615 chrome::kChromeAccessibilitySettingsURL; 615 chrome::kChromeAccessibilitySettingsURL;
616 616
617 values->SetString("accessibilitySettingsURL", 617 values->SetString("accessibilitySettingsURL",
618 settings_url); 618 settings_url);
619 619
620 values->SetString("contentProtectionAttestationLearnMoreURL", 620 values->SetString("contentProtectionAttestationLearnMoreURL",
621 chrome::kAttestationForContentProtectionLearnMoreURL); 621 chrome::kAttestationForContentProtectionLearnMoreURL);
622 622
623 // Creates magnifierList. 623 // Creates magnifierList.
624 scoped_ptr<base::ListValue> magnifier_list(new base::ListValue); 624 std::unique_ptr<base::ListValue> magnifier_list(new base::ListValue);
625 625
626 scoped_ptr<base::ListValue> option_full(new base::ListValue); 626 std::unique_ptr<base::ListValue> option_full(new base::ListValue);
627 option_full->AppendInteger(ui::MAGNIFIER_FULL); 627 option_full->AppendInteger(ui::MAGNIFIER_FULL);
628 option_full->AppendString(l10n_util::GetStringUTF16( 628 option_full->AppendString(l10n_util::GetStringUTF16(
629 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_SCREEN_MAGNIFIER_FULL)); 629 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_SCREEN_MAGNIFIER_FULL));
630 magnifier_list->Append(option_full.release()); 630 magnifier_list->Append(option_full.release());
631 631
632 scoped_ptr<base::ListValue> option_partial(new base::ListValue); 632 std::unique_ptr<base::ListValue> option_partial(new base::ListValue);
633 option_partial->AppendInteger(ui::MAGNIFIER_PARTIAL); 633 option_partial->AppendInteger(ui::MAGNIFIER_PARTIAL);
634 option_partial->Append(new base::StringValue(l10n_util::GetStringUTF16( 634 option_partial->Append(new base::StringValue(l10n_util::GetStringUTF16(
635 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_SCREEN_MAGNIFIER_PARTIAL))); 635 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_SCREEN_MAGNIFIER_PARTIAL)));
636 magnifier_list->Append(option_partial.release()); 636 magnifier_list->Append(option_partial.release());
637 637
638 values->Set("magnifierList", magnifier_list.release()); 638 values->Set("magnifierList", magnifier_list.release());
639 #endif 639 #endif
640 640
641 #if defined(OS_MACOSX) 641 #if defined(OS_MACOSX)
642 values->SetString("macPasswordsWarning", 642 values->SetString("macPasswordsWarning",
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
1313 const base::FilePath& profile_path, 1313 const base::FilePath& profile_path,
1314 const base::string16& old_profile_name) { 1314 const base::string16& old_profile_name) {
1315 SendProfilesInfo(); 1315 SendProfilesInfo();
1316 } 1316 }
1317 1317
1318 void BrowserOptionsHandler::OnProfileAvatarChanged( 1318 void BrowserOptionsHandler::OnProfileAvatarChanged(
1319 const base::FilePath& profile_path) { 1319 const base::FilePath& profile_path) {
1320 SendProfilesInfo(); 1320 SendProfilesInfo();
1321 } 1321 }
1322 1322
1323 scoped_ptr<base::ListValue> BrowserOptionsHandler::GetProfilesInfoList() { 1323 std::unique_ptr<base::ListValue> BrowserOptionsHandler::GetProfilesInfoList() {
1324 std::vector<ProfileAttributesEntry*> entries = 1324 std::vector<ProfileAttributesEntry*> entries =
1325 g_browser_process->profile_manager()-> 1325 g_browser_process->profile_manager()->
1326 GetProfileAttributesStorage().GetAllProfilesAttributesSortedByName(); 1326 GetProfileAttributesStorage().GetAllProfilesAttributesSortedByName();
1327 scoped_ptr<base::ListValue> profile_info_list(new base::ListValue); 1327 std::unique_ptr<base::ListValue> profile_info_list(new base::ListValue);
1328 base::FilePath current_profile_path = 1328 base::FilePath current_profile_path =
1329 web_ui()->GetWebContents()->GetBrowserContext()->GetPath(); 1329 web_ui()->GetWebContents()->GetBrowserContext()->GetPath();
1330 1330
1331 for (const ProfileAttributesEntry* entry : entries) { 1331 for (const ProfileAttributesEntry* entry : entries) {
1332 // The items in |profile_value| are also described in 1332 // The items in |profile_value| are also described in
1333 // chrome/browser/resources/options/browser_options.js in a @typedef for 1333 // chrome/browser/resources/options/browser_options.js in a @typedef for
1334 // Profile. Please update it whenever you add or remove any keys here. 1334 // Profile. Please update it whenever you add or remove any keys here.
1335 base::DictionaryValue* profile_value = new base::DictionaryValue(); 1335 base::DictionaryValue* profile_value = new base::DictionaryValue();
1336 profile_value->SetString("name", entry->GetName()); 1336 profile_value->SetString("name", entry->GetName());
1337 base::FilePath profile_path = entry->GetPath(); 1337 base::FilePath profile_path = entry->GetPath();
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1458 const bool is_managed = prefs->IsManagedPreference( 1458 const bool is_managed = prefs->IsManagedPreference(
1459 prefs::kSystemTimezoneAutomaticDetectionPolicy); 1459 prefs::kSystemTimezoneAutomaticDetectionPolicy);
1460 const int value = 1460 const int value =
1461 prefs->GetInteger(prefs::kSystemTimezoneAutomaticDetectionPolicy); 1461 prefs->GetInteger(prefs::kSystemTimezoneAutomaticDetectionPolicy);
1462 web_ui()->CallJavascriptFunction( 1462 web_ui()->CallJavascriptFunction(
1463 "BrowserOptions.setSystemTimezoneAutomaticDetectionManaged", 1463 "BrowserOptions.setSystemTimezoneAutomaticDetectionManaged",
1464 base::FundamentalValue(is_managed), base::FundamentalValue(value)); 1464 base::FundamentalValue(is_managed), base::FundamentalValue(value));
1465 } 1465 }
1466 #endif 1466 #endif
1467 1467
1468 scoped_ptr<base::DictionaryValue> 1468 std::unique_ptr<base::DictionaryValue>
1469 BrowserOptionsHandler::GetSyncStateDictionary() { 1469 BrowserOptionsHandler::GetSyncStateDictionary() {
1470 // The items which are to be written into |sync_status| are also described in 1470 // The items which are to be written into |sync_status| are also described in
1471 // chrome/browser/resources/options/browser_options.js in @typedef 1471 // chrome/browser/resources/options/browser_options.js in @typedef
1472 // for SyncStatus. Please update it whenever you add or remove any keys here. 1472 // for SyncStatus. Please update it whenever you add or remove any keys here.
1473 scoped_ptr<base::DictionaryValue> sync_status(new base::DictionaryValue); 1473 std::unique_ptr<base::DictionaryValue> sync_status(new base::DictionaryValue);
1474 Profile* profile = Profile::FromWebUI(web_ui()); 1474 Profile* profile = Profile::FromWebUI(web_ui());
1475 if (profile->IsGuestSession()) { 1475 if (profile->IsGuestSession()) {
1476 // Cannot display signin status when running in guest mode on chromeos 1476 // Cannot display signin status when running in guest mode on chromeos
1477 // because there is no SigninManager. 1477 // because there is no SigninManager.
1478 sync_status->SetBoolean("signinAllowed", false); 1478 sync_status->SetBoolean("signinAllowed", false);
1479 return sync_status; 1479 return sync_status;
1480 } 1480 }
1481 1481
1482 sync_status->SetBoolean("supervisedUser", profile->IsSupervised()); 1482 sync_status->SetBoolean("supervisedUser", profile->IsSupervised());
1483 sync_status->SetBoolean("childUser", profile->IsChild()); 1483 sync_status->SetBoolean("childUser", profile->IsChild());
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
2165 2165
2166 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { 2166 bool BrowserOptionsHandler::IsDeviceOwnerProfile() {
2167 #if defined(OS_CHROMEOS) 2167 #if defined(OS_CHROMEOS)
2168 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); 2168 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui()));
2169 #else 2169 #else
2170 return true; 2170 return true;
2171 #endif 2171 #endif
2172 } 2172 }
2173 2173
2174 } // namespace options 2174 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698