Commit 33b8a1a1 authored by Dominick Ng's avatar Dominick Ng Committed by Commit Bot

Add new Touchable Chrome vector icons for the omnibox.

This CL adds the new omnibox vector icons for Touchable Chrome, and
uses them in place of the existing icons when the kTouchableChrome
feature is active.

BUG=801583
TBR=bajones@chromium.org

Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: I38b593e8ee3d734eadef00ea8b31c69affffc493
Reviewed-on: https://chromium-review.googlesource.com/885666
Commit-Queue: Dominick Ng <dominickn@chromium.org>
Reviewed-by: default avatarJustin Donnelly <jdonnelly@chromium.org>
Cr-Commit-Position: refs/heads/master@{#533163}
parent 3ac0c0fb
...@@ -253,7 +253,8 @@ void OnSuggestionModelAdded(UiScene* scene, ...@@ -253,7 +253,8 @@ void OnSuggestionModelAdded(UiScene* scene,
element_binding->bindings().push_back( element_binding->bindings().push_back(
VR_BIND(AutocompleteMatch::Type, SuggestionBinding, element_binding, VR_BIND(AutocompleteMatch::Type, SuggestionBinding, element_binding,
model->model()->type, VectorIcon, p_icon, model->model()->type, VectorIcon, p_icon,
view->SetIcon(AutocompleteMatch::TypeToVectorIcon(value)))); view->SetIcon(AutocompleteMatch::TypeToVectorIcon(
value, /*is_bookmark=*/false))));
element_binding->set_view(background.get()); element_binding->set_view(background.get());
scene->AddUiElement(kOmniboxSuggestions, std::move(background)); scene->AddUiElement(kOmniboxSuggestions, std::move(background));
} }
......
...@@ -31,6 +31,9 @@ aggregate_vector_icons("omnibox_vector_icons") { ...@@ -31,6 +31,9 @@ aggregate_vector_icons("omnibox_vector_icons") {
"star.1x.icon", "star.1x.icon",
"star.icon", "star.icon",
"tab.icon", "tab.icon",
"touchable_bookmark.icon",
"touchable_page.icon",
"touchable_search.icon",
] ]
} }
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "components/search_engines/template_url.h" #include "components/search_engines/template_url.h"
#include "components/search_engines/template_url_service.h" #include "components/search_engines/template_url_service.h"
#include "net/base/registry_controlled_domains/registry_controlled_domain.h" #include "net/base/registry_controlled_domains/registry_controlled_domain.h"
#include "ui/base/ui_base_features.h"
#include "ui/gfx/vector_icon_types.h" #include "ui/gfx/vector_icon_types.h"
#include "url/third_party/mozilla/url_parse.h" #include "url/third_party/mozilla/url_parse.h"
...@@ -185,8 +186,15 @@ AutocompleteMatch& AutocompleteMatch::operator=( ...@@ -185,8 +186,15 @@ AutocompleteMatch& AutocompleteMatch::operator=(
} }
// static // static
const gfx::VectorIcon& AutocompleteMatch::TypeToVectorIcon(Type type) { const gfx::VectorIcon& AutocompleteMatch::TypeToVectorIcon(Type type,
bool is_bookmark) {
#if (!defined(OS_ANDROID) || BUILDFLAG(ENABLE_VR)) && !defined(OS_IOS) #if (!defined(OS_ANDROID) || BUILDFLAG(ENABLE_VR)) && !defined(OS_IOS)
const bool is_touch_ui =
base::FeatureList::IsEnabled(features::kTouchableChrome);
if (is_bookmark)
return is_touch_ui ? omnibox::kTouchableBookmarkIcon : omnibox::kStarIcon;
switch (type) { switch (type) {
case Type::URL_WHAT_YOU_TYPED: case Type::URL_WHAT_YOU_TYPED:
case Type::HISTORY_URL: case Type::HISTORY_URL:
...@@ -199,7 +207,7 @@ const gfx::VectorIcon& AutocompleteMatch::TypeToVectorIcon(Type type) { ...@@ -199,7 +207,7 @@ const gfx::VectorIcon& AutocompleteMatch::TypeToVectorIcon(Type type) {
case Type::CLIPBOARD: case Type::CLIPBOARD:
case Type::PHYSICAL_WEB: case Type::PHYSICAL_WEB:
case Type::PHYSICAL_WEB_OVERFLOW: case Type::PHYSICAL_WEB_OVERFLOW:
return omnibox::kHttpIcon; return is_touch_ui ? omnibox::kTouchablePageIcon : omnibox::kHttpIcon;
case Type::TAB_SEARCH: case Type::TAB_SEARCH:
return omnibox::kTabIcon; return omnibox::kTabIcon;
...@@ -213,7 +221,8 @@ const gfx::VectorIcon& AutocompleteMatch::TypeToVectorIcon(Type type) { ...@@ -213,7 +221,8 @@ const gfx::VectorIcon& AutocompleteMatch::TypeToVectorIcon(Type type) {
case Type::SEARCH_OTHER_ENGINE: case Type::SEARCH_OTHER_ENGINE:
case Type::CONTACT_DEPRECATED: case Type::CONTACT_DEPRECATED:
case Type::VOICE_SUGGEST: case Type::VOICE_SUGGEST:
return vector_icons::kSearchIcon; return is_touch_ui ? omnibox::kTouchableSearchIcon
: vector_icons::kSearchIcon;
case Type::EXTENSION_APP: case Type::EXTENSION_APP:
return omnibox::kExtensionAppIcon; return omnibox::kExtensionAppIcon;
......
...@@ -114,8 +114,10 @@ struct AutocompleteMatch { ...@@ -114,8 +114,10 @@ struct AutocompleteMatch {
// Converts |type| to a string representation. Used in logging and debugging. // Converts |type| to a string representation. Used in logging and debugging.
AutocompleteMatch& operator=(const AutocompleteMatch& match); AutocompleteMatch& operator=(const AutocompleteMatch& match);
// Gets the vector icon identifier for the icon to be shown for |type|. // Gets the vector icon identifier for the icon to be shown for |type|. If
static const gfx::VectorIcon& TypeToVectorIcon(Type type); // |is_bookmark| is true, returns a bookmark icon rather than what the type
// would determine.
static const gfx::VectorIcon& TypeToVectorIcon(Type type, bool is_bookmark);
// Comparison function for determining when one match is better than another. // Comparison function for determining when one match is better than another.
static bool MoreRelevant(const AutocompleteMatch& elem1, static bool MoreRelevant(const AutocompleteMatch& elem1,
......
...@@ -291,8 +291,7 @@ gfx::Image OmniboxPopupModel::GetMatchIcon(const AutocompleteMatch& match, ...@@ -291,8 +291,7 @@ gfx::Image OmniboxPopupModel::GetMatchIcon(const AutocompleteMatch& match,
} }
const auto& vector_icon_type = const auto& vector_icon_type =
IsStarredMatch(match) ? omnibox::kStarIcon AutocompleteMatch::TypeToVectorIcon(match.type, IsStarredMatch(match));
: AutocompleteMatch::TypeToVectorIcon(match.type);
return gfx::Image( return gfx::Image(
gfx::CreateVectorIcon(vector_icon_type, 16, vector_icon_color)); gfx::CreateVectorIcon(vector_icon_type, 16, vector_icon_color));
} }
......
...@@ -107,7 +107,8 @@ const gfx::VectorIcon& OmniboxView::GetVectorIcon() const { ...@@ -107,7 +107,8 @@ const gfx::VectorIcon& OmniboxView::GetVectorIcon() const {
return AutocompleteMatch::TypeToVectorIcon( return AutocompleteMatch::TypeToVectorIcon(
model_ ? model_->CurrentTextType() model_ ? model_->CurrentTextType()
: AutocompleteMatchType::URL_WHAT_YOU_TYPED); : AutocompleteMatchType::URL_WHAT_YOU_TYPED,
/*is_bookmark=*/false);
} }
void OmniboxView::SetUserText(const base::string16& text) { void OmniboxView::SetUserText(const base::string16& text) {
......
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
CANVAS_DIMENSIONS, 20,
MOVE_TO, 10, 18,
R_ARC_TO, 8, 8, 0, 1, 1, 0, -16,
R_ARC_TO, 8, 8, 0, 0, 1, 0, 16,
CLOSE,
R_MOVE_TO, 0, -4.96f,
LINE_TO, 13.09f, 15,
R_LINE_TO, -0.82f, -3.7f,
LINE_TO, 15, 8.81f,
R_LINE_TO, -3.59f, -0.32f,
LINE_TO, 10, 5,
LINE_TO, 8.6f, 8.49f,
LINE_TO, 5, 8.81f,
R_LINE_TO, 2.73f, 2.49f,
R_LINE_TO, -0.82f, 3.7f,
LINE_TO, 10, 13.04f,
CLOSE,
END
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
CANVAS_DIMENSIONS, 20,
MOVE_TO, 6, 16.93f,
CUBIC_TO, 3.61f, 15.55f, 2, 12.96f, 2, 10,
CUBIC_TO, 2, 5.58f, 5.58f, 2, 10, 2,
CUBIC_TO, 14.42f, 2, 18, 5.58f, 18, 10,
CUBIC_TO, 18, 12.96f, 16.39f, 15.55f, 14, 16.93f,
LINE_TO, 14, 9.5f,
LINE_TO, 10.5f, 6,
LINE_TO, 6, 6,
LINE_TO, 6, 16.93f,
CLOSE,
MOVE_TO, 13, 11,
LINE_TO, 9, 11,
LINE_TO, 9, 7,
LINE_TO, 13, 11,
CLOSE,
END
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
CANVAS_DIMENSIONS, 20,
MOVE_TO, 16.02f, 15.27f,
R_LINE_TO, -2.59f, -2.6f,
R_H_LINE_TO, -0.47f,
R_LINE_TO, -0.17f, -0.16f,
R_ARC_TO, 3.84f, 3.84f, 0, 0, 0, 0.93f, -2.51f,
R_ARC_TO, 3.86f, 3.86f, 0, 0, 0, -3.86f, -3.86f,
ARC_TO, 3.86f, 3.86f, 0, 0, 0, 6, 10,
R_ARC_TO, 3.86f, 3.86f, 0, 0, 0, 6.37f, 2.93f,
R_LINE_TO, 0.16f, 0.17f,
R_V_LINE_TO, 0.47f,
R_LINE_TO, 2.59f, 2.59f,
R_ARC_TO, 8, 8, 0, 1, 1, 0.9f, -0.87f,
CLOSE,
MOVE_TO, 9.86f, 12.67f,
ARC_TO, 2.67f, 2.67f, 0, 0, 1, 7.19f, 10,
ARC_TO, 2.67f, 2.67f, 0, 0, 1, 9.86f, 7.33f,
ARC_TO, 2.67f, 2.67f, 0, 0, 1, 12.53f, 10,
R_ARC_TO, 2.67f, 2.67f, 0, 0, 1, -2.67f, 2.67f,
CLOSE,
END
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