| OLD | NEW |
| 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/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 chrome::NavigateParams params( | 180 chrome::NavigateParams params( |
| 181 browser, uninstall_url, ui::PAGE_TRANSITION_CLIENT_REDIRECT); | 181 browser, uninstall_url, ui::PAGE_TRANSITION_CLIENT_REDIRECT); |
| 182 params.disposition = NEW_FOREGROUND_TAB; | 182 params.disposition = NEW_FOREGROUND_TAB; |
| 183 params.user_gesture = false; | 183 params.user_gesture = false; |
| 184 chrome::Navigate(¶ms); | 184 chrome::Navigate(¶ms); |
| 185 } | 185 } |
| 186 | 186 |
| 187 bool ChromeRuntimeAPIDelegate::GetPlatformInfo(PlatformInfo* info) { | 187 bool ChromeRuntimeAPIDelegate::GetPlatformInfo(PlatformInfo* info) { |
| 188 const char* os = update_client::UpdateQueryParams::GetOS(); | 188 const char* os = update_client::UpdateQueryParams::GetOS(); |
| 189 if (strcmp(os, "mac") == 0) { | 189 if (strcmp(os, "mac") == 0) { |
| 190 info->os = PlatformInfo::OS_MAC_; | 190 info->os = extensions::core_api::runtime::PLATFORM_INFO_OS_MAC; |
| 191 } else if (strcmp(os, "win") == 0) { | 191 } else if (strcmp(os, "win") == 0) { |
| 192 info->os = PlatformInfo::OS_WIN_; | 192 info->os = extensions::core_api::runtime::PLATFORM_INFO_OS_WIN; |
| 193 } else if (strcmp(os, "cros") == 0) { | 193 } else if (strcmp(os, "cros") == 0) { |
| 194 info->os = PlatformInfo::OS_CROS_; | 194 info->os = extensions::core_api::runtime::PLATFORM_INFO_OS_CROS; |
| 195 } else if (strcmp(os, "linux") == 0) { | 195 } else if (strcmp(os, "linux") == 0) { |
| 196 info->os = PlatformInfo::OS_LINUX_; | 196 info->os = extensions::core_api::runtime::PLATFORM_INFO_OS_LINUX; |
| 197 } else if (strcmp(os, "openbsd") == 0) { | 197 } else if (strcmp(os, "openbsd") == 0) { |
| 198 info->os = PlatformInfo::OS_OPENBSD_; | 198 info->os = extensions::core_api::runtime::PLATFORM_INFO_OS_OPENBSD; |
| 199 } else { | 199 } else { |
| 200 NOTREACHED(); | 200 NOTREACHED(); |
| 201 return false; | 201 return false; |
| 202 } | 202 } |
| 203 | 203 |
| 204 const char* arch = update_client::UpdateQueryParams::GetArch(); | 204 const char* arch = update_client::UpdateQueryParams::GetArch(); |
| 205 if (strcmp(arch, "arm") == 0) { | 205 if (strcmp(arch, "arm") == 0) { |
| 206 info->arch = PlatformInfo::ARCH_ARM; | 206 info->arch = extensions::core_api::runtime::PLATFORM_INFO_ARCH_ARM; |
| 207 } else if (strcmp(arch, "x86") == 0) { | 207 } else if (strcmp(arch, "x86") == 0) { |
| 208 info->arch = PlatformInfo::ARCH_X86_32; | 208 info->arch = extensions::core_api::runtime::PLATFORM_INFO_ARCH_X86_32; |
| 209 } else if (strcmp(arch, "x64") == 0) { | 209 } else if (strcmp(arch, "x64") == 0) { |
| 210 info->arch = PlatformInfo::ARCH_X86_64; | 210 info->arch = extensions::core_api::runtime::PLATFORM_INFO_ARCH_X86_64; |
| 211 } else { | 211 } else { |
| 212 NOTREACHED(); | 212 NOTREACHED(); |
| 213 return false; | 213 return false; |
| 214 } | 214 } |
| 215 | 215 |
| 216 const char* nacl_arch = update_client::UpdateQueryParams::GetNaclArch(); | 216 const char* nacl_arch = update_client::UpdateQueryParams::GetNaclArch(); |
| 217 if (strcmp(nacl_arch, "arm") == 0) { | 217 if (strcmp(nacl_arch, "arm") == 0) { |
| 218 info->nacl_arch = PlatformInfo::NACL_ARCH_ARM; | 218 info->nacl_arch = |
| 219 extensions::core_api::runtime::PLATFORM_INFO_NACL_ARCH_ARM; |
| 219 } else if (strcmp(nacl_arch, "x86-32") == 0) { | 220 } else if (strcmp(nacl_arch, "x86-32") == 0) { |
| 220 info->nacl_arch = PlatformInfo::NACL_ARCH_X86_32; | 221 info->nacl_arch = |
| 222 extensions::core_api::runtime::PLATFORM_INFO_NACL_ARCH_X86_32; |
| 221 } else if (strcmp(nacl_arch, "x86-64") == 0) { | 223 } else if (strcmp(nacl_arch, "x86-64") == 0) { |
| 222 info->nacl_arch = PlatformInfo::NACL_ARCH_X86_64; | 224 info->nacl_arch = |
| 225 extensions::core_api::runtime::PLATFORM_INFO_NACL_ARCH_X86_64; |
| 223 } else { | 226 } else { |
| 224 NOTREACHED(); | 227 NOTREACHED(); |
| 225 return false; | 228 return false; |
| 226 } | 229 } |
| 227 | 230 |
| 228 return true; | 231 return true; |
| 229 } | 232 } |
| 230 | 233 |
| 231 bool ChromeRuntimeAPIDelegate::RestartDevice(std::string* error_message) { | 234 bool ChromeRuntimeAPIDelegate::RestartDevice(std::string* error_message) { |
| 232 #if defined(OS_CHROMEOS) | 235 #if defined(OS_CHROMEOS) |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 const UpdateCheckResult& result) { | 287 const UpdateCheckResult& result) { |
| 285 UpdateCallbackList callbacks = pending_update_checks_[extension_id]; | 288 UpdateCallbackList callbacks = pending_update_checks_[extension_id]; |
| 286 pending_update_checks_.erase(extension_id); | 289 pending_update_checks_.erase(extension_id); |
| 287 for (UpdateCallbackList::const_iterator iter = callbacks.begin(); | 290 for (UpdateCallbackList::const_iterator iter = callbacks.begin(); |
| 288 iter != callbacks.end(); | 291 iter != callbacks.end(); |
| 289 ++iter) { | 292 ++iter) { |
| 290 const UpdateCheckCallback& callback = *iter; | 293 const UpdateCheckCallback& callback = *iter; |
| 291 callback.Run(result); | 294 callback.Run(result); |
| 292 } | 295 } |
| 293 } | 296 } |
| OLD | NEW |