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

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

Issue 2430463002: MD Settings: tweak some chrome.settingsPrivate method names (Closed)
Patch Set: histograms.xml Created 4 years, 2 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_api.h" 5 #include "chrome/browser/extensions/api/settings_private/settings_private_api.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 return RespondNow(Error(kDelegateIsNull)); 99 return RespondNow(Error(kDelegateIsNull));
100 100
101 std::unique_ptr<base::Value> value = delegate->GetPref(parameters->name); 101 std::unique_ptr<base::Value> value = delegate->GetPref(parameters->name);
102 if (value->IsType(base::Value::TYPE_NULL)) 102 if (value->IsType(base::Value::TYPE_NULL))
103 return RespondNow(Error("Pref * does not exist", parameters->name)); 103 return RespondNow(Error("Pref * does not exist", parameters->name));
104 else 104 else
105 return RespondNow(OneArgument(std::move(value))); 105 return RespondNow(OneArgument(std::move(value)));
106 } 106 }
107 107
108 //////////////////////////////////////////////////////////////////////////////// 108 ////////////////////////////////////////////////////////////////////////////////
109 // SettingsPrivateGetDefaultZoomPercentFunction 109 // SettingsPrivateGetDefaultZoomFunction
110 //////////////////////////////////////////////////////////////////////////////// 110 ////////////////////////////////////////////////////////////////////////////////
111 111
112 SettingsPrivateGetDefaultZoomPercentFunction:: 112 SettingsPrivateGetDefaultZoomFunction::
113 ~SettingsPrivateGetDefaultZoomPercentFunction() { 113 ~SettingsPrivateGetDefaultZoomFunction() {
114 } 114 }
115 115
116 ExtensionFunction::ResponseAction 116 ExtensionFunction::ResponseAction
117 SettingsPrivateGetDefaultZoomPercentFunction::Run() { 117 SettingsPrivateGetDefaultZoomFunction::Run() {
118 SettingsPrivateDelegate* delegate = 118 SettingsPrivateDelegate* delegate =
119 SettingsPrivateDelegateFactory::GetForBrowserContext(browser_context()); 119 SettingsPrivateDelegateFactory::GetForBrowserContext(browser_context());
120 120
121 if (delegate == nullptr) 121 if (delegate == nullptr)
122 return RespondNow(Error(kDelegateIsNull)); 122 return RespondNow(Error(kDelegateIsNull));
123 else 123 else
124 return RespondNow(OneArgument(delegate->GetDefaultZoomPercent())); 124 return RespondNow(OneArgument(delegate->GetDefaultZoom()));
125 } 125 }
126 126
127 //////////////////////////////////////////////////////////////////////////////// 127 ////////////////////////////////////////////////////////////////////////////////
128 // SettingsPrivateSetDefaultZoomPercentFunction 128 // SettingsPrivateSetDefaultZoomFunction
129 //////////////////////////////////////////////////////////////////////////////// 129 ////////////////////////////////////////////////////////////////////////////////
130 130
131 SettingsPrivateSetDefaultZoomPercentFunction:: 131 SettingsPrivateSetDefaultZoomFunction::
132 ~SettingsPrivateSetDefaultZoomPercentFunction() { 132 ~SettingsPrivateSetDefaultZoomFunction() {
133 } 133 }
134 134
135 ExtensionFunction::ResponseAction 135 ExtensionFunction::ResponseAction
136 SettingsPrivateSetDefaultZoomPercentFunction::Run() { 136 SettingsPrivateSetDefaultZoomFunction::Run() {
137 std::unique_ptr<api::settings_private::SetDefaultZoomPercent::Params> 137 std::unique_ptr<api::settings_private::SetDefaultZoom::Params> parameters =
138 parameters = 138 api::settings_private::SetDefaultZoom::Params::Create(*args_);
139 api::settings_private::SetDefaultZoomPercent::Params::Create(*args_);
140 EXTENSION_FUNCTION_VALIDATE(parameters.get()); 139 EXTENSION_FUNCTION_VALIDATE(parameters.get());
141 140
142 SettingsPrivateDelegate* delegate = 141 SettingsPrivateDelegate* delegate =
143 SettingsPrivateDelegateFactory::GetForBrowserContext(browser_context()); 142 SettingsPrivateDelegateFactory::GetForBrowserContext(browser_context());
144 if (delegate == nullptr) 143 if (delegate == nullptr)
145 return RespondNow(Error(kDelegateIsNull)); 144 return RespondNow(Error(kDelegateIsNull));
146 145
147 delegate->SetDefaultZoomPercent(parameters->percent); 146 delegate->SetDefaultZoom(parameters->zoom);
148 return RespondNow( 147 return RespondNow(
149 OneArgument(base::MakeUnique<base::FundamentalValue>(true))); 148 OneArgument(base::MakeUnique<base::FundamentalValue>(true)));
150 } 149 }
151 150
152 } // namespace extensions 151 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698