Chromium Code Reviews| Index: chrome/browser/extensions/api/system_info_cpu/system_info_cpu_api.cc |
| diff --git a/chrome/browser/extensions/api/system_info_cpu/system_info_cpu_api.cc b/chrome/browser/extensions/api/system_info_cpu/system_info_cpu_api.cc |
| index 37d3a0320acc37f0651fc899aa2ff3cc0f5b993c..d8fcac21fb8cf0ccb836cc5868666eec1d96bd94 100644 |
| --- a/chrome/browser/extensions/api/system_info_cpu/system_info_cpu_api.cc |
| +++ b/chrome/browser/extensions/api/system_info_cpu/system_info_cpu_api.cc |
| @@ -2,13 +2,15 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| +#include "base/command_line.h" |
| #include "chrome/browser/extensions/api/system_info_cpu/system_info_cpu_api.h" |
| - |
| #include "chrome/browser/extensions/api/system_info_cpu/cpu_info_provider.h" |
| +#include "chrome/common/chrome_switches.h" |
| +#include "chrome/common/extensions/features/base_feature_provider.h" |
| namespace extensions { |
| -using api::experimental_system_info_cpu::CpuInfo; |
| +using api::system_info_cpu::CpuInfo; |
| SystemInfoCpuGetFunction::SystemInfoCpuGetFunction() { |
| } |
| @@ -17,6 +19,16 @@ SystemInfoCpuGetFunction::~SystemInfoCpuGetFunction() { |
| } |
| bool SystemInfoCpuGetFunction::RunImpl() { |
| + const std::string& extension_id = GetExtension()->id(); |
| + |
| + if (CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| + switches::kWhitelistedExtensionID) != extension_id && |
| + !BaseFeatureProvider::GetPermissionFeatures()-> |
| + GetFeature("systemInfo.cpu")->IsIdInWhitelist(extension_id)) { |
| + SetError("Extension is not whitelisted to use systemInfo.cpu."); |
| + return false; |
|
asargent_no_longer_on_chrome
2013/05/30 19:14:00
Do you even need to do this? Doesn't ExtensionFunc
Tim Song
2013/05/31 01:08:35
Done. Apparently, I needed an non-empty list for t
|
| + } |
| + |
| CpuInfoProvider::Get()->StartQueryInfo( |
| base::Bind(&SystemInfoCpuGetFunction::OnGetCpuInfoCompleted, this)); |
| return true; |