summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorasargent@chromium.org <asargent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-14 22:11:01 +0000
committerasargent@chromium.org <asargent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-14 22:11:01 +0000
commit39b7db000bae7fa07a79289a6e63724b62796ab0 (patch)
tree9a1982ed95c8d777c0ec16c0c313e6828fb29a19
parentf80f94f62d526bf1809f6fca73cab07503b973ee (diff)
downloadchromium_src-39b7db000bae7fa07a79289a6e63724b62796ab0.zip
chromium_src-39b7db000bae7fa07a79289a6e63724b62796ab0.tar.gz
chromium_src-39b7db000bae7fa07a79289a6e63724b62796ab0.tar.bz2
Remove scheme restriction for extension context menu items.
BUG=51461, 73631 TEST=Install an extension that adds context menu items - you should now see them on pages with schemes like chrome://, file://, chrome-extension://, etc. Review URL: http://codereview.chromium.org/7258009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92609 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/extensions/extension_context_menu_api.cc2
-rw-r--r--chrome/browser/extensions/extension_menu_manager.cc9
-rw-r--r--chrome/browser/extensions/extension_menu_manager.h8
-rw-r--r--chrome/browser/tab_contents/render_view_context_menu.cc3
-rw-r--r--chrome/common/extensions/docs/contextMenus.html16
-rw-r--r--chrome/common/extensions/docs/static/contextMenus.html16
6 files changed, 33 insertions, 21 deletions
diff --git a/chrome/browser/extensions/extension_context_menu_api.cc b/chrome/browser/extensions/extension_context_menu_api.cc
index d5f1e01..db91c4d 100644
--- a/chrome/browser/extensions/extension_context_menu_api.cc
+++ b/chrome/browser/extensions/extension_context_menu_api.cc
@@ -139,7 +139,7 @@ bool ExtensionContextMenuFunction::ParseURLPatterns(
if (!(*i)->GetAsString(&tmp))
return false;
- URLPattern pattern(ExtensionMenuManager::kAllowedSchemes);
+ URLPattern pattern(URLPattern::SCHEME_ALL);
// TODO(skerner): Consider enabling strict pattern parsing
// if this extension's location indicates that it is under development.
if (URLPattern::PARSE_SUCCESS != pattern.Parse(tmp,
diff --git a/chrome/browser/extensions/extension_menu_manager.cc b/chrome/browser/extensions/extension_menu_manager.cc
index 6e87364..71f24b7 100644
--- a/chrome/browser/extensions/extension_menu_manager.cc
+++ b/chrome/browser/extensions/extension_menu_manager.cc
@@ -92,9 +92,6 @@ void ExtensionMenuItem::AddChild(ExtensionMenuItem* item) {
children_.push_back(item);
}
-const int ExtensionMenuManager::kAllowedSchemes =
- URLPattern::SCHEME_HTTP | URLPattern::SCHEME_HTTPS;
-
ExtensionMenuManager::ExtensionMenuManager() {
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED,
NotificationService::AllSources());
@@ -469,12 +466,6 @@ const SkBitmap& ExtensionMenuManager::GetIconForExtension(
return icon_manager_.GetIcon(extension_id);
}
-// static
-bool ExtensionMenuManager::HasAllowedScheme(const GURL& url) {
- URLPattern pattern(kAllowedSchemes);
- return pattern.SetScheme(url.scheme());
-}
-
ExtensionMenuItem::Id::Id()
: profile(NULL), uid(0) {
}
diff --git a/chrome/browser/extensions/extension_menu_manager.h b/chrome/browser/extensions/extension_menu_manager.h
index 01471c7..0472225 100644
--- a/chrome/browser/extensions/extension_menu_manager.h
+++ b/chrome/browser/extensions/extension_menu_manager.h
@@ -193,10 +193,6 @@ class ExtensionMenuItem {
// This class keeps track of menu items added by extensions.
class ExtensionMenuManager : public NotificationObserver {
public:
- // A bitmask of values from URLPattern::SchemeMasks indicating the schemes
- // of pages where we'll show extension menu items.
- static const int kAllowedSchemes;
-
ExtensionMenuManager();
virtual ~ExtensionMenuManager();
@@ -253,10 +249,6 @@ class ExtensionMenuManager : public NotificationObserver {
virtual void Observe(int type, const NotificationSource& source,
const NotificationDetails& details);
- // Returns true if |url| has an allowed scheme for extension context menu
- // items. This checks against kAllowedSchemes.
- static bool HasAllowedScheme(const GURL& url);
-
private:
FRIEND_TEST_ALL_PREFIXES(ExtensionMenuManagerTest, DeleteParent);
FRIEND_TEST_ALL_PREFIXES(ExtensionMenuManagerTest, RemoveOneByOne);
diff --git a/chrome/browser/tab_contents/render_view_context_menu.cc b/chrome/browser/tab_contents/render_view_context_menu.cc
index eac5c8b..0121bcd 100644
--- a/chrome/browser/tab_contents/render_view_context_menu.cc
+++ b/chrome/browser/tab_contents/render_view_context_menu.cc
@@ -441,9 +441,6 @@ void RenderViewContextMenu::AppendAllExtensionItems() {
if (!service)
return; // In unit-tests, we may not have an ExtensionService.
ExtensionMenuManager* menu_manager = service->menu_manager();
- const GURL& document_url = GetDocumentURL(params_);
- if (!menu_manager->HasAllowedScheme(document_url))
- return;
// Get a list of extension id's that have context menu items, and sort it by
// the extension's name.
diff --git a/chrome/common/extensions/docs/contextMenus.html b/chrome/common/extensions/docs/contextMenus.html
index fd4bf04..81bc724 100644
--- a/chrome/common/extensions/docs/contextMenus.html
+++ b/chrome/common/extensions/docs/contextMenus.html
@@ -347,6 +347,22 @@ Google Chrome automatically collapses them
into a single parent menu.
</p>
+<p>
+Context menu items can appear in any document
+(or frame within a document),
+even those with file:// or chrome:// URLs.
+To control which documents your items can appear in,
+specify the documentUrlPatterns field
+when you call the create() or update() method.
+</p>
+
+<p class="note">
+<strong>Version note:</strong>
+Before Chrome 14, <!-- PENDING(asargent): fix version # -->
+your items could appear only in documents with http://
+or https:// URLs.
+</p>
+
<h2 id="manifest">Manifest</h2>
<p>You must declare the "contextMenus" permission
in your extension's manifest to use the API.
diff --git a/chrome/common/extensions/docs/static/contextMenus.html b/chrome/common/extensions/docs/static/contextMenus.html
index 26af21f..e993372 100644
--- a/chrome/common/extensions/docs/static/contextMenus.html
+++ b/chrome/common/extensions/docs/static/contextMenus.html
@@ -20,6 +20,22 @@ Google Chrome automatically collapses them
into a single parent menu.
</p>
+<p>
+Context menu items can appear in any document
+(or frame within a document),
+even those with file:// or chrome:// URLs.
+To control which documents your items can appear in,
+specify the documentUrlPatterns field
+when you call the create() or update() method.
+</p>
+
+<p class="note">
+<strong>Version note:</strong>
+Before Chrome 14, <!-- PENDING(asargent): fix version # -->
+your items could appear only in documents with http://
+or https:// URLs.
+</p>
+
<h2 id="manifest">Manifest</h2>
<p>You must declare the "contextMenus" permission
in your extension's manifest to use the API.