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

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

Issue 2399333002: Revert of Delete pre-MD code from OmniboxResultView (Closed)
Patch Set: Created 4 years, 2 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
OLDNEW
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 25 matching lines...) Expand all
36 #include "extensions/browser/extension_registry.h" 36 #include "extensions/browser/extension_registry.h"
37 #include "extensions/browser/extension_system.h" 37 #include "extensions/browser/extension_system.h"
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/feature_switch.h" 41 #include "extensions/common/feature_switch.h"
42 #include "extensions/common/manifest_handlers/options_page_info.h" 42 #include "extensions/common/manifest_handlers/options_page_info.h"
43 #include "extensions/common/manifest_url_handlers.h" 43 #include "extensions/common/manifest_url_handlers.h"
44 #include "ui/base/l10n/l10n_util.h" 44 #include "ui/base/l10n/l10n_util.h"
45 #include "ui/base/resource/resource_bundle.h" 45 #include "ui/base/resource/resource_bundle.h"
46 #include "ui/gfx/color_palette.h"
47 #include "ui/gfx/image/image.h" 46 #include "ui/gfx/image/image.h"
48 #include "ui/gfx/paint_vector_icon.h"
49 #include "ui/gfx/vector_icons_public.h"
50 47
51 namespace extensions { 48 namespace extensions {
52 49
53 namespace { 50 namespace {
54 51
55 // Returns true if the given |item| is of the given |type|. 52 // Returns true if the given |item| is of the given |type|.
56 bool MenuItemMatchesAction(ExtensionContextMenuModel::ActionType type, 53 bool MenuItemMatchesAction(ExtensionContextMenuModel::ActionType type,
57 const MenuItem* item) { 54 const MenuItem* item) {
58 if (type == ExtensionContextMenuModel::NO_ACTION) 55 if (type == ExtensionContextMenuModel::NO_ACTION)
59 return false; 56 return false;
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 320
324 if (!is_component_) { 321 if (!is_component_) {
325 bool is_required_by_policy = 322 bool is_required_by_policy =
326 IsExtensionRequiredByPolicy(extension, profile_); 323 IsExtensionRequiredByPolicy(extension, profile_);
327 int message_id = is_required_by_policy ? 324 int message_id = is_required_by_policy ?
328 IDS_EXTENSIONS_INSTALLED_BY_ADMIN : IDS_EXTENSIONS_UNINSTALL; 325 IDS_EXTENSIONS_INSTALLED_BY_ADMIN : IDS_EXTENSIONS_UNINSTALL;
329 AddItem(UNINSTALL, l10n_util::GetStringUTF16(message_id)); 326 AddItem(UNINSTALL, l10n_util::GetStringUTF16(message_id));
330 if (is_required_by_policy) { 327 if (is_required_by_policy) {
331 int uninstall_index = GetIndexOfCommandId(UNINSTALL); 328 int uninstall_index = GetIndexOfCommandId(UNINSTALL);
332 SetIcon(uninstall_index, 329 SetIcon(uninstall_index,
333 gfx::Image(gfx::CreateVectorIcon(gfx::VectorIconId::BUSINESS, 16, 330 ui::ResourceBundle::GetSharedInstance().GetImageNamed(
334 gfx::kChromeIconGrey))); 331 IDR_OMNIBOX_HTTPS_POLICY_WARNING));
335 } 332 }
336 } 333 }
337 334
338 // Add a toggle visibility (show/hide) if the extension icon is shown on the 335 // Add a toggle visibility (show/hide) if the extension icon is shown on the
339 // toolbar. 336 // toolbar.
340 int visibility_string_id = 337 int visibility_string_id =
341 GetVisibilityStringId(profile_, extension, button_visibility); 338 GetVisibilityStringId(profile_, extension, button_visibility);
342 if (visibility_string_id != -1) 339 if (visibility_string_id != -1)
343 AddItemWithStringId(TOGGLE_VISIBILITY, visibility_string_id); 340 AddItemWithStringId(TOGGLE_VISIBILITY, visibility_string_id);
344 341
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 if (runner && runner->WantsToRun(extension)) 457 if (runner && runner->WantsToRun(extension))
461 runner->RunBlockedActions(extension); 458 runner->RunBlockedActions(extension);
462 } 459 }
463 } 460 }
464 461
465 content::WebContents* ExtensionContextMenuModel::GetActiveWebContents() const { 462 content::WebContents* ExtensionContextMenuModel::GetActiveWebContents() const {
466 return browser_->tab_strip_model()->GetActiveWebContents(); 463 return browser_->tab_strip_model()->GetActiveWebContents();
467 } 464 }
468 465
469 } // namespace extensions 466 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/options/network_config_view.cc ('k') | chrome/browser/ui/app_list/search/omnibox_result.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698