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

Side by Side Diff: chrome/browser/extensions/api/autotest_private/autotest_private_api.cc

Issue 252653002: Rename (Chrome)SyncExtensionFunction::RunImpl to RunSync so that the RunImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
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/api/autotest_private/autotest_private_api.h" 5 #include "chrome/browser/extensions/api/autotest_private/autotest_private_api.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "chrome/browser/extensions/extension_action_manager.h" 9 #include "chrome/browser/extensions/extension_action_manager.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 } 59 }
60 return permissions; 60 return permissions;
61 } 61 }
62 62
63 bool IsTestMode(Profile* profile) { 63 bool IsTestMode(Profile* profile) {
64 return AutotestPrivateAPI::GetFactoryInstance()->Get(profile)->test_mode(); 64 return AutotestPrivateAPI::GetFactoryInstance()->Get(profile)->test_mode();
65 } 65 }
66 66
67 } // namespace 67 } // namespace
68 68
69 bool AutotestPrivateLogoutFunction::RunImpl() { 69 bool AutotestPrivateLogoutFunction::RunSync() {
70 DVLOG(1) << "AutotestPrivateLogoutFunction"; 70 DVLOG(1) << "AutotestPrivateLogoutFunction";
71 if (!IsTestMode(GetProfile())) 71 if (!IsTestMode(GetProfile()))
72 chrome::AttemptUserExit(); 72 chrome::AttemptUserExit();
73 return true; 73 return true;
74 } 74 }
75 75
76 bool AutotestPrivateRestartFunction::RunImpl() { 76 bool AutotestPrivateRestartFunction::RunSync() {
77 DVLOG(1) << "AutotestPrivateRestartFunction"; 77 DVLOG(1) << "AutotestPrivateRestartFunction";
78 if (!IsTestMode(GetProfile())) 78 if (!IsTestMode(GetProfile()))
79 chrome::AttemptRestart(); 79 chrome::AttemptRestart();
80 return true; 80 return true;
81 } 81 }
82 82
83 bool AutotestPrivateShutdownFunction::RunImpl() { 83 bool AutotestPrivateShutdownFunction::RunSync() {
84 scoped_ptr<api::autotest_private::Shutdown::Params> params( 84 scoped_ptr<api::autotest_private::Shutdown::Params> params(
85 api::autotest_private::Shutdown::Params::Create(*args_)); 85 api::autotest_private::Shutdown::Params::Create(*args_));
86 EXTENSION_FUNCTION_VALIDATE(params.get()); 86 EXTENSION_FUNCTION_VALIDATE(params.get());
87 87
88 DVLOG(1) << "AutotestPrivateShutdownFunction " << params->force; 88 DVLOG(1) << "AutotestPrivateShutdownFunction " << params->force;
89 89
90 if (!IsTestMode(GetProfile())) 90 if (!IsTestMode(GetProfile()))
91 chrome::AttemptExit(); 91 chrome::AttemptExit();
92 return true; 92 return true;
93 } 93 }
94 94
95 bool AutotestPrivateLoginStatusFunction::RunImpl() { 95 bool AutotestPrivateLoginStatusFunction::RunSync() {
96 DVLOG(1) << "AutotestPrivateLoginStatusFunction"; 96 DVLOG(1) << "AutotestPrivateLoginStatusFunction";
97 97
98 base::DictionaryValue* result(new base::DictionaryValue); 98 base::DictionaryValue* result(new base::DictionaryValue);
99 #if defined(OS_CHROMEOS) 99 #if defined(OS_CHROMEOS)
100 const chromeos::UserManager* user_manager = chromeos::UserManager::Get(); 100 const chromeos::UserManager* user_manager = chromeos::UserManager::Get();
101 const bool is_screen_locked = 101 const bool is_screen_locked =
102 !!chromeos::ScreenLocker::default_screen_locker(); 102 !!chromeos::ScreenLocker::default_screen_locker();
103 103
104 if (user_manager) { 104 if (user_manager) {
105 result->SetBoolean("isLoggedIn", user_manager->IsUserLoggedIn()); 105 result->SetBoolean("isLoggedIn", user_manager->IsUserLoggedIn());
(...skipping 25 matching lines...) Expand all
131 } 131 }
132 result->SetString("userImage", user_image); 132 result->SetString("userImage", user_image);
133 } 133 }
134 } 134 }
135 #endif 135 #endif
136 136
137 SetResult(result); 137 SetResult(result);
138 return true; 138 return true;
139 } 139 }
140 140
141 bool AutotestPrivateLockScreenFunction::RunImpl() { 141 bool AutotestPrivateLockScreenFunction::RunSync() {
142 DVLOG(1) << "AutotestPrivateLockScreenFunction"; 142 DVLOG(1) << "AutotestPrivateLockScreenFunction";
143 #if defined(OS_CHROMEOS) 143 #if defined(OS_CHROMEOS)
144 chromeos::DBusThreadManager::Get()->GetSessionManagerClient()-> 144 chromeos::DBusThreadManager::Get()->GetSessionManagerClient()->
145 RequestLockScreen(); 145 RequestLockScreen();
146 #endif 146 #endif
147 return true; 147 return true;
148 } 148 }
149 149
150 bool AutotestPrivateGetExtensionsInfoFunction::RunImpl() { 150 bool AutotestPrivateGetExtensionsInfoFunction::RunSync() {
151 DVLOG(1) << "AutotestPrivateGetExtensionsInfoFunction"; 151 DVLOG(1) << "AutotestPrivateGetExtensionsInfoFunction";
152 152
153 ExtensionService* service = extensions::ExtensionSystem::Get( 153 ExtensionService* service = extensions::ExtensionSystem::Get(
154 GetProfile())->extension_service(); 154 GetProfile())->extension_service();
155 ExtensionRegistry* registry = 155 ExtensionRegistry* registry =
156 extensions::ExtensionRegistry::Get(GetProfile()); 156 extensions::ExtensionRegistry::Get(GetProfile());
157 const ExtensionSet& extensions = registry->enabled_extensions(); 157 const ExtensionSet& extensions = registry->enabled_extensions();
158 const ExtensionSet& disabled_extensions = registry->disabled_extensions(); 158 const ExtensionSet& disabled_extensions = registry->disabled_extensions();
159 ExtensionActionManager* extension_action_manager = 159 ExtensionActionManager* extension_action_manager =
160 ExtensionActionManager::Get(GetProfile()); 160 ExtensionActionManager::Get(GetProfile());
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 base::DictionaryValue* return_value(new base::DictionaryValue); 205 base::DictionaryValue* return_value(new base::DictionaryValue);
206 return_value->Set("extensions", extensions_values); 206 return_value->Set("extensions", extensions_values);
207 SetResult(return_value); 207 SetResult(return_value);
208 return true; 208 return true;
209 } 209 }
210 210
211 static int AccessArray(const volatile int arr[], const volatile int *index) { 211 static int AccessArray(const volatile int arr[], const volatile int *index) {
212 return arr[*index]; 212 return arr[*index];
213 } 213 }
214 214
215 bool AutotestPrivateSimulateAsanMemoryBugFunction::RunImpl() { 215 bool AutotestPrivateSimulateAsanMemoryBugFunction::RunSync() {
216 DVLOG(1) << "AutotestPrivateSimulateAsanMemoryBugFunction"; 216 DVLOG(1) << "AutotestPrivateSimulateAsanMemoryBugFunction";
217 if (!IsTestMode(GetProfile())) { 217 if (!IsTestMode(GetProfile())) {
218 // This array is volatile not to let compiler optimize us out. 218 // This array is volatile not to let compiler optimize us out.
219 volatile int testarray[3] = {0, 0, 0}; 219 volatile int testarray[3] = {0, 0, 0};
220 220
221 // Cause Address Sanitizer to abort this process. 221 // Cause Address Sanitizer to abort this process.
222 volatile int index = 5; 222 volatile int index = 5;
223 AccessArray(testarray, &index); 223 AccessArray(testarray, &index);
224 } 224 }
225 return true; 225 return true;
(...skipping 15 matching lines...) Expand all
241 return new AutotestPrivateAPI(); 241 return new AutotestPrivateAPI();
242 } 242 }
243 243
244 AutotestPrivateAPI::AutotestPrivateAPI() : test_mode_(false) { 244 AutotestPrivateAPI::AutotestPrivateAPI() : test_mode_(false) {
245 } 245 }
246 246
247 AutotestPrivateAPI::~AutotestPrivateAPI() { 247 AutotestPrivateAPI::~AutotestPrivateAPI() {
248 } 248 }
249 249
250 } // namespace extensions 250 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698