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

Side by Side Diff: chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate.cc

Issue 1226353004: Generate all extension schema namespaces as "api" and instead vary the generated bundle names. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/runtime/chrome_runtime_api_delegate.h" 5 #include "chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 19 matching lines...) Expand all
30 #if defined(OS_CHROMEOS) 30 #if defined(OS_CHROMEOS)
31 #include "chromeos/dbus/dbus_thread_manager.h" 31 #include "chromeos/dbus/dbus_thread_manager.h"
32 #include "chromeos/dbus/power_manager_client.h" 32 #include "chromeos/dbus/power_manager_client.h"
33 #include "components/user_manager/user_manager.h" 33 #include "components/user_manager/user_manager.h"
34 #endif 34 #endif
35 35
36 using extensions::Extension; 36 using extensions::Extension;
37 using extensions::ExtensionSystem; 37 using extensions::ExtensionSystem;
38 using extensions::ExtensionUpdater; 38 using extensions::ExtensionUpdater;
39 39
40 using extensions::core_api::runtime::PlatformInfo; 40 using extensions::api::runtime::PlatformInfo;
41 41
42 namespace { 42 namespace {
43 43
44 const char kUpdateThrottled[] = "throttled"; 44 const char kUpdateThrottled[] = "throttled";
45 const char kUpdateNotFound[] = "no_update"; 45 const char kUpdateNotFound[] = "no_update";
46 const char kUpdateFound[] = "update_available"; 46 const char kUpdateFound[] = "update_available";
47 47
48 // If an extension reloads itself within this many miliseconds of reloading 48 // If an extension reloads itself within this many miliseconds of reloading
49 // itself, the reload is considered suspiciously fast. 49 // itself, the reload is considered suspiciously fast.
50 const int kFastReloadTime = 10000; 50 const int kFastReloadTime = 10000;
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 chrome::NavigateParams params( 176 chrome::NavigateParams params(
177 browser, uninstall_url, ui::PAGE_TRANSITION_CLIENT_REDIRECT); 177 browser, uninstall_url, ui::PAGE_TRANSITION_CLIENT_REDIRECT);
178 params.disposition = NEW_FOREGROUND_TAB; 178 params.disposition = NEW_FOREGROUND_TAB;
179 params.user_gesture = false; 179 params.user_gesture = false;
180 chrome::Navigate(&params); 180 chrome::Navigate(&params);
181 } 181 }
182 182
183 bool ChromeRuntimeAPIDelegate::GetPlatformInfo(PlatformInfo* info) { 183 bool ChromeRuntimeAPIDelegate::GetPlatformInfo(PlatformInfo* info) {
184 const char* os = update_client::UpdateQueryParams::GetOS(); 184 const char* os = update_client::UpdateQueryParams::GetOS();
185 if (strcmp(os, "mac") == 0) { 185 if (strcmp(os, "mac") == 0) {
186 info->os = extensions::core_api::runtime::PLATFORM_OS_MAC; 186 info->os = extensions::api::runtime::PLATFORM_OS_MAC;
187 } else if (strcmp(os, "win") == 0) { 187 } else if (strcmp(os, "win") == 0) {
188 info->os = extensions::core_api::runtime::PLATFORM_OS_WIN; 188 info->os = extensions::api::runtime::PLATFORM_OS_WIN;
189 } else if (strcmp(os, "cros") == 0) { 189 } else if (strcmp(os, "cros") == 0) {
190 info->os = extensions::core_api::runtime::PLATFORM_OS_CROS; 190 info->os = extensions::api::runtime::PLATFORM_OS_CROS;
191 } else if (strcmp(os, "linux") == 0) { 191 } else if (strcmp(os, "linux") == 0) {
192 info->os = extensions::core_api::runtime::PLATFORM_OS_LINUX; 192 info->os = extensions::api::runtime::PLATFORM_OS_LINUX;
193 } else if (strcmp(os, "openbsd") == 0) { 193 } else if (strcmp(os, "openbsd") == 0) {
194 info->os = extensions::core_api::runtime::PLATFORM_OS_OPENBSD; 194 info->os = extensions::api::runtime::PLATFORM_OS_OPENBSD;
195 } else { 195 } else {
196 NOTREACHED(); 196 NOTREACHED();
197 return false; 197 return false;
198 } 198 }
199 199
200 const char* arch = update_client::UpdateQueryParams::GetArch(); 200 const char* arch = update_client::UpdateQueryParams::GetArch();
201 if (strcmp(arch, "arm") == 0) { 201 if (strcmp(arch, "arm") == 0) {
202 info->arch = extensions::core_api::runtime::PLATFORM_ARCH_ARM; 202 info->arch = extensions::api::runtime::PLATFORM_ARCH_ARM;
203 } else if (strcmp(arch, "x86") == 0) { 203 } else if (strcmp(arch, "x86") == 0) {
204 info->arch = extensions::core_api::runtime::PLATFORM_ARCH_X86_32; 204 info->arch = extensions::api::runtime::PLATFORM_ARCH_X86_32;
205 } else if (strcmp(arch, "x64") == 0) { 205 } else if (strcmp(arch, "x64") == 0) {
206 info->arch = extensions::core_api::runtime::PLATFORM_ARCH_X86_64; 206 info->arch = extensions::api::runtime::PLATFORM_ARCH_X86_64;
207 } else { 207 } else {
208 NOTREACHED(); 208 NOTREACHED();
209 return false; 209 return false;
210 } 210 }
211 211
212 const char* nacl_arch = update_client::UpdateQueryParams::GetNaclArch(); 212 const char* nacl_arch = update_client::UpdateQueryParams::GetNaclArch();
213 if (strcmp(nacl_arch, "arm") == 0) { 213 if (strcmp(nacl_arch, "arm") == 0) {
214 info->nacl_arch = 214 info->nacl_arch = extensions::api::runtime::PLATFORM_NACL_ARCH_ARM;
215 extensions::core_api::runtime::PLATFORM_NACL_ARCH_ARM;
216 } else if (strcmp(nacl_arch, "x86-32") == 0) { 215 } else if (strcmp(nacl_arch, "x86-32") == 0) {
217 info->nacl_arch = 216 info->nacl_arch = extensions::api::runtime::PLATFORM_NACL_ARCH_X86_32;
218 extensions::core_api::runtime::PLATFORM_NACL_ARCH_X86_32;
219 } else if (strcmp(nacl_arch, "x86-64") == 0) { 217 } else if (strcmp(nacl_arch, "x86-64") == 0) {
220 info->nacl_arch = 218 info->nacl_arch = extensions::api::runtime::PLATFORM_NACL_ARCH_X86_64;
221 extensions::core_api::runtime::PLATFORM_NACL_ARCH_X86_64;
222 } else { 219 } else {
223 NOTREACHED(); 220 NOTREACHED();
224 return false; 221 return false;
225 } 222 }
226 223
227 return true; 224 return true;
228 } 225 }
229 226
230 bool ChromeRuntimeAPIDelegate::RestartDevice(std::string* error_message) { 227 bool ChromeRuntimeAPIDelegate::RestartDevice(std::string* error_message) {
231 #if defined(OS_CHROMEOS) 228 #if defined(OS_CHROMEOS)
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 const UpdateCheckResult& result) { 280 const UpdateCheckResult& result) {
284 UpdateCallbackList callbacks = pending_update_checks_[extension_id]; 281 UpdateCallbackList callbacks = pending_update_checks_[extension_id];
285 pending_update_checks_.erase(extension_id); 282 pending_update_checks_.erase(extension_id);
286 for (UpdateCallbackList::const_iterator iter = callbacks.begin(); 283 for (UpdateCallbackList::const_iterator iter = callbacks.begin();
287 iter != callbacks.end(); 284 iter != callbacks.end();
288 ++iter) { 285 ++iter) {
289 const UpdateCheckCallback& callback = *iter; 286 const UpdateCheckCallback& callback = *iter;
290 callback.Run(result); 287 callback.Run(result);
291 } 288 }
292 } 289 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698