Commit f7dc0641 authored by Tina Wang's avatar Tina Wang Committed by Commit Bot

[SendTabToSelf] Change selfshare contextual menu icon from png to vector

Bug: 984608
Change-Id: I7770ce7d177c4a9aa7cda9dd3243761c4716429e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1808265Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Commit-Queue: Tina Wang <tinazwang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#697613}
parent 26a51202
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/app/chrome_command_ids.h" #include "chrome/app/chrome_command_ids.h"
#include "chrome/app/vector_icons/vector_icons.h"
#include "chrome/browser/app_mode/app_mode_utils.h" #include "chrome/browser/app_mode/app_mode_utils.h"
#include "chrome/browser/apps/platform_apps/app_load_service.h" #include "chrome/browser/apps/platform_apps/app_load_service.h"
#include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h"
...@@ -1287,7 +1288,7 @@ void RenderViewContextMenu::AppendLinkItems() { ...@@ -1287,7 +1288,7 @@ void RenderViewContextMenu::AppendLinkItems() {
IDS_LINK_MENU_SEND_TAB_TO_SELF_SINGLE_TARGET, IDS_LINK_MENU_SEND_TAB_TO_SELF_SINGLE_TARGET,
send_tab_to_self::GetSingleTargetDeviceName( send_tab_to_self::GetSingleTargetDeviceName(
GetBrowser()->profile())), GetBrowser()->profile())),
*send_tab_to_self::GetImageSkia()); kSendTabToSelfIcon);
#endif #endif
send_tab_to_self::RecordSendTabToSelfClickResult( send_tab_to_self::RecordSendTabToSelfClickResult(
send_tab_to_self::kLinkMenu, send_tab_to_self::kLinkMenu,
...@@ -1307,8 +1308,7 @@ void RenderViewContextMenu::AppendLinkItems() { ...@@ -1307,8 +1308,7 @@ void RenderViewContextMenu::AppendLinkItems() {
#else #else
menu_model_.AddSubMenuWithStringIdAndIcon( menu_model_.AddSubMenuWithStringIdAndIcon(
IDC_CONTENT_LINK_SEND_TAB_TO_SELF, IDS_LINK_MENU_SEND_TAB_TO_SELF, IDC_CONTENT_LINK_SEND_TAB_TO_SELF, IDS_LINK_MENU_SEND_TAB_TO_SELF,
send_tab_to_self_sub_menu_model_.get(), send_tab_to_self_sub_menu_model_.get(), kSendTabToSelfIcon);
*send_tab_to_self::GetImageSkia());
#endif #endif
} }
} }
...@@ -1511,7 +1511,7 @@ void RenderViewContextMenu::AppendPageItems() { ...@@ -1511,7 +1511,7 @@ void RenderViewContextMenu::AppendPageItems() {
IDS_CONTEXT_MENU_SEND_TAB_TO_SELF_SINGLE_TARGET, IDS_CONTEXT_MENU_SEND_TAB_TO_SELF_SINGLE_TARGET,
send_tab_to_self::GetSingleTargetDeviceName( send_tab_to_self::GetSingleTargetDeviceName(
GetBrowser()->profile())), GetBrowser()->profile())),
*send_tab_to_self::GetImageSkia()); kSendTabToSelfIcon);
#endif #endif
send_tab_to_self::RecordSendTabToSelfClickResult( send_tab_to_self::RecordSendTabToSelfClickResult(
send_tab_to_self::kContentMenu, send_tab_to_self::kContentMenu,
...@@ -1530,8 +1530,7 @@ void RenderViewContextMenu::AppendPageItems() { ...@@ -1530,8 +1530,7 @@ void RenderViewContextMenu::AppendPageItems() {
#else #else
menu_model_.AddSubMenuWithStringIdAndIcon( menu_model_.AddSubMenuWithStringIdAndIcon(
IDC_SEND_TAB_TO_SELF, IDS_CONTEXT_MENU_SEND_TAB_TO_SELF, IDC_SEND_TAB_TO_SELF, IDS_CONTEXT_MENU_SEND_TAB_TO_SELF,
send_tab_to_self_sub_menu_model_.get(), send_tab_to_self_sub_menu_model_.get(), kSendTabToSelfIcon);
*send_tab_to_self::GetImageSkia());
#endif #endif
} }
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/send_tab_to_self/desktop_notification_handler.h" #include "chrome/browser/send_tab_to_self/desktop_notification_handler.h"
#include "chrome/browser/sync/send_tab_to_self_sync_service_factory.h" #include "chrome/browser/sync/send_tab_to_self_sync_service_factory.h"
...@@ -17,9 +16,6 @@ ...@@ -17,9 +16,6 @@
#include "components/send_tab_to_self/target_device_info.h" #include "components/send_tab_to_self/target_device_info.h"
#include "content/public/browser/navigation_entry.h" #include "content/public/browser/navigation_entry.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/native_theme/native_theme.h"
#include "ui/resources/grit/ui_resources.h"
#include "url/gurl.h" #include "url/gurl.h"
namespace send_tab_to_self { namespace send_tab_to_self {
...@@ -83,15 +79,6 @@ void ShareToSingleTarget(content::WebContents* tab, const GURL& link_url) { ...@@ -83,15 +79,6 @@ void ShareToSingleTarget(content::WebContents* tab, const GURL& link_url) {
link_url); link_url);
} }
gfx::ImageSkia* GetImageSkia() {
const ui::NativeTheme* native_theme =
ui::NativeTheme::GetInstanceForNativeUi();
bool is_dark = native_theme && native_theme->ShouldUseDarkColors();
int resource_id = is_dark ? IDR_SEND_TAB_TO_SELF_ICON_DARK
: IDR_SEND_TAB_TO_SELF_ICON_LIGHT;
return ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(resource_id);
}
void RecordSendTabToSelfClickResult(const std::string& entry_point, void RecordSendTabToSelfClickResult(const std::string& entry_point,
SendTabToSelfClickResult state) { SendTabToSelfClickResult state) {
base::UmaHistogramEnumeration("SendTabToSelf." + entry_point + ".ClickResult", base::UmaHistogramEnumeration("SendTabToSelf." + entry_point + ".ClickResult",
......
...@@ -17,10 +17,6 @@ namespace content { ...@@ -17,10 +17,6 @@ namespace content {
class WebContents; class WebContents;
} }
namespace gfx {
class ImageSkia;
}
// State of the send tab to self option in the context menu. // State of the send tab to self option in the context menu.
// These values are persisted to logs. Entries should not be renumbered and // These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused. // numeric values should never be reused.
...@@ -52,9 +48,6 @@ void CreateNewEntry(content::WebContents* tab, ...@@ -52,9 +48,6 @@ void CreateNewEntry(content::WebContents* tab,
void ShareToSingleTarget(content::WebContents* tab, void ShareToSingleTarget(content::WebContents* tab,
const GURL& link_url = GURL()); const GURL& link_url = GURL());
// Gets the icon for send tab to self menu item.
gfx::ImageSkia* GetImageSkia();
// Records whether the user click to send a tab or link when send tab to self // Records whether the user click to send a tab or link when send tab to self
// entry point is shown. // entry point is shown.
void RecordSendTabToSelfClickResult(const std::string& entry_point, void RecordSendTabToSelfClickResult(const std::string& entry_point,
......
...@@ -5,9 +5,9 @@ ...@@ -5,9 +5,9 @@
#include "chrome/browser/sharing/shared_clipboard/shared_clipboard_context_menu_observer.h" #include "chrome/browser/sharing/shared_clipboard/shared_clipboard_context_menu_observer.h"
#include "base/bind.h" #include "base/bind.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/app/chrome_command_ids.h" #include "chrome/app/chrome_command_ids.h"
#include "chrome/app/vector_icons/vector_icons.h"
#include "chrome/browser/renderer_context_menu/render_view_context_menu.h" #include "chrome/browser/renderer_context_menu/render_view_context_menu.h"
#include "chrome/browser/sharing/shared_clipboard/feature_flags.h" #include "chrome/browser/sharing/shared_clipboard/feature_flags.h"
#include "chrome/browser/sharing/shared_clipboard/shared_clipboard_ui_controller.h" #include "chrome/browser/sharing/shared_clipboard/shared_clipboard_ui_controller.h"
...@@ -15,14 +15,9 @@ ...@@ -15,14 +15,9 @@
#include "chrome/browser/sharing/sharing_metrics.h" #include "chrome/browser/sharing/sharing_metrics.h"
#include "chrome/grit/generated_resources.h" #include "chrome/grit/generated_resources.h"
#include "components/sync_device_info/device_info.h" #include "components/sync_device_info/device_info.h"
#include "components/vector_icons/vector_icons.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/color_palette.h" #include "ui/gfx/color_palette.h"
#include "ui/gfx/paint_vector_icon.h" #include "ui/gfx/paint_vector_icon.h"
#include "ui/native_theme/native_theme.h"
#include "ui/resources/grit/ui_resources.h"
#include "ui/views/controls/menu/menu_config.h"
SharedClipboardContextMenuObserver::SubMenuDelegate::SubMenuDelegate( SharedClipboardContextMenuObserver::SubMenuDelegate::SubMenuDelegate(
SharedClipboardContextMenuObserver* parent) SharedClipboardContextMenuObserver* parent)
...@@ -82,7 +77,7 @@ void SharedClipboardContextMenuObserver::InitMenu( ...@@ -82,7 +77,7 @@ void SharedClipboardContextMenuObserver::InitMenu(
l10n_util::GetStringFUTF16( l10n_util::GetStringFUTF16(
IDS_CONTENT_CONTEXT_SHARING_SHARED_CLIPBOARD_SINGLE_DEVICE, IDS_CONTENT_CONTEXT_SHARING_SHARED_CLIPBOARD_SINGLE_DEVICE,
base::UTF8ToUTF16(devices[0]->client_name())), base::UTF8ToUTF16(devices[0]->client_name())),
GetContextMenuIcon()); kSendTabToSelfIcon);
#endif #endif
} else { } else {
BuildSubMenu(); BuildSubMenu();
...@@ -96,7 +91,7 @@ void SharedClipboardContextMenuObserver::InitMenu( ...@@ -96,7 +91,7 @@ void SharedClipboardContextMenuObserver::InitMenu(
proxy_->AddSubMenuWithStringIdAndIcon( proxy_->AddSubMenuWithStringIdAndIcon(
IDC_CONTENT_CONTEXT_SHARING_SHARED_CLIPBOARD_MULTIPLE_DEVICES, IDC_CONTENT_CONTEXT_SHARING_SHARED_CLIPBOARD_MULTIPLE_DEVICES,
IDS_CONTENT_CONTEXT_SHARING_SHARED_CLIPBOARD_MULTIPLE_DEVICES, IDS_CONTENT_CONTEXT_SHARING_SHARED_CLIPBOARD_MULTIPLE_DEVICES,
sub_menu_model_.get(), GetContextMenuIcon()); sub_menu_model_.get(), kSendTabToSelfIcon);
#endif #endif
} }
} }
...@@ -152,13 +147,3 @@ void SharedClipboardContextMenuObserver::SendSharedClipboardMessage( ...@@ -152,13 +147,3 @@ void SharedClipboardContextMenuObserver::SendSharedClipboardMessage(
controller_->OnDeviceSelected(text_, *devices[chosen_device_index]); controller_->OnDeviceSelected(text_, *devices[chosen_device_index]);
LogSharedClipboardSelectedTextSize(text_.size()); LogSharedClipboardSelectedTextSize(text_.size());
} }
gfx::ImageSkia SharedClipboardContextMenuObserver::GetContextMenuIcon() const {
const ui::NativeTheme* native_theme =
ui::NativeTheme::GetInstanceForNativeUi();
bool is_dark = native_theme && native_theme->ShouldUseDarkColors();
int resource_id = is_dark ? IDR_SEND_TAB_TO_SELF_ICON_DARK
: IDR_SEND_TAB_TO_SELF_ICON_LIGHT;
return *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
resource_id);
}
...@@ -15,10 +15,6 @@ ...@@ -15,10 +15,6 @@
#include "components/renderer_context_menu/render_view_context_menu_observer.h" #include "components/renderer_context_menu/render_view_context_menu_observer.h"
#include "ui/base/models/simple_menu_model.h" #include "ui/base/models/simple_menu_model.h"
namespace gfx {
class ImageSkia;
} // namespace gfx
class RenderViewContextMenuProxy; class RenderViewContextMenuProxy;
class SharedClipboardUiController; class SharedClipboardUiController;
...@@ -61,8 +57,6 @@ class SharedClipboardContextMenuObserver ...@@ -61,8 +57,6 @@ class SharedClipboardContextMenuObserver
void SendSharedClipboardMessage(int chosen_device_index); void SendSharedClipboardMessage(int chosen_device_index);
gfx::ImageSkia GetContextMenuIcon() const;
RenderViewContextMenuProxy* proxy_ = nullptr; RenderViewContextMenuProxy* proxy_ = nullptr;
SharedClipboardUiController* controller_ = nullptr; SharedClipboardUiController* controller_ = nullptr;
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "base/metrics/user_metrics.h" #include "base/metrics/user_metrics.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/app/vector_icons/vector_icons.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/send_tab_to_self/send_tab_to_self_desktop_util.h" #include "chrome/browser/send_tab_to_self/send_tab_to_self_desktop_util.h"
#include "chrome/browser/send_tab_to_self/send_tab_to_self_util.h" #include "chrome/browser/send_tab_to_self/send_tab_to_self_util.h"
...@@ -99,7 +100,7 @@ void TabMenuModel::Build(TabStripModel* tab_strip, int index) { ...@@ -99,7 +100,7 @@ void TabMenuModel::Build(TabStripModel* tab_strip, int index) {
IDS_CONTEXT_MENU_SEND_TAB_TO_SELF_SINGLE_TARGET, IDS_CONTEXT_MENU_SEND_TAB_TO_SELF_SINGLE_TARGET,
(send_tab_to_self::GetSingleTargetDeviceName( (send_tab_to_self::GetSingleTargetDeviceName(
tab_strip->profile()))), tab_strip->profile()))),
*send_tab_to_self::GetImageSkia()); kSendTabToSelfIcon);
#endif #endif
send_tab_to_self::RecordSendTabToSelfClickResult( send_tab_to_self::RecordSendTabToSelfClickResult(
send_tab_to_self::kTabMenu, send_tab_to_self::kTabMenu,
...@@ -119,7 +120,7 @@ void TabMenuModel::Build(TabStripModel* tab_strip, int index) { ...@@ -119,7 +120,7 @@ void TabMenuModel::Build(TabStripModel* tab_strip, int index) {
AddSubMenuWithStringIdAndIcon(TabStripModel::CommandSendTabToSelf, AddSubMenuWithStringIdAndIcon(TabStripModel::CommandSendTabToSelf,
IDS_CONTEXT_MENU_SEND_TAB_TO_SELF, IDS_CONTEXT_MENU_SEND_TAB_TO_SELF,
send_tab_to_self_sub_menu_model_.get(), send_tab_to_self_sub_menu_model_.get(),
*send_tab_to_self::GetImageSkia()); kSendTabToSelfIcon);
#endif #endif
} }
} }
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include "components/security_state/core/security_state.h" #include "components/security_state/core/security_state.h"
#include "components/strings/grit/components_strings.h" #include "components/strings/grit/components_strings.h"
#include "components/url_formatter/elide_url.h" #include "components/url_formatter/elide_url.h"
#include "components/vector_icons/vector_icons.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "net/base/escape.h" #include "net/base/escape.h"
#include "third_party/metrics_proto/omnibox_event.pb.h" #include "third_party/metrics_proto/omnibox_event.pb.h"
...@@ -1828,8 +1829,7 @@ void OmniboxViewViews::UpdateContextMenu(ui::SimpleMenuModel* menu_contents) { ...@@ -1828,8 +1829,7 @@ void OmniboxViewViews::UpdateContextMenu(ui::SimpleMenuModel* menu_contents) {
send_tab_to_self_sub_menu_model_.get()); send_tab_to_self_sub_menu_model_.get());
} }
#if !defined(OS_MACOSX) #if !defined(OS_MACOSX)
menu_contents->SetIcon(index, menu_contents->SetIcon(index, kSendTabToSelfIcon);
gfx::Image(*send_tab_to_self::GetImageSkia()));
#endif #endif
menu_contents->InsertSeparatorAt(++index, ui::NORMAL_SEPARATOR); menu_contents->InsertSeparatorAt(++index, ui::NORMAL_SEPARATOR);
} }
......
...@@ -131,8 +131,6 @@ ...@@ -131,8 +131,6 @@
<structure type="chrome_scaled_image" name="IDR_FOLDER_CLOSED" file="common/folder_closed.png" /> <structure type="chrome_scaled_image" name="IDR_FOLDER_CLOSED" file="common/folder_closed.png" />
<structure type="chrome_scaled_image" name="IDR_FOLDER_OPEN" file="common/folder_open.png" /> <structure type="chrome_scaled_image" name="IDR_FOLDER_OPEN" file="common/folder_open.png" />
</if> </if>
<structure type="chrome_scaled_image" name="IDR_SEND_TAB_TO_SELF_ICON_LIGHT" file="common/send_tab_to_self_light_mode_icon.png" />
<structure type="chrome_scaled_image" name="IDR_SEND_TAB_TO_SELF_ICON_DARK" file="common/send_tab_to_self_dark_mode_icon.png" />
</if> </if>
<if expr="toolkit_views and not is_macosx"> <if expr="toolkit_views and not is_macosx">
<structure type="chrome_scaled_image" name="IDR_NOTIFICATION_SETTINGS" file="common/notification_settings.png"/> <structure type="chrome_scaled_image" name="IDR_NOTIFICATION_SETTINGS" file="common/notification_settings.png"/>
......
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