OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/menu_manager.h" | 5 #include "chrome/browser/extensions/menu_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "chrome/browser/extensions/state_store.h" | 21 #include "chrome/browser/extensions/state_store.h" |
22 #include "chrome/browser/extensions/tab_helper.h" | 22 #include "chrome/browser/extensions/tab_helper.h" |
23 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
24 #include "chrome/common/extensions/api/context_menus.h" | 24 #include "chrome/common/extensions/api/context_menus.h" |
25 #include "chrome/common/extensions/background_info.h" | 25 #include "chrome/common/extensions/background_info.h" |
26 #include "chrome/common/extensions/extension.h" | 26 #include "chrome/common/extensions/extension.h" |
27 #include "content/public/browser/notification_details.h" | 27 #include "content/public/browser/notification_details.h" |
28 #include "content/public/browser/notification_source.h" | 28 #include "content/public/browser/notification_source.h" |
29 #include "content/public/browser/web_contents.h" | 29 #include "content/public/browser/web_contents.h" |
30 #include "content/public/common/context_menu_params.h" | 30 #include "content/public/common/context_menu_params.h" |
31 #include "ui/base/text/text_elider.h" | |
32 #include "ui/gfx/favicon_size.h" | 31 #include "ui/gfx/favicon_size.h" |
| 32 #include "ui/gfx/text_elider.h" |
33 | 33 |
34 using content::WebContents; | 34 using content::WebContents; |
35 using extensions::ExtensionSystem; | 35 using extensions::ExtensionSystem; |
36 | 36 |
37 namespace extensions { | 37 namespace extensions { |
38 | 38 |
39 namespace context_menus = api::context_menus; | 39 namespace context_menus = api::context_menus; |
40 | 40 |
41 namespace { | 41 namespace { |
42 | 42 |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 } | 166 } |
167 | 167 |
168 string16 MenuItem::TitleWithReplacement( | 168 string16 MenuItem::TitleWithReplacement( |
169 const string16& selection, size_t max_length) const { | 169 const string16& selection, size_t max_length) const { |
170 string16 result = UTF8ToUTF16(title_); | 170 string16 result = UTF8ToUTF16(title_); |
171 // TODO(asargent) - Change this to properly handle %% escaping so you can | 171 // TODO(asargent) - Change this to properly handle %% escaping so you can |
172 // put "%s" in titles that won't get substituted. | 172 // put "%s" in titles that won't get substituted. |
173 ReplaceSubstringsAfterOffset(&result, 0, ASCIIToUTF16("%s"), selection); | 173 ReplaceSubstringsAfterOffset(&result, 0, ASCIIToUTF16("%s"), selection); |
174 | 174 |
175 if (result.length() > max_length) | 175 if (result.length() > max_length) |
176 result = ui::TruncateString(result, max_length); | 176 result = gfx::TruncateString(result, max_length); |
177 return result; | 177 return result; |
178 } | 178 } |
179 | 179 |
180 bool MenuItem::SetChecked(bool checked) { | 180 bool MenuItem::SetChecked(bool checked) { |
181 if (type_ != CHECKBOX && type_ != RADIO) | 181 if (type_ != CHECKBOX && type_ != RADIO) |
182 return false; | 182 return false; |
183 checked_ = checked; | 183 checked_ = checked; |
184 return true; | 184 return true; |
185 } | 185 } |
186 | 186 |
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
864 if (uid < other.uid) | 864 if (uid < other.uid) |
865 return true; | 865 return true; |
866 if (uid == other.uid) | 866 if (uid == other.uid) |
867 return string_uid < other.string_uid; | 867 return string_uid < other.string_uid; |
868 } | 868 } |
869 } | 869 } |
870 return false; | 870 return false; |
871 } | 871 } |
872 | 872 |
873 } // namespace extensions | 873 } // namespace extensions |
OLD | NEW |