Chromium Code Reviews| 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/ui/page_info/page_info_ui.h" | 5 #include "chrome/browser/ui/page_info/page_info_ui.h" |
| 6 | 6 |
| 7 #include <utility> | |
| 8 | |
| 9 #include "base/command_line.h" | |
| 7 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "chrome/app/vector_icons/vector_icons.h" | |
| 8 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 12 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| 9 #include "chrome/browser/permissions/permission_manager.h" | 13 #include "chrome/browser/permissions/permission_manager.h" |
| 10 #include "chrome/browser/permissions/permission_result.h" | 14 #include "chrome/browser/permissions/permission_result.h" |
| 11 #include "chrome/browser/permissions/permission_util.h" | 15 #include "chrome/browser/permissions/permission_util.h" |
| 12 #include "chrome/browser/plugins/plugin_utils.h" | 16 #include "chrome/browser/plugins/plugin_utils.h" |
| 13 #include "chrome/browser/plugins/plugins_field_trial.h" | 17 #include "chrome/browser/plugins/plugins_field_trial.h" |
| 14 #include "chrome/common/chrome_features.h" | 18 #include "chrome/common/chrome_features.h" |
| 19 #include "chrome/common/chrome_switches.h" | |
| 15 #include "chrome/grit/chromium_strings.h" | 20 #include "chrome/grit/chromium_strings.h" |
| 16 #include "chrome/grit/generated_resources.h" | 21 #include "chrome/grit/generated_resources.h" |
| 17 #include "chrome/grit/theme_resources.h" | 22 #include "chrome/grit/theme_resources.h" |
| 18 #include "components/strings/grit/components_chromium_strings.h" | 23 #include "components/strings/grit/components_chromium_strings.h" |
| 19 #include "components/strings/grit/components_strings.h" | 24 #include "components/strings/grit/components_strings.h" |
| 20 #include "ppapi/features/features.h" | 25 #include "ppapi/features/features.h" |
| 21 #include "ui/base/l10n/l10n_util.h" | 26 #include "ui/base/l10n/l10n_util.h" |
| 22 #include "ui/base/resource/resource_bundle.h" | 27 #include "ui/base/resource/resource_bundle.h" |
| 28 #include "ui/gfx/color_palette.h" | |
| 23 #include "ui/gfx/image/image.h" | 29 #include "ui/gfx/image/image.h" |
| 30 #include "ui/gfx/paint_vector_icon.h" | |
| 24 #include "url/gurl.h" | 31 #include "url/gurl.h" |
| 25 | 32 |
| 26 namespace { | 33 namespace { |
| 27 | 34 |
| 28 const int kInvalidResourceID = -1; | 35 const int kInvalidResourceID = -1; |
| 29 | 36 |
| 30 // The resource IDs for the strings that are displayed on the permissions | 37 // The resource IDs for the strings that are displayed on the permissions |
| 31 // button if the permission setting is managed by policy. | 38 // button if the permission setting is managed by policy. |
| 32 const int kPermissionButtonTextIDPolicyManaged[] = { | 39 const int kPermissionButtonTextIDPolicyManaged[] = { |
| 33 kInvalidResourceID, | 40 kInvalidResourceID, |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 441 } | 448 } |
| 442 return resource_id; | 449 return resource_id; |
| 443 } | 450 } |
| 444 | 451 |
| 445 // static | 452 // static |
| 446 const gfx::Image& PageInfoUI::GetConnectionIcon( | 453 const gfx::Image& PageInfoUI::GetConnectionIcon( |
| 447 PageInfo::SiteConnectionStatus status) { | 454 PageInfo::SiteConnectionStatus status) { |
| 448 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 455 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 449 return rb.GetNativeImageNamed(GetConnectionIconID(status)); | 456 return rb.GetNativeImageNamed(GetConnectionIconID(status)); |
| 450 } | 457 } |
| 458 | |
| 459 // static | |
| 460 const gfx::Image PageInfoUI::GetCertificateIcon() { | |
| 461 gfx::Image image = gfx::Image( | |
| 462 gfx::CreateVectorIcon(kCertificateIcon, 16, gfx::kChromeIconGrey)); | |
| 463 return image; | |
|
Evan Stade
2017/04/27 21:58:04
nit: return gfx::Image(gfx::Create...
elawrence
2017/04/27 22:12:49
Done.
| |
| 464 } | |
| 465 | |
| 466 // static | |
| 467 bool PageInfoUI::ShouldShowCertificateLink() { | |
| 468 return base::CommandLine::ForCurrentProcess()->HasSwitch( | |
| 469 switches::kShowCertLink); | |
| 470 } | |
| OLD | NEW |