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

Side by Side Diff: chrome/browser/extensions/system/system_api.cc

Issue 10694106: Added support for multiple parameters to Extension API callbacks. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Indentation fixes and comment. Created 8 years, 5 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/extensions/system/system_api.h" 5 #include "chrome/browser/extensions/system/system_api.h"
6 6
7 #include "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/extensions/extension_event_router.h" 9 #include "chrome/browser/extensions/extension_event_router.h"
10 #include "chrome/browser/prefs/pref_service.h" 10 #include "chrome/browser/prefs/pref_service.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 } // namespace 66 } // namespace
67 67
68 namespace extensions { 68 namespace extensions {
69 69
70 bool GetIncognitoModeAvailabilityFunction::RunImpl() { 70 bool GetIncognitoModeAvailabilityFunction::RunImpl() {
71 PrefService* prefs = profile_->GetPrefs(); 71 PrefService* prefs = profile_->GetPrefs();
72 int value = prefs->GetInteger(prefs::kIncognitoModeAvailability); 72 int value = prefs->GetInteger(prefs::kIncognitoModeAvailability);
73 EXTENSION_FUNCTION_VALIDATE( 73 EXTENSION_FUNCTION_VALIDATE(
74 value >= 0 && 74 value >= 0 &&
75 value < static_cast<int>(arraysize(kIncognitoModeAvailabilityStrings))); 75 value < static_cast<int>(arraysize(kIncognitoModeAvailabilityStrings)));
76 result_.reset( 76 SetSingleResult(
77 Value::CreateStringValue(kIncognitoModeAvailabilityStrings[value])); 77 Value::CreateStringValue(kIncognitoModeAvailabilityStrings[value]));
78 return true; 78 return true;
79 } 79 }
80 80
81 bool GetUpdateStatusFunction::RunImpl() { 81 bool GetUpdateStatusFunction::RunImpl() {
82 std::string state; 82 std::string state;
83 double download_progress = 0; 83 double download_progress = 0;
84 #if defined(OS_CHROMEOS) 84 #if defined(OS_CHROMEOS)
85 // With UpdateEngineClient, we can provide more detailed information about 85 // With UpdateEngineClient, we can provide more detailed information about
86 // system updates on ChromeOS. 86 // system updates on ChromeOS.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 if (UpgradeDetector::GetInstance()->notify_upgrade()) { 127 if (UpgradeDetector::GetInstance()->notify_upgrade()) {
128 state = kNeedRestartState; 128 state = kNeedRestartState;
129 download_progress = 1; 129 download_progress = 1;
130 } else { 130 } else {
131 state = kNotAvailableState; 131 state = kNotAvailableState;
132 } 132 }
133 #endif 133 #endif
134 DictionaryValue* dict = new DictionaryValue(); 134 DictionaryValue* dict = new DictionaryValue();
135 dict->SetString(kStateKey, state); 135 dict->SetString(kStateKey, state);
136 dict->SetDouble(kDownloadProgressKey, download_progress); 136 dict->SetDouble(kDownloadProgressKey, download_progress);
137 result_.reset(dict); 137 SetSingleResult(dict);
138 138
139 return true; 139 return true;
140 } 140 }
141 141
142 void DispatchVolumeChangedEvent(double volume, bool is_volume_muted) { 142 void DispatchVolumeChangedEvent(double volume, bool is_volume_muted) {
143 ListValue args; 143 ListValue args;
144 DictionaryValue* dict = new DictionaryValue(); 144 DictionaryValue* dict = new DictionaryValue();
145 dict->SetDouble(kVolumeKey, volume); 145 dict->SetDouble(kVolumeKey, volume);
146 dict->SetBoolean(kIsVolumeMutedKey, is_volume_muted); 146 dict->SetBoolean(kIsVolumeMutedKey, is_volume_muted);
147 args.Append(dict); 147 args.Append(dict);
(...skipping 13 matching lines...) Expand all
161 ListValue args; 161 ListValue args;
162 DispatchEvent(kOnScreenUnlocked, args); 162 DispatchEvent(kOnScreenUnlocked, args);
163 } 163 }
164 164
165 void DispatchWokeUpEvent() { 165 void DispatchWokeUpEvent() {
166 ListValue args; 166 ListValue args;
167 DispatchEvent(kOnWokeUp, args); 167 DispatchEvent(kOnWokeUp, args);
168 } 168 }
169 169
170 } // namespace extensions 170 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698