Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1058)

Unified Diff: chrome/browser/extensions/api/system_info_cpu/system_info_cpu_api.cc

Issue 15817008: Move systemInfo.cpu API out out experimental namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;

Powered by Google App Engine
This is Rietveld 408576698