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

Side by Side Diff: chrome/browser/extensions/api/settings_private/settings_private_delegate.cc

Issue 1549233002: Convert Pass()→std::move() in //chrome/browser/extensions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 11 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 "chrome/browser/extensions/api/settings_private/settings_private_delega te.h" 5 #include "chrome/browser/extensions/api/settings_private/settings_private_delega te.h"
6 6
7 #include <utility>
8
7 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
8 #include "base/values.h" 10 #include "base/values.h"
9 #include "chrome/browser/browser_process.h" 11 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/chromeos/settings/cros_settings.h" 12 #include "chrome/browser/chromeos/settings/cros_settings.h"
11 #include "chrome/browser/extensions/api/settings_private/prefs_util.h" 13 #include "chrome/browser/extensions/api/settings_private/prefs_util.h"
12 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h" 15 #include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h"
14 #include "chrome/common/pref_names.h" 16 #include "chrome/common/pref_names.h"
15 #include "content/public/common/page_zoom.h" 17 #include "content/public/common/page_zoom.h"
16 #include "extensions/browser/extension_registry.h" 18 #include "extensions/browser/extension_registry.h"
(...skipping 24 matching lines...) Expand all
41 scoped_ptr<base::Value> SettingsPrivateDelegate::GetAllPrefs() { 43 scoped_ptr<base::Value> SettingsPrivateDelegate::GetAllPrefs() {
42 scoped_ptr<base::ListValue> prefs(new base::ListValue()); 44 scoped_ptr<base::ListValue> prefs(new base::ListValue());
43 45
44 const TypedPrefMap& keys = prefs_util_->GetWhitelistedKeys(); 46 const TypedPrefMap& keys = prefs_util_->GetWhitelistedKeys();
45 for (const auto& it : keys) { 47 for (const auto& it : keys) {
46 scoped_ptr<base::Value> pref = GetPref(it.first); 48 scoped_ptr<base::Value> pref = GetPref(it.first);
47 if (!pref->IsType(base::Value::TYPE_NULL)) 49 if (!pref->IsType(base::Value::TYPE_NULL))
48 prefs->Append(pref.release()); 50 prefs->Append(pref.release());
49 } 51 }
50 52
51 return prefs.Pass(); 53 return std::move(prefs);
52 } 54 }
53 55
54 PrefsUtil::SetPrefResult SettingsPrivateDelegate::SetPref( 56 PrefsUtil::SetPrefResult SettingsPrivateDelegate::SetPref(
55 const std::string& pref_name, const base::Value* value) { 57 const std::string& pref_name, const base::Value* value) {
56 return prefs_util_->SetPref(pref_name, value); 58 return prefs_util_->SetPref(pref_name, value);
57 } 59 }
58 60
59 scoped_ptr<base::Value> SettingsPrivateDelegate::GetDefaultZoomPercent() { 61 scoped_ptr<base::Value> SettingsPrivateDelegate::GetDefaultZoomPercent() {
60 double zoom = content::ZoomLevelToZoomFactor( 62 double zoom = content::ZoomLevelToZoomFactor(
61 profile_->GetZoomLevelPrefs()->GetDefaultZoomLevelPref()) * 100; 63 profile_->GetZoomLevelPrefs()->GetDefaultZoomLevelPref()) * 100;
62 scoped_ptr<base::Value> value(new base::FundamentalValue(zoom)); 64 scoped_ptr<base::Value> value(new base::FundamentalValue(zoom));
63 return value.Pass(); 65 return value;
64 } 66 }
65 67
66 PrefsUtil::SetPrefResult SettingsPrivateDelegate::SetDefaultZoomPercent( 68 PrefsUtil::SetPrefResult SettingsPrivateDelegate::SetDefaultZoomPercent(
67 int percent) { 69 int percent) {
68 double zoom_factor = content::ZoomFactorToZoomLevel(percent * 0.01); 70 double zoom_factor = content::ZoomFactorToZoomLevel(percent * 0.01);
69 profile_->GetZoomLevelPrefs()->SetDefaultZoomLevelPref(zoom_factor); 71 profile_->GetZoomLevelPrefs()->SetDefaultZoomLevelPref(zoom_factor);
70 return PrefsUtil::SetPrefResult::SUCCESS; 72 return PrefsUtil::SetPrefResult::SUCCESS;
71 } 73 }
72 74
73 } // namespace extensions 75 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698