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

Unified Diff: chrome/browser/extensions/api/system_private/system_private_api.cc

Issue 2261313002: [Extensions] Convert some SyncExtensionFunctions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ready Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/system_private/system_private_api.cc
diff --git a/chrome/browser/extensions/api/system_private/system_private_api.cc b/chrome/browser/extensions/api/system_private/system_private_api.cc
index ff98c4b1753bc3d3a9bb1ed71dcb42b7a62d11e1..025154a5bb015bbc0873ec8fa871141c46d1d900 100644
--- a/chrome/browser/extensions/api/system_private/system_private_api.cc
+++ b/chrome/browser/extensions/api/system_private/system_private_api.cc
@@ -70,18 +70,19 @@ namespace extensions {
namespace system_private = api::system_private;
-bool SystemPrivateGetIncognitoModeAvailabilityFunction::RunSync() {
- PrefService* prefs = GetProfile()->GetPrefs();
+ExtensionFunction::ResponseAction
+SystemPrivateGetIncognitoModeAvailabilityFunction::Run() {
+ PrefService* prefs =
+ Profile::FromBrowserContext(browser_context())->GetPrefs();
int value = prefs->GetInteger(prefs::kIncognitoModeAvailability);
EXTENSION_FUNCTION_VALIDATE(
value >= 0 &&
value < static_cast<int>(arraysize(kIncognitoModeAvailabilityStrings)));
- SetResult(base::MakeUnique<base::StringValue>(
- kIncognitoModeAvailabilityStrings[value]));
- return true;
+ return RespondNow(OneArgument(base::MakeUnique<base::StringValue>(
+ kIncognitoModeAvailabilityStrings[value])));
}
-bool SystemPrivateGetUpdateStatusFunction::RunSync() {
+ExtensionFunction::ResponseAction SystemPrivateGetUpdateStatusFunction::Run() {
std::string state;
double download_progress = 0;
#if defined(OS_CHROMEOS)
@@ -135,17 +136,16 @@ bool SystemPrivateGetUpdateStatusFunction::RunSync() {
state = kNotAvailableState;
}
#endif
+
std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
dict->SetString(kStateKey, state);
dict->SetDouble(kDownloadProgressKey, download_progress);
- SetResult(std::move(dict));
-
- return true;
+ return RespondNow(OneArgument(std::move(dict)));
}
-bool SystemPrivateGetApiKeyFunction::RunSync() {
- SetResult(base::MakeUnique<base::StringValue>(google_apis::GetAPIKey()));
- return true;
+ExtensionFunction::ResponseAction SystemPrivateGetApiKeyFunction::Run() {
+ return RespondNow(OneArgument(
+ base::MakeUnique<base::StringValue>(google_apis::GetAPIKey())));
}
void DispatchVolumeChangedEvent(double volume, bool is_volume_muted) {
« no previous file with comments | « chrome/browser/extensions/api/system_private/system_private_api.h ('k') | extensions/browser/api/management/management_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698