Commit 6cdd975c authored by Elodie Banel's avatar Elodie Banel Committed by Commit Bot

Swap icons for location bar security states

This CL is the first step: create new imagesets + 1 function to return the
correct image name.

Bug: 821815
Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: Ia2ce8dc327226857b3105605b23b5b220edb9ff6
Reviewed-on: https://chromium-review.googlesource.com/1088912
Commit-Queue: Elodie Banel <lod@chromium.org>
Reviewed-by: default avatarJustin Cohen <justincohen@chromium.org>
Reviewed-by: default avatarStepan Khapugin <stkhapugin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#565628}
parent f63385d9
......@@ -75,3 +75,30 @@ imageset("location_bar_offline") {
"location_bar_offline.imageset/location_bar_offline@3x.png",
]
}
imageset("location_bar_secure") {
sources = [
"location_bar_secure.imageset/Contents.json",
"location_bar_secure.imageset/location_bar_secure.png",
"location_bar_secure.imageset/location_bar_secure@2x.png",
"location_bar_secure.imageset/location_bar_secure@3x.png",
]
}
imageset("location_bar_dangerous") {
sources = [
"location_bar_dangerous.imageset/Contents.json",
"location_bar_dangerous.imageset/location_bar_dangerous.png",
"location_bar_dangerous.imageset/location_bar_dangerous@2x.png",
"location_bar_dangerous.imageset/location_bar_dangerous@3x.png",
]
}
imageset("location_bar_insecure") {
sources = [
"location_bar_insecure.imageset/Contents.json",
"location_bar_insecure.imageset/location_bar_insecure.png",
"location_bar_insecure.imageset/location_bar_insecure@2x.png",
"location_bar_insecure.imageset/location_bar_insecure@3x.png",
]
}
{
"images": [
{
"idiom": "universal",
"scale": "1x",
"filename": "location_bar_dangerous.png"
},
{
"idiom": "universal",
"scale": "2x",
"filename": "location_bar_dangerous@2x.png"
},
{
"idiom": "universal",
"scale": "3x",
"filename": "location_bar_dangerous@3x.png"
}
],
"info": {
"version": 1,
"author": "xcode"
}
}
{
"images": [
{
"idiom": "universal",
"scale": "1x",
"filename": "location_bar_insecure.png"
},
{
"idiom": "universal",
"scale": "2x",
"filename": "location_bar_insecure@2x.png"
},
{
"idiom": "universal",
"scale": "3x",
"filename": "location_bar_insecure@3x.png"
}
],
"info": {
"version": 1,
"author": "xcode"
}
}
{
"images": [
{
"idiom": "universal",
"scale": "1x",
"filename": "location_bar_secure.png"
},
{
"idiom": "universal",
"scale": "2x",
"filename": "location_bar_secure@2x.png"
},
{
"idiom": "universal",
"scale": "3x",
"filename": "location_bar_secure@3x.png"
}
],
"info": {
"version": 1,
"author": "xcode"
}
}
......@@ -5,6 +5,7 @@
#include "ios/chrome/browser/ui/omnibox/omnibox_util.h"
#include "base/logging.h"
#include "base/strings/utf_string_conversions.h"
#include "ios/chrome/grit/ios_theme_resources.h"
int GetIconForAutocompleteMatchType(AutocompleteMatchType::Type type,
......@@ -71,3 +72,23 @@ int GetIconForSecurityState(security_state::SecurityLevel security_level) {
return IDR_IOS_OMNIBOX_HTTP;
}
}
base::string16 GetUIRefreshIconNameForSecurityState(
security_state::SecurityLevel security_level) {
switch (security_level) {
case security_state::NONE:
case security_state::HTTP_SHOW_WARNING:
return base::ASCIIToUTF16("location_bar_insecure");
case security_state::EV_SECURE:
case security_state::SECURE:
return base::ASCIIToUTF16("location_bar_secure");
case security_state::SECURE_WITH_POLICY_INSTALLED_CERT:
// TODO(crbug.com/848732): update this icon.
return base::ASCIIToUTF16("location_bar_secure");
case security_state::DANGEROUS:
return base::ASCIIToUTF16("location_bar_dangerous");
case security_state::SECURITY_LEVEL_COUNT:
NOTREACHED();
return base::ASCIIToUTF16("location_bar_insecure");
}
}
......@@ -18,4 +18,9 @@ int GetIconForAutocompleteMatchType(AutocompleteMatchType::Type type,
// for this security level in the omnibox.
int GetIconForSecurityState(security_state::SecurityLevel security_level);
// Converts |security_level| to the icon name used as a resource identifier for
// this security level in the location bar.
base::string16 GetUIRefreshIconNameForSecurityState(
security_state::SecurityLevel security_level);
#endif // IOS_CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_UTIL_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment