OLD | NEW |
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 "base/utf_string_conversions.h" | 5 #include "base/utf_string_conversions.h" |
6 #include "chrome/app/chrome_command_ids.h" | 6 #include "chrome/app/chrome_command_ids.h" |
7 #include "chrome/browser/extensions/extension_browsertest.h" | 7 #include "chrome/browser/extensions/extension_browsertest.h" |
8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
9 #include "chrome/browser/extensions/extension_test_message_listener.h" | 9 #include "chrome/browser/extensions/extension_test_message_listener.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 } | 149 } |
150 | 150 |
151 // Shortcut to return the current ExtensionMenuManager. | 151 // Shortcut to return the current ExtensionMenuManager. |
152 ExtensionMenuManager* menu_manager() { | 152 ExtensionMenuManager* menu_manager() { |
153 return browser()->profile()->GetExtensionService()->menu_manager(); | 153 return browser()->profile()->GetExtensionService()->menu_manager(); |
154 } | 154 } |
155 | 155 |
156 // Returns a pointer to the currently loaded extension with |name|, or null | 156 // Returns a pointer to the currently loaded extension with |name|, or null |
157 // if not found. | 157 // if not found. |
158 const Extension* GetExtensionNamed(std::string name) { | 158 const Extension* GetExtensionNamed(std::string name) { |
159 const ExtensionSet* extensions = | 159 const ExtensionList* extensions = |
160 browser()->profile()->GetExtensionService()->extensions(); | 160 browser()->profile()->GetExtensionService()->extensions(); |
161 ExtensionSet::const_iterator i; | 161 ExtensionList::const_iterator i; |
162 for (i = extensions->begin(); i != extensions->end(); ++i) { | 162 for (i = extensions->begin(); i != extensions->end(); ++i) { |
163 if ((*i)->name() == name) { | 163 if ((*i)->name() == name) { |
164 return *i; | 164 return *i; |
165 } | 165 } |
166 } | 166 } |
167 return NULL; | 167 return NULL; |
168 } | 168 } |
169 | 169 |
170 // This gets all the items that any extension has registered for possible | 170 // This gets all the items that any extension has registered for possible |
171 // inclusion in context menus. | 171 // inclusion in context menus. |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 ASSERT_TRUE(MenuHasItemWithLabel( | 460 ASSERT_TRUE(MenuHasItemWithLabel( |
461 page_url, GURL(), no_frame_url, std::string("Page item"))); | 461 page_url, GURL(), no_frame_url, std::string("Page item"))); |
462 ASSERT_FALSE(MenuHasItemWithLabel( | 462 ASSERT_FALSE(MenuHasItemWithLabel( |
463 page_url, GURL(), no_frame_url, std::string("Frame item"))); | 463 page_url, GURL(), no_frame_url, std::string("Frame item"))); |
464 | 464 |
465 ASSERT_TRUE(MenuHasItemWithLabel( | 465 ASSERT_TRUE(MenuHasItemWithLabel( |
466 page_url, GURL(), frame_url, std::string("Page item"))); | 466 page_url, GURL(), frame_url, std::string("Page item"))); |
467 ASSERT_TRUE(MenuHasItemWithLabel( | 467 ASSERT_TRUE(MenuHasItemWithLabel( |
468 page_url, GURL(), frame_url, std::string("Frame item"))); | 468 page_url, GURL(), frame_url, std::string("Frame item"))); |
469 } | 469 } |
OLD | NEW |