| OLD | NEW |
| 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/runtime/runtime_api.h" | 5 #include "chrome/browser/extensions/api/runtime/runtime_api.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
| 13 #include "chrome/browser/chrome_notification_types.h" | 13 #include "chrome/browser/chrome_notification_types.h" |
| 14 #include "chrome/browser/extensions/extension_host.h" | 14 #include "chrome/browser/extensions/extension_host.h" |
| 15 #include "chrome/browser/extensions/extension_service.h" | 15 #include "chrome/browser/extensions/extension_service.h" |
| 16 #include "chrome/browser/extensions/updater/extension_updater.h" | 16 #include "chrome/browser/extensions/updater/extension_updater.h" |
| 17 #include "chrome/browser/omaha_query_params/omaha_query_params.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/browser/profiles/profile_manager.h" | 19 #include "chrome/browser/profiles/profile_manager.h" |
| 19 #include "chrome/browser/ui/browser_finder.h" | 20 #include "chrome/browser/ui/browser_finder.h" |
| 20 #include "chrome/browser/ui/browser_navigator.h" | 21 #include "chrome/browser/ui/browser_navigator.h" |
| 21 #include "chrome/browser/ui/browser_window.h" | 22 #include "chrome/browser/ui/browser_window.h" |
| 22 #include "chrome/common/extensions/api/runtime.h" | 23 #include "chrome/common/extensions/api/runtime.h" |
| 23 #include "chrome/common/omaha_query_params/omaha_query_params.h" | |
| 24 #include "content/public/browser/child_process_security_policy.h" | 24 #include "content/public/browser/child_process_security_policy.h" |
| 25 #include "content/public/browser/notification_service.h" | 25 #include "content/public/browser/notification_service.h" |
| 26 #include "content/public/browser/render_process_host.h" | 26 #include "content/public/browser/render_process_host.h" |
| 27 #include "content/public/browser/render_view_host.h" | 27 #include "content/public/browser/render_view_host.h" |
| 28 #include "extensions/browser/event_router.h" | 28 #include "extensions/browser/event_router.h" |
| 29 #include "extensions/browser/extension_registry.h" | 29 #include "extensions/browser/extension_registry.h" |
| 30 #include "extensions/browser/extension_system.h" | 30 #include "extensions/browser/extension_system.h" |
| 31 #include "extensions/browser/extensions_browser_client.h" | 31 #include "extensions/browser/extensions_browser_client.h" |
| 32 #include "extensions/browser/lazy_background_task_queue.h" | 32 #include "extensions/browser/lazy_background_task_queue.h" |
| 33 #include "extensions/browser/process_manager.h" | 33 #include "extensions/browser/process_manager.h" |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 return true; | 514 return true; |
| 515 } | 515 } |
| 516 #endif | 516 #endif |
| 517 SetError("Function available only for ChromeOS kiosk mode."); | 517 SetError("Function available only for ChromeOS kiosk mode."); |
| 518 return false; | 518 return false; |
| 519 } | 519 } |
| 520 | 520 |
| 521 bool RuntimeGetPlatformInfoFunction::RunImpl() { | 521 bool RuntimeGetPlatformInfoFunction::RunImpl() { |
| 522 GetPlatformInfo::Results::PlatformInfo info; | 522 GetPlatformInfo::Results::PlatformInfo info; |
| 523 | 523 |
| 524 const char* os = chrome::OmahaQueryParams::getOS(); | 524 const char* os = chrome::OmahaQueryParams::GetOS(); |
| 525 if (strcmp(os, "mac") == 0) { | 525 if (strcmp(os, "mac") == 0) { |
| 526 info.os = GetPlatformInfo::Results::PlatformInfo::OS_MAC_; | 526 info.os = GetPlatformInfo::Results::PlatformInfo::OS_MAC_; |
| 527 } else if (strcmp(os, "win") == 0) { | 527 } else if (strcmp(os, "win") == 0) { |
| 528 info.os = GetPlatformInfo::Results::PlatformInfo::OS_WIN_; | 528 info.os = GetPlatformInfo::Results::PlatformInfo::OS_WIN_; |
| 529 } else if (strcmp(os, "android") == 0) { | 529 } else if (strcmp(os, "android") == 0) { |
| 530 info.os = GetPlatformInfo::Results::PlatformInfo::OS_ANDROID_; | 530 info.os = GetPlatformInfo::Results::PlatformInfo::OS_ANDROID_; |
| 531 } else if (strcmp(os, "cros") == 0) { | 531 } else if (strcmp(os, "cros") == 0) { |
| 532 info.os = GetPlatformInfo::Results::PlatformInfo::OS_CROS_; | 532 info.os = GetPlatformInfo::Results::PlatformInfo::OS_CROS_; |
| 533 } else if (strcmp(os, "linux") == 0) { | 533 } else if (strcmp(os, "linux") == 0) { |
| 534 info.os = GetPlatformInfo::Results::PlatformInfo::OS_LINUX_; | 534 info.os = GetPlatformInfo::Results::PlatformInfo::OS_LINUX_; |
| 535 } else if (strcmp(os, "openbsd") == 0) { | 535 } else if (strcmp(os, "openbsd") == 0) { |
| 536 info.os = GetPlatformInfo::Results::PlatformInfo::OS_OPENBSD_; | 536 info.os = GetPlatformInfo::Results::PlatformInfo::OS_OPENBSD_; |
| 537 } else { | 537 } else { |
| 538 NOTREACHED(); | 538 NOTREACHED(); |
| 539 return false; | 539 return false; |
| 540 } | 540 } |
| 541 | 541 |
| 542 const char* arch = chrome::OmahaQueryParams::getArch(); | 542 const char* arch = chrome::OmahaQueryParams::GetArch(); |
| 543 if (strcmp(arch, "arm") == 0) { | 543 if (strcmp(arch, "arm") == 0) { |
| 544 info.arch = GetPlatformInfo::Results::PlatformInfo::ARCH_ARM; | 544 info.arch = GetPlatformInfo::Results::PlatformInfo::ARCH_ARM; |
| 545 } else if (strcmp(arch, "x86") == 0) { | 545 } else if (strcmp(arch, "x86") == 0) { |
| 546 info.arch = GetPlatformInfo::Results::PlatformInfo::ARCH_X86_32; | 546 info.arch = GetPlatformInfo::Results::PlatformInfo::ARCH_X86_32; |
| 547 } else if (strcmp(arch, "x64") == 0) { | 547 } else if (strcmp(arch, "x64") == 0) { |
| 548 info.arch = GetPlatformInfo::Results::PlatformInfo::ARCH_X86_64; | 548 info.arch = GetPlatformInfo::Results::PlatformInfo::ARCH_X86_64; |
| 549 } else { | 549 } else { |
| 550 NOTREACHED(); | 550 NOTREACHED(); |
| 551 return false; | 551 return false; |
| 552 } | 552 } |
| 553 | 553 |
| 554 const char* nacl_arch = chrome::OmahaQueryParams::getNaclArch(); | 554 const char* nacl_arch = chrome::OmahaQueryParams::GetNaclArch(); |
| 555 if (strcmp(nacl_arch, "arm") == 0) { | 555 if (strcmp(nacl_arch, "arm") == 0) { |
| 556 info.nacl_arch = GetPlatformInfo::Results::PlatformInfo::NACL_ARCH_ARM; | 556 info.nacl_arch = GetPlatformInfo::Results::PlatformInfo::NACL_ARCH_ARM; |
| 557 } else if (strcmp(nacl_arch, "x86-32") == 0) { | 557 } else if (strcmp(nacl_arch, "x86-32") == 0) { |
| 558 info.nacl_arch = GetPlatformInfo::Results::PlatformInfo::NACL_ARCH_X86_32; | 558 info.nacl_arch = GetPlatformInfo::Results::PlatformInfo::NACL_ARCH_X86_32; |
| 559 } else if (strcmp(nacl_arch, "x86-64") == 0) { | 559 } else if (strcmp(nacl_arch, "x86-64") == 0) { |
| 560 info.nacl_arch = GetPlatformInfo::Results::PlatformInfo::NACL_ARCH_X86_64; | 560 info.nacl_arch = GetPlatformInfo::Results::PlatformInfo::NACL_ARCH_X86_64; |
| 561 } else { | 561 } else { |
| 562 NOTREACHED(); | 562 NOTREACHED(); |
| 563 return false; | 563 return false; |
| 564 } | 564 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 582 content::ChildProcessSecurityPolicy::GetInstance(); | 582 content::ChildProcessSecurityPolicy::GetInstance(); |
| 583 policy->GrantReadFileSystem(renderer_id, filesystem_id); | 583 policy->GrantReadFileSystem(renderer_id, filesystem_id); |
| 584 base::DictionaryValue* dict = new base::DictionaryValue(); | 584 base::DictionaryValue* dict = new base::DictionaryValue(); |
| 585 SetResult(dict); | 585 SetResult(dict); |
| 586 dict->SetString("fileSystemId", filesystem_id); | 586 dict->SetString("fileSystemId", filesystem_id); |
| 587 dict->SetString("baseName", relative_path); | 587 dict->SetString("baseName", relative_path); |
| 588 return true; | 588 return true; |
| 589 } | 589 } |
| 590 | 590 |
| 591 } // namespace extensions | 591 } // namespace extensions |
| OLD | NEW |