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

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

Issue 2811049: Add ability to limit when context menu items appear with url patterns.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_menu_manager.h" 5 #include "chrome/browser/extensions/extension_menu_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/stl_util-inl.h" 10 #include "base/stl_util-inl.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 return false; 89 return false;
90 checked_ = checked; 90 checked_ = checked;
91 return true; 91 return true;
92 } 92 }
93 93
94 void ExtensionMenuItem::AddChild(ExtensionMenuItem* item) { 94 void ExtensionMenuItem::AddChild(ExtensionMenuItem* item) {
95 item->parent_id_.reset(new Id(id_)); 95 item->parent_id_.reset(new Id(id_));
96 children_.push_back(item); 96 children_.push_back(item);
97 } 97 }
98 98
99 const int ExtensionMenuManager::kAllowedSchemes =
100 URLPattern::SCHEME_HTTP | URLPattern::SCHEME_HTTPS;
101
99 ExtensionMenuManager::ExtensionMenuManager() { 102 ExtensionMenuManager::ExtensionMenuManager() {
100 registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, 103 registrar_.Add(this, NotificationType::EXTENSION_UNLOADED,
101 NotificationService::AllSources()); 104 NotificationService::AllSources());
102 } 105 }
103 106
104 ExtensionMenuManager::~ExtensionMenuManager() { 107 ExtensionMenuManager::~ExtensionMenuManager() {
105 MenuItemMap::iterator i; 108 MenuItemMap::iterator i;
106 for (i = context_items_.begin(); i != context_items_.end(); ++i) { 109 for (i = context_items_.begin(); i != context_items_.end(); ++i) {
107 STLDeleteElements(&(i->second)); 110 STLDeleteElements(&(i->second));
108 } 111 }
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 Extension* extension = Details<Extension>(details).ptr(); 442 Extension* extension = Details<Extension>(details).ptr();
440 if (ContainsKey(context_items_, extension->id())) { 443 if (ContainsKey(context_items_, extension->id())) {
441 RemoveAllContextItems(extension->id()); 444 RemoveAllContextItems(extension->id());
442 } 445 }
443 } 446 }
444 447
445 const SkBitmap& ExtensionMenuManager::GetIconForExtension( 448 const SkBitmap& ExtensionMenuManager::GetIconForExtension(
446 const std::string& extension_id) { 449 const std::string& extension_id) {
447 return icon_manager_.GetIcon(extension_id); 450 return icon_manager_.GetIcon(extension_id);
448 } 451 }
452
453 // static
454 bool ExtensionMenuManager::HasAllowedScheme(const GURL& url) {
455 URLPattern pattern(kAllowedSchemes);
456 return pattern.SetScheme(url.scheme());
457 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_menu_manager.h ('k') | chrome/browser/tab_contents/render_view_context_menu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698