| 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> |
| 8 #include <utility> |
| 9 |
| 7 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 8 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
| 9 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 10 #include "chrome/browser/extensions/extension_service.h" | 13 #include "chrome/browser/extensions/extension_service.h" |
| 11 #include "chrome/browser/extensions/updater/extension_updater.h" | 14 #include "chrome/browser/extensions/updater/extension_updater.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/ui/browser_finder.h" | 16 #include "chrome/browser/ui/browser_finder.h" |
| 14 #include "chrome/browser/ui/browser_navigator.h" | 17 #include "chrome/browser/ui/browser_navigator.h" |
| 15 #include "chrome/browser/ui/browser_window.h" | 18 #include "chrome/browser/ui/browser_window.h" |
| 16 #include "components/omaha_client/omaha_query_params.h" | 19 #include "components/update_client/update_query_params.h" |
| 17 #include "content/public/browser/notification_service.h" | 20 #include "content/public/browser/notification_service.h" |
| 18 #include "extensions/browser/extension_system.h" | 21 #include "extensions/browser/extension_system.h" |
| 19 #include "extensions/browser/notification_types.h" | 22 #include "extensions/browser/notification_types.h" |
| 20 #include "extensions/browser/warning_service.h" | 23 #include "extensions/browser/warning_service.h" |
| 21 #include "extensions/browser/warning_set.h" | 24 #include "extensions/browser/warning_set.h" |
| 22 #include "extensions/common/api/runtime.h" | 25 #include "extensions/common/api/runtime.h" |
| 23 | 26 |
| 24 #if defined(OS_CHROMEOS) | 27 #if defined(OS_CHROMEOS) |
| 25 #include "chromeos/dbus/dbus_thread_manager.h" | 28 #include "chromeos/dbus/dbus_thread_manager.h" |
| 26 #include "chromeos/dbus/power_manager_client.h" | 29 #include "chromeos/dbus/power_manager_client.h" |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 new Browser(Browser::CreateParams(profile, chrome::GetActiveDesktop())); | 177 new Browser(Browser::CreateParams(profile, chrome::GetActiveDesktop())); |
| 175 | 178 |
| 176 chrome::NavigateParams params( | 179 chrome::NavigateParams params( |
| 177 browser, uninstall_url, ui::PAGE_TRANSITION_CLIENT_REDIRECT); | 180 browser, uninstall_url, ui::PAGE_TRANSITION_CLIENT_REDIRECT); |
| 178 params.disposition = NEW_FOREGROUND_TAB; | 181 params.disposition = NEW_FOREGROUND_TAB; |
| 179 params.user_gesture = false; | 182 params.user_gesture = false; |
| 180 chrome::Navigate(¶ms); | 183 chrome::Navigate(¶ms); |
| 181 } | 184 } |
| 182 | 185 |
| 183 bool ChromeRuntimeAPIDelegate::GetPlatformInfo(PlatformInfo* info) { | 186 bool ChromeRuntimeAPIDelegate::GetPlatformInfo(PlatformInfo* info) { |
| 184 const char* os = omaha_client::OmahaQueryParams::GetOS(); | 187 const char* os = update_client::UpdateQueryParams::GetOS(); |
| 185 if (strcmp(os, "mac") == 0) { | 188 if (strcmp(os, "mac") == 0) { |
| 186 info->os = PlatformInfo::OS_MAC_; | 189 info->os = PlatformInfo::OS_MAC_; |
| 187 } else if (strcmp(os, "win") == 0) { | 190 } else if (strcmp(os, "win") == 0) { |
| 188 info->os = PlatformInfo::OS_WIN_; | 191 info->os = PlatformInfo::OS_WIN_; |
| 189 } else if (strcmp(os, "cros") == 0) { | 192 } else if (strcmp(os, "cros") == 0) { |
| 190 info->os = PlatformInfo::OS_CROS_; | 193 info->os = PlatformInfo::OS_CROS_; |
| 191 } else if (strcmp(os, "linux") == 0) { | 194 } else if (strcmp(os, "linux") == 0) { |
| 192 info->os = PlatformInfo::OS_LINUX_; | 195 info->os = PlatformInfo::OS_LINUX_; |
| 193 } else if (strcmp(os, "openbsd") == 0) { | 196 } else if (strcmp(os, "openbsd") == 0) { |
| 194 info->os = PlatformInfo::OS_OPENBSD_; | 197 info->os = PlatformInfo::OS_OPENBSD_; |
| 195 } else { | 198 } else { |
| 196 NOTREACHED(); | 199 NOTREACHED(); |
| 197 return false; | 200 return false; |
| 198 } | 201 } |
| 199 | 202 |
| 200 const char* arch = omaha_client::OmahaQueryParams::GetArch(); | 203 const char* arch = update_client::UpdateQueryParams::GetArch(); |
| 201 if (strcmp(arch, "arm") == 0) { | 204 if (strcmp(arch, "arm") == 0) { |
| 202 info->arch = PlatformInfo::ARCH_ARM; | 205 info->arch = PlatformInfo::ARCH_ARM; |
| 203 } else if (strcmp(arch, "x86") == 0) { | 206 } else if (strcmp(arch, "x86") == 0) { |
| 204 info->arch = PlatformInfo::ARCH_X86_32; | 207 info->arch = PlatformInfo::ARCH_X86_32; |
| 205 } else if (strcmp(arch, "x64") == 0) { | 208 } else if (strcmp(arch, "x64") == 0) { |
| 206 info->arch = PlatformInfo::ARCH_X86_64; | 209 info->arch = PlatformInfo::ARCH_X86_64; |
| 207 } else { | 210 } else { |
| 208 NOTREACHED(); | 211 NOTREACHED(); |
| 209 return false; | 212 return false; |
| 210 } | 213 } |
| 211 | 214 |
| 212 const char* nacl_arch = omaha_client::OmahaQueryParams::GetNaclArch(); | 215 const char* nacl_arch = update_client::UpdateQueryParams::GetNaclArch(); |
| 213 if (strcmp(nacl_arch, "arm") == 0) { | 216 if (strcmp(nacl_arch, "arm") == 0) { |
| 214 info->nacl_arch = PlatformInfo::NACL_ARCH_ARM; | 217 info->nacl_arch = PlatformInfo::NACL_ARCH_ARM; |
| 215 } else if (strcmp(nacl_arch, "x86-32") == 0) { | 218 } else if (strcmp(nacl_arch, "x86-32") == 0) { |
| 216 info->nacl_arch = PlatformInfo::NACL_ARCH_X86_32; | 219 info->nacl_arch = PlatformInfo::NACL_ARCH_X86_32; |
| 217 } else if (strcmp(nacl_arch, "x86-64") == 0) { | 220 } else if (strcmp(nacl_arch, "x86-64") == 0) { |
| 218 info->nacl_arch = PlatformInfo::NACL_ARCH_X86_64; | 221 info->nacl_arch = PlatformInfo::NACL_ARCH_X86_64; |
| 219 } else { | 222 } else { |
| 220 NOTREACHED(); | 223 NOTREACHED(); |
| 221 return false; | 224 return false; |
| 222 } | 225 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 const UpdateCheckResult& result) { | 274 const UpdateCheckResult& result) { |
| 272 UpdateCallbackList callbacks = pending_update_checks_[extension_id]; | 275 UpdateCallbackList callbacks = pending_update_checks_[extension_id]; |
| 273 pending_update_checks_.erase(extension_id); | 276 pending_update_checks_.erase(extension_id); |
| 274 for (UpdateCallbackList::const_iterator iter = callbacks.begin(); | 277 for (UpdateCallbackList::const_iterator iter = callbacks.begin(); |
| 275 iter != callbacks.end(); | 278 iter != callbacks.end(); |
| 276 ++iter) { | 279 ++iter) { |
| 277 const UpdateCheckCallback& callback = *iter; | 280 const UpdateCheckCallback& callback = *iter; |
| 278 callback.Run(result); | 281 callback.Run(result); |
| 279 } | 282 } |
| 280 } | 283 } |
| OLD | NEW |