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

Unified Diff: chrome/browser/extensions/extension_install_ui.cc

Issue 430003: Revert change that disallowed content scripts access to file:// (Closed)
Patch Set: Can't go back, only through Created 11 years, 1 month 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
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_startup_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_install_ui.cc
diff --git a/chrome/browser/extensions/extension_install_ui.cc b/chrome/browser/extensions/extension_install_ui.cc
index c89a9fa581e2421262df24e97a69c0625817b298..cd29c9271246faa405c9359125d0cc6e85e7e964 100644
--- a/chrome/browser/extensions/extension_install_ui.cc
+++ b/chrome/browser/extensions/extension_install_ui.cc
@@ -21,6 +21,7 @@
#endif // TOOLKIT_VIEWS
#include "chrome/common/extensions/extension.h"
#include "chrome/common/notification_service.h"
+#include "chrome/common/url_constants.h"
#include "grit/browser_resources.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
@@ -39,6 +40,25 @@ static std::wstring GetInstallWarning(Extension* extension) {
if (!extension->plugins().empty())
return l10n_util::GetString(IDS_EXTENSION_PROMPT_WARNING_NEW_FULL_ACCESS);
+ // We also show the severe warning if the extension has access to any file://
+ // URLs. They aren't *quite* as dangerous as full access to the system via
+ // NPAPI, but pretty dang close. Content scripts are currently the only way
+ // that extension can get access to file:// URLs.
+ for (UserScriptList::const_iterator script =
+ extension->content_scripts().begin();
+ script != extension->content_scripts().end();
+ ++script) {
+ for (UserScript::PatternList::const_iterator pattern =
+ script->url_patterns().begin();
Finnur 2009/11/22 00:13:44 nit: That looks like 3 spaces, not 4... ? :) Also
+ pattern != script->url_patterns().end();
+ ++pattern) {
+ if (pattern->scheme() == chrome::kFileScheme) {
+ return l10n_util::GetString(
+ IDS_EXTENSION_PROMPT_WARNING_NEW_FULL_ACCESS);
+ }
+ }
+ }
+
// Otherwise, we go in descending order of severity: all hosts, several hosts,
// a single host, no hosts. For each of these, we also have a variation of the
// message for when api permissions are also requested.
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_startup_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698