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

Unified Diff: chrome/browser/extensions/api/terminal/terminal_private_api.cc

Issue 9317013: Add a centralized mechanism for whitelisting access to extension permissions. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fix a couple tests Created 8 years, 11 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/terminal/terminal_private_api.cc
diff --git a/chrome/browser/extensions/api/terminal/terminal_private_api.cc b/chrome/browser/extensions/api/terminal/terminal_private_api.cc
index be7674716bc56f8413fe336b98ab25c055b1ba6b..bf9140ad42b1df05b0415b99f7c174beff938982 100644
--- a/chrome/browser/extensions/api/terminal/terminal_private_api.cc
+++ b/chrome/browser/extensions/api/terminal/terminal_private_api.cc
@@ -22,32 +22,6 @@ const char kCroshCommand[] = "/usr/bin/crosh";
// We make stubbed crosh just echo back input.
const char kStubbedCroshCommand[] = "cat";
-const char kPermissionError[] =
- "Extension does not have the permission to use this API";
-
-const char* kAllowedExtensionIds[] ={
- "okddffdblfhhnmhodogpojmfkjmhinfp", // test SSH/Crosh Client
- "pnhechapfaindjhompbnflcldabbghjo" // HTerm App
-};
-
-// Allow component and whitelisted extensions.
-bool AllowAccessToExtension(Profile* profile, const std::string& extension_id) {
- ExtensionService* service = profile->GetExtensionService();
- const Extension* extension = service->GetExtensionById(extension_id, false);
-
- if (!extension)
- return false;
-
- if (extension->location() == Extension::COMPONENT)
- return true;
-
- for (size_t i = 0; i < arraysize(kAllowedExtensionIds); i++) {
- if (extension->id() == kAllowedExtensionIds[i])
- return true;
- }
- return false;
-}
-
const char* GetCroshPath() {
if (chromeos::system::runtime_environment::IsRunningOnChromeOS())
return kCroshCommand;
@@ -75,8 +49,6 @@ void NotifyProcessOutput(Profile* profile,
return;
}
- CHECK(AllowAccessToExtension(profile, extension_id));
-
base::ListValue args;
args.Append(new base::FundamentalValue(pid));
args.Append(new base::StringValue(output_type));
@@ -101,11 +73,6 @@ TerminalPrivateFunction::~TerminalPrivateFunction() {
}
bool TerminalPrivateFunction::RunImpl() {
- if (!AllowAccessToExtension(profile_, extension_id())) {
- error_ = kPermissionError;
- return false;
- }
-
return RunTerminalFunction();
}

Powered by Google App Engine
This is Rietveld 408576698