| 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 "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| 11 #include "chrome/browser/extensions/extension_service.h" | 11 #include "chrome/browser/extensions/extension_service.h" |
| 12 #include "chrome/browser/extensions/extension_warning_service.h" | 12 #include "chrome/browser/extensions/extension_warning_service.h" |
| 13 #include "chrome/browser/extensions/extension_warning_set.h" | 13 #include "chrome/browser/extensions/extension_warning_set.h" |
| 14 #include "chrome/browser/extensions/updater/extension_updater.h" | 14 #include "chrome/browser/extensions/updater/extension_updater.h" |
| 15 #include "chrome/browser/omaha_query_params/omaha_query_params.h" | |
| 16 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/ui/browser_finder.h" | 16 #include "chrome/browser/ui/browser_finder.h" |
| 18 #include "chrome/browser/ui/browser_navigator.h" | 17 #include "chrome/browser/ui/browser_navigator.h" |
| 19 #include "chrome/browser/ui/browser_window.h" | 18 #include "chrome/browser/ui/browser_window.h" |
| 19 #include "components/omaha_query_params/omaha_query_params.h" |
| 20 #include "content/public/browser/notification_service.h" | 20 #include "content/public/browser/notification_service.h" |
| 21 #include "extensions/browser/extension_system.h" | 21 #include "extensions/browser/extension_system.h" |
| 22 #include "extensions/common/api/runtime.h" | 22 #include "extensions/common/api/runtime.h" |
| 23 | 23 |
| 24 #if defined(OS_CHROMEOS) | 24 #if defined(OS_CHROMEOS) |
| 25 #include "chrome/browser/chromeos/login/users/user_manager.h" | 25 #include "chrome/browser/chromeos/login/users/user_manager.h" |
| 26 #include "chromeos/dbus/dbus_thread_manager.h" | 26 #include "chromeos/dbus/dbus_thread_manager.h" |
| 27 #include "chromeos/dbus/power_manager_client.h" | 27 #include "chromeos/dbus/power_manager_client.h" |
| 28 #endif | 28 #endif |
| 29 | 29 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 | 176 |
| 177 chrome::NavigateParams params( | 177 chrome::NavigateParams params( |
| 178 browser, uninstall_url, content::PAGE_TRANSITION_CLIENT_REDIRECT); | 178 browser, uninstall_url, content::PAGE_TRANSITION_CLIENT_REDIRECT); |
| 179 params.disposition = NEW_FOREGROUND_TAB; | 179 params.disposition = NEW_FOREGROUND_TAB; |
| 180 params.user_gesture = false; | 180 params.user_gesture = false; |
| 181 chrome::Navigate(¶ms); | 181 chrome::Navigate(¶ms); |
| 182 #endif | 182 #endif |
| 183 } | 183 } |
| 184 | 184 |
| 185 bool ChromeRuntimeAPIDelegate::GetPlatformInfo(PlatformInfo* info) { | 185 bool ChromeRuntimeAPIDelegate::GetPlatformInfo(PlatformInfo* info) { |
| 186 const char* os = chrome::OmahaQueryParams::GetOS(); | 186 const char* os = OmahaQueryParams::GetOS(); |
| 187 if (strcmp(os, "mac") == 0) { | 187 if (strcmp(os, "mac") == 0) { |
| 188 info->os = PlatformInfo::OS_MAC_; | 188 info->os = PlatformInfo::OS_MAC_; |
| 189 } else if (strcmp(os, "win") == 0) { | 189 } else if (strcmp(os, "win") == 0) { |
| 190 info->os = PlatformInfo::OS_WIN_; | 190 info->os = PlatformInfo::OS_WIN_; |
| 191 } else if (strcmp(os, "android") == 0) { | 191 } else if (strcmp(os, "android") == 0) { |
| 192 info->os = PlatformInfo::OS_ANDROID_; | 192 info->os = PlatformInfo::OS_ANDROID_; |
| 193 } else if (strcmp(os, "cros") == 0) { | 193 } else if (strcmp(os, "cros") == 0) { |
| 194 info->os = PlatformInfo::OS_CROS_; | 194 info->os = PlatformInfo::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 = PlatformInfo::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 = PlatformInfo::OS_OPENBSD_; |
| 199 } else { | 199 } else { |
| 200 NOTREACHED(); | 200 NOTREACHED(); |
| 201 return false; | 201 return false; |
| 202 } | 202 } |
| 203 | 203 |
| 204 const char* arch = chrome::OmahaQueryParams::GetArch(); | 204 const char* arch = OmahaQueryParams::GetArch(); |
| 205 if (strcmp(arch, "arm") == 0) { | 205 if (strcmp(arch, "arm") == 0) { |
| 206 info->arch = PlatformInfo::ARCH_ARM; | 206 info->arch = PlatformInfo::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 = PlatformInfo::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 = PlatformInfo::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 = chrome::OmahaQueryParams::GetNaclArch(); | 216 const char* nacl_arch = OmahaQueryParams::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 = PlatformInfo::NACL_ARCH_ARM; |
| 219 } else if (strcmp(nacl_arch, "x86-32") == 0) { | 219 } else if (strcmp(nacl_arch, "x86-32") == 0) { |
| 220 info->nacl_arch = PlatformInfo::NACL_ARCH_X86_32; | 220 info->nacl_arch = PlatformInfo::NACL_ARCH_X86_32; |
| 221 } else if (strcmp(nacl_arch, "x86-64") == 0) { | 221 } else if (strcmp(nacl_arch, "x86-64") == 0) { |
| 222 info->nacl_arch = PlatformInfo::NACL_ARCH_X86_64; | 222 info->nacl_arch = PlatformInfo::NACL_ARCH_X86_64; |
| 223 } else { | 223 } else { |
| 224 NOTREACHED(); | 224 NOTREACHED(); |
| 225 return false; | 225 return false; |
| 226 } | 226 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 const UpdateCheckResult& result) { | 275 const UpdateCheckResult& result) { |
| 276 UpdateCallbackList callbacks = pending_update_checks_[extension_id]; | 276 UpdateCallbackList callbacks = pending_update_checks_[extension_id]; |
| 277 pending_update_checks_.erase(extension_id); | 277 pending_update_checks_.erase(extension_id); |
| 278 for (UpdateCallbackList::const_iterator iter = callbacks.begin(); | 278 for (UpdateCallbackList::const_iterator iter = callbacks.begin(); |
| 279 iter != callbacks.end(); | 279 iter != callbacks.end(); |
| 280 ++iter) { | 280 ++iter) { |
| 281 const UpdateCheckCallback& callback = *iter; | 281 const UpdateCheckCallback& callback = *iter; |
| 282 callback.Run(result); | 282 callback.Run(result); |
| 283 } | 283 } |
| 284 } | 284 } |
| OLD | NEW |