Commit baea0591 authored by Tim Song's avatar Tim Song Committed by Commit Bot

[CrOS PhoneHub] Show default favicon if one is not available.

https://screenshot.googleplex.com/SgbgU5UtXDYGaCN.png

BUG=1146567,1106937

Change-Id: I7739c9938d7082bd274ef944df875c43f68d726e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2533315Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Reviewed-by: default avatarRegan Hsu <hsuregan@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Tim Song <tengs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#826920}
parent 2ef0afa4
...@@ -143,6 +143,7 @@ aggregate_vector_icons("ash_vector_icons") { ...@@ -143,6 +143,7 @@ aggregate_vector_icons("ash_vector_icons") {
"palette_tray_icon_metalayer.icon", "palette_tray_icon_metalayer.icon",
"phone_hub_battery_saver.icon", "phone_hub_battery_saver.icon",
"phone_hub_battery_saver_outline.icon", "phone_hub_battery_saver_outline.icon",
"phone_hub_default_favicon.icon",
"phone_hub_enable_hotspot_off.icon", "phone_hub_enable_hotspot_off.icon",
"phone_hub_enable_hotspot_on.icon", "phone_hub_enable_hotspot_on.icon",
"phone_hub_locate_phone_off.icon", "phone_hub_locate_phone_off.icon",
......
CANVAS_DIMENSIONS, 16,
CIRCLE, 8, 8, 8,
CLOSE,
MOVE_TO, 13.83f, 8,
CUBIC_TO, 13.83f, 4.78f, 11.22f, 2.17f, 8, 2.17f,
CUBIC_TO, 4.78f, 2.17f, 2.17f, 4.78f, 2.17f, 8,
CUBIC_TO, 2.17f, 11.22f, 4.78f, 13.83f, 8, 13.83f,
CUBIC_TO, 11.22f, 13.83f, 13.83f, 11.22f, 13.83f, 8,
CLOSE,
MOVE_TO, 5.9f, 8,
LINE_TO, 3.33f, 8,
CUBIC_TO, 3.33f, 5.42f, 5.42f, 3.33f, 8, 3.33f,
CUBIC_TO, 8.35f, 3.33f, 8.68f, 3.37f, 9.01f, 3.44f,
CUBIC_TO, 8.72f, 3.66f, 8.53f, 4.02f, 8.53f, 4.59f,
CUBIC_TO, 7.26f, 4.59f, 6.7f, 5.39f, 6.86f, 6.98f,
LINE_TO, 9.05f, 6.98f,
CUBIC_TO, 9.05f, 8.05f, 9.67f, 8.58f, 10.92f, 8.58f,
CUBIC_TO, 11.69f, 8.58f, 12.27f, 8.29f, 12.66f, 7.72f,
CUBIC_TO, 12.66f, 7.81f, 12.67f, 7.9f, 12.67f, 8,
CUBIC_TO, 12.67f, 10.58f, 10.58f, 12.67f, 8, 12.67f,
CUBIC_TO, 7.49f, 12.67f, 6.99f, 12.58f, 6.53f, 12.43f,
LINE_TO, 6.53f, 10.99f,
LINE_TO, 8.55f, 10.99f,
CUBIC_TO, 8.77f, 9.01f, 7.89f, 8.01f, 5.9f, 8,
CLOSE
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "ash/system/phonehub/continue_browsing_chip.h" #include "ash/system/phonehub/continue_browsing_chip.h"
#include "ash/public/cpp/new_window_delegate.h" #include "ash/public/cpp/new_window_delegate.h"
#include "ash/resources/vector_icons/vector_icons.h"
#include "ash/root_window_controller.h" #include "ash/root_window_controller.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/style/ash_color_provider.h" #include "ash/style/ash_color_provider.h"
...@@ -13,6 +14,7 @@ ...@@ -13,6 +14,7 @@
#include "ash/system/status_area_widget.h" #include "ash/system/status_area_widget.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "chromeos/components/multidevice/logging/logging.h" #include "chromeos/components/multidevice/logging/logging.h"
#include "ui/gfx/paint_vector_icon.h"
#include "ui/views/controls/highlight_path_generator.h" #include "ui/views/controls/highlight_path_generator.h"
#include "ui/views/controls/image_view.h" #include "ui/views/controls/image_view.h"
#include "ui/views/controls/label.h" #include "ui/views/controls/label.h"
...@@ -70,7 +72,15 @@ ContinueBrowsingChip::ContinueBrowsingChip( ...@@ -70,7 +72,15 @@ ContinueBrowsingChip::ContinueBrowsingChip(
auto* favicon = auto* favicon =
header_view->AddChildView(std::make_unique<views::ImageView>()); header_view->AddChildView(std::make_unique<views::ImageView>());
favicon->SetImageSize(kContinueBrowsingChipFaviconSize); favicon->SetImageSize(kContinueBrowsingChipFaviconSize);
favicon->SetImage(metadata.favicon.AsImageSkia());
if (metadata.favicon.IsEmpty()) {
favicon->SetImage(CreateVectorIcon(
kPhoneHubDefaultFaviconIcon,
AshColorProvider::Get()->GetContentLayerColor(
AshColorProvider::ContentLayerType::kIconColorPrimary)));
} else {
favicon->SetImage(metadata.favicon.AsImageSkia());
}
auto* url_label = header_view->AddChildView( auto* url_label = header_view->AddChildView(
std::make_unique<views::Label>(base::UTF8ToUTF16(metadata.url.host()))); std::make_unique<views::Label>(base::UTF8ToUTF16(metadata.url.host())));
......
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