OLD | NEW |
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 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_MENU_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_MENU_MANAGER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_MENU_MANAGER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_MENU_MANAGER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 void set_title(std::string new_title) { title_ = new_title; } | 113 void set_title(std::string new_title) { title_ = new_title; } |
114 void set_contexts(ContextList contexts) { contexts_ = contexts; } | 114 void set_contexts(ContextList contexts) { contexts_ = contexts; } |
115 void set_type(Type type) { type_ = type; } | 115 void set_type(Type type) { type_ = type; } |
116 void set_document_url_patterns(const ExtensionExtent& patterns) { | 116 void set_document_url_patterns(const ExtensionExtent& patterns) { |
117 document_url_patterns_ = patterns; | 117 document_url_patterns_ = patterns; |
118 } | 118 } |
119 void set_target_url_patterns(const ExtensionExtent& patterns) { | 119 void set_target_url_patterns(const ExtensionExtent& patterns) { |
120 target_url_patterns_ = patterns; | 120 target_url_patterns_ = patterns; |
121 } | 121 } |
122 | 122 |
123 // Returns the title with any instances of %s replaced by |selection|. | 123 // Returns the title with any instances of %s replaced by |selection|. The |
124 string16 TitleWithReplacement(const string16& selection) const; | 124 // result will be no longer than |max_length|. |
| 125 string16 TitleWithReplacement(const string16& selection, |
| 126 size_t max_length) const; |
125 | 127 |
126 // Set the checked state to |checked|. Returns true if successful. | 128 // Set the checked state to |checked|. Returns true if successful. |
127 bool SetChecked(bool checked); | 129 bool SetChecked(bool checked); |
128 | 130 |
129 protected: | 131 protected: |
130 friend class ExtensionMenuManager; | 132 friend class ExtensionMenuManager; |
131 | 133 |
132 // Takes ownership of |item| and sets its parent_id_. | 134 // Takes ownership of |item| and sets its parent_id_. |
133 void AddChild(ExtensionMenuItem* item); | 135 void AddChild(ExtensionMenuItem* item); |
134 | 136 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 std::map<ExtensionMenuItem::Id, ExtensionMenuItem*> items_by_id_; | 265 std::map<ExtensionMenuItem::Id, ExtensionMenuItem*> items_by_id_; |
264 | 266 |
265 NotificationRegistrar registrar_; | 267 NotificationRegistrar registrar_; |
266 | 268 |
267 ExtensionIconManager icon_manager_; | 269 ExtensionIconManager icon_manager_; |
268 | 270 |
269 DISALLOW_COPY_AND_ASSIGN(ExtensionMenuManager); | 271 DISALLOW_COPY_AND_ASSIGN(ExtensionMenuManager); |
270 }; | 272 }; |
271 | 273 |
272 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MENU_MANAGER_H_ | 274 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MENU_MANAGER_H_ |
OLD | NEW |