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/extension_context_menu_model.h" | 5 #include "chrome/browser/extensions/extension_context_menu_model.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
10 #include "chrome/browser/extensions/context_menu_matcher.h" | 10 #include "chrome/browser/extensions/context_menu_matcher.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 #include "extensions/browser/management_policy.h" | 38 #include "extensions/browser/management_policy.h" |
39 #include "extensions/browser/uninstall_reason.h" | 39 #include "extensions/browser/uninstall_reason.h" |
40 #include "extensions/common/extension.h" | 40 #include "extensions/common/extension.h" |
41 #include "extensions/common/manifest_handlers/options_page_info.h" | 41 #include "extensions/common/manifest_handlers/options_page_info.h" |
42 #include "extensions/common/manifest_url_handlers.h" | 42 #include "extensions/common/manifest_url_handlers.h" |
43 #include "ui/base/l10n/l10n_util.h" | 43 #include "ui/base/l10n/l10n_util.h" |
44 #include "ui/base/resource/resource_bundle.h" | 44 #include "ui/base/resource/resource_bundle.h" |
45 #include "ui/gfx/color_palette.h" | 45 #include "ui/gfx/color_palette.h" |
46 #include "ui/gfx/image/image.h" | 46 #include "ui/gfx/image/image.h" |
47 #include "ui/gfx/paint_vector_icon.h" | 47 #include "ui/gfx/paint_vector_icon.h" |
48 #include "ui/gfx/vector_icons_public.h" | 48 #include "ui/vector_icons/vector_icons.h" |
49 | 49 |
50 namespace extensions { | 50 namespace extensions { |
51 | 51 |
52 namespace { | 52 namespace { |
53 | 53 |
54 // Returns true if the given |item| is of the given |type|. | 54 // Returns true if the given |item| is of the given |type|. |
55 bool MenuItemMatchesAction(ExtensionContextMenuModel::ActionType type, | 55 bool MenuItemMatchesAction(ExtensionContextMenuModel::ActionType type, |
56 const MenuItem* item) { | 56 const MenuItem* item) { |
57 if (type == ExtensionContextMenuModel::NO_ACTION) | 57 if (type == ExtensionContextMenuModel::NO_ACTION) |
58 return false; | 58 return false; |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 | 308 |
309 if (!is_component_) { | 309 if (!is_component_) { |
310 bool is_required_by_policy = | 310 bool is_required_by_policy = |
311 IsExtensionRequiredByPolicy(extension, profile_); | 311 IsExtensionRequiredByPolicy(extension, profile_); |
312 int message_id = is_required_by_policy ? | 312 int message_id = is_required_by_policy ? |
313 IDS_EXTENSIONS_INSTALLED_BY_ADMIN : IDS_EXTENSIONS_UNINSTALL; | 313 IDS_EXTENSIONS_INSTALLED_BY_ADMIN : IDS_EXTENSIONS_UNINSTALL; |
314 AddItem(UNINSTALL, l10n_util::GetStringUTF16(message_id)); | 314 AddItem(UNINSTALL, l10n_util::GetStringUTF16(message_id)); |
315 if (is_required_by_policy) { | 315 if (is_required_by_policy) { |
316 int uninstall_index = GetIndexOfCommandId(UNINSTALL); | 316 int uninstall_index = GetIndexOfCommandId(UNINSTALL); |
317 SetIcon(uninstall_index, | 317 SetIcon(uninstall_index, |
318 gfx::Image(gfx::CreateVectorIcon(gfx::VectorIconId::BUSINESS, 16, | 318 gfx::Image(gfx::CreateVectorIcon(ui::kBusinessIcon, 16, |
319 gfx::kChromeIconGrey))); | 319 gfx::kChromeIconGrey))); |
320 } | 320 } |
321 } | 321 } |
322 | 322 |
323 // Add a toggle visibility (show/hide) if the extension icon is shown on the | 323 // Add a toggle visibility (show/hide) if the extension icon is shown on the |
324 // toolbar. | 324 // toolbar. |
325 int visibility_string_id = | 325 int visibility_string_id = |
326 GetVisibilityStringId(profile_, extension, button_visibility); | 326 GetVisibilityStringId(profile_, extension, button_visibility); |
327 DCHECK_NE(-1, visibility_string_id); | 327 DCHECK_NE(-1, visibility_string_id); |
328 AddItemWithStringId(TOGGLE_VISIBILITY, visibility_string_id); | 328 AddItemWithStringId(TOGGLE_VISIBILITY, visibility_string_id); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 if (runner && runner->WantsToRun(extension)) | 445 if (runner && runner->WantsToRun(extension)) |
446 runner->RunBlockedActions(extension); | 446 runner->RunBlockedActions(extension); |
447 } | 447 } |
448 } | 448 } |
449 | 449 |
450 content::WebContents* ExtensionContextMenuModel::GetActiveWebContents() const { | 450 content::WebContents* ExtensionContextMenuModel::GetActiveWebContents() const { |
451 return browser_->tab_strip_model()->GetActiveWebContents(); | 451 return browser_->tab_strip_model()->GetActiveWebContents(); |
452 } | 452 } |
453 | 453 |
454 } // namespace extensions | 454 } // namespace extensions |
OLD | NEW |