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

Side by Side Diff: chrome/browser/extensions/extension_context_menu_api.cc

Issue 7258009: Remove scheme restriction for extension context menu items. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixing last nit Created 9 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_menu_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/extension_context_menu_api.h" 5 #include "chrome/browser/extensions/extension_context_menu_api.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 if (!properties.HasKey(key)) 132 if (!properties.HasKey(key))
133 return true; 133 return true;
134 ListValue* list = NULL; 134 ListValue* list = NULL;
135 if (!properties.GetList(key, &list)) 135 if (!properties.GetList(key, &list))
136 return false; 136 return false;
137 for (ListValue::iterator i = list->begin(); i != list->end(); ++i) { 137 for (ListValue::iterator i = list->begin(); i != list->end(); ++i) {
138 std::string tmp; 138 std::string tmp;
139 if (!(*i)->GetAsString(&tmp)) 139 if (!(*i)->GetAsString(&tmp))
140 return false; 140 return false;
141 141
142 URLPattern pattern(ExtensionMenuManager::kAllowedSchemes); 142 URLPattern pattern(URLPattern::SCHEME_ALL);
143 // TODO(skerner): Consider enabling strict pattern parsing 143 // TODO(skerner): Consider enabling strict pattern parsing
144 // if this extension's location indicates that it is under development. 144 // if this extension's location indicates that it is under development.
145 if (URLPattern::PARSE_SUCCESS != pattern.Parse(tmp, 145 if (URLPattern::PARSE_SUCCESS != pattern.Parse(tmp,
146 URLPattern::IGNORE_PORTS)) { 146 URLPattern::IGNORE_PORTS)) {
147 error_ = ExtensionErrorUtils::FormatErrorMessage(kInvalidURLPatternError, 147 error_ = ExtensionErrorUtils::FormatErrorMessage(kInvalidURLPatternError,
148 tmp); 148 tmp);
149 return false; 149 return false;
150 } 150 }
151 result->AddPattern(pattern); 151 result->AddPattern(pattern);
152 } 152 }
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 352
353 return manager->RemoveContextMenuItem(id); 353 return manager->RemoveContextMenuItem(id);
354 } 354 }
355 355
356 bool RemoveAllContextMenusFunction::RunImpl() { 356 bool RemoveAllContextMenusFunction::RunImpl() {
357 ExtensionService* service = profile()->GetExtensionService(); 357 ExtensionService* service = profile()->GetExtensionService();
358 ExtensionMenuManager* manager = service->menu_manager(); 358 ExtensionMenuManager* manager = service->menu_manager();
359 manager->RemoveAllContextItems(extension_id()); 359 manager->RemoveAllContextItems(extension_id());
360 return true; 360 return true;
361 } 361 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_menu_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698