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 @@
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.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/apps/platform_apps/app_load_service.h"
#include "chrome/browser/autocomplete/autocomplete_classifier_factory.h"
......@@ -1287,7 +1288,7 @@ void RenderViewContextMenu::AppendLinkItems() {
IDS_LINK_MENU_SEND_TAB_TO_SELF_SINGLE_TARGET,
send_tab_to_self::GetSingleTargetDeviceName(
GetBrowser()->profile())),
*send_tab_to_self::GetImageSkia());
kSendTabToSelfIcon);
#endif
send_tab_to_self::RecordSendTabToSelfClickResult(
send_tab_to_self::kLinkMenu,
......@@ -1307,8 +1308,7 @@ void RenderViewContextMenu::AppendLinkItems() {
#else
menu_model_.AddSubMenuWithStringIdAndIcon(
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::GetImageSkia());
send_tab_to_self_sub_menu_model_.get(), kSendTabToSelfIcon);
#endif
}
}
......@@ -1511,7 +1511,7 @@ void RenderViewContextMenu::AppendPageItems() {
IDS_CONTEXT_MENU_SEND_TAB_TO_SELF_SINGLE_TARGET,
send_tab_to_self::GetSingleTargetDeviceName(
GetBrowser()->profile())),
*send_tab_to_self::GetImageSkia());
kSendTabToSelfIcon);
#endif
send_tab_to_self::RecordSendTabToSelfClickResult(
send_tab_to_self::kContentMenu,
......@@ -1530,8 +1530,7 @@ void RenderViewContextMenu::AppendPageItems() {
#else
menu_model_.AddSubMenuWithStringIdAndIcon(
IDC_SEND_TAB_TO_SELF, IDS_CONTEXT_MENU_SEND_TAB_TO_SELF,
send_tab_to_self_sub_menu_model_.get(),
*send_tab_to_self::GetImageSkia());
send_tab_to_self_sub_menu_model_.get(), kSendTabToSelfIcon);
#endif
}
......
......@@ -8,7 +8,6 @@
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/send_tab_to_self/desktop_notification_handler.h"
#include "chrome/browser/sync/send_tab_to_self_sync_service_factory.h"
......@@ -17,9 +16,6 @@
#include "components/send_tab_to_self/target_device_info.h"
#include "content/public/browser/navigation_entry.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"
namespace send_tab_to_self {
......@@ -83,15 +79,6 @@ void ShareToSingleTarget(content::WebContents* tab, const GURL& 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,
SendTabToSelfClickResult state) {
base::UmaHistogramEnumeration("SendTabToSelf." + entry_point + ".ClickResult",
......
......@@ -17,10 +17,6 @@ namespace content {
class WebContents;
}
namespace gfx {
class ImageSkia;
}
// State of the send tab to self option in the context menu.
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
......@@ -52,9 +48,6 @@ void CreateNewEntry(content::WebContents* tab,
void ShareToSingleTarget(content::WebContents* tab,
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
// entry point is shown.
void RecordSendTabToSelfClickResult(const std::string& entry_point,
......
......@@ -5,9 +5,9 @@
#include "chrome/browser/sharing/shared_clipboard/shared_clipboard_context_menu_observer.h"
#include "base/bind.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.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/sharing/shared_clipboard/feature_flags.h"
#include "chrome/browser/sharing/shared_clipboard/shared_clipboard_ui_controller.h"
......@@ -15,14 +15,9 @@
#include "chrome/browser/sharing/sharing_metrics.h"
#include "chrome/grit/generated_resources.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/resource/resource_bundle.h"
#include "ui/gfx/color_palette.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* parent)
......@@ -82,7 +77,7 @@ void SharedClipboardContextMenuObserver::InitMenu(
l10n_util::GetStringFUTF16(
IDS_CONTENT_CONTEXT_SHARING_SHARED_CLIPBOARD_SINGLE_DEVICE,
base::UTF8ToUTF16(devices[0]->client_name())),
GetContextMenuIcon());
kSendTabToSelfIcon);
#endif
} else {
BuildSubMenu();
......@@ -96,7 +91,7 @@ void SharedClipboardContextMenuObserver::InitMenu(
proxy_->AddSubMenuWithStringIdAndIcon(
IDC_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
}
}
......@@ -152,13 +147,3 @@ void SharedClipboardContextMenuObserver::SendSharedClipboardMessage(
controller_->OnDeviceSelected(text_, *devices[chosen_device_index]);
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 @@
#include "components/renderer_context_menu/render_view_context_menu_observer.h"
#include "ui/base/models/simple_menu_model.h"
namespace gfx {
class ImageSkia;
} // namespace gfx
class RenderViewContextMenuProxy;
class SharedClipboardUiController;
......@@ -61,8 +57,6 @@ class SharedClipboardContextMenuObserver
void SendSharedClipboardMessage(int chosen_device_index);
gfx::ImageSkia GetContextMenuIcon() const;
RenderViewContextMenuProxy* proxy_ = nullptr;
SharedClipboardUiController* controller_ = nullptr;
......
......@@ -7,6 +7,7 @@
#include "base/command_line.h"
#include "base/metrics/user_metrics.h"
#include "build/build_config.h"
#include "chrome/app/vector_icons/vector_icons.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_util.h"
......@@ -99,7 +100,7 @@ void TabMenuModel::Build(TabStripModel* tab_strip, int index) {
IDS_CONTEXT_MENU_SEND_TAB_TO_SELF_SINGLE_TARGET,
(send_tab_to_self::GetSingleTargetDeviceName(
tab_strip->profile()))),
*send_tab_to_self::GetImageSkia());
kSendTabToSelfIcon);
#endif
send_tab_to_self::RecordSendTabToSelfClickResult(
send_tab_to_self::kTabMenu,
......@@ -119,7 +120,7 @@ void TabMenuModel::Build(TabStripModel* tab_strip, int index) {
AddSubMenuWithStringIdAndIcon(TabStripModel::CommandSendTabToSelf,
IDS_CONTEXT_MENU_SEND_TAB_TO_SELF,
send_tab_to_self_sub_menu_model_.get(),
*send_tab_to_self::GetImageSkia());
kSendTabToSelfIcon);
#endif
}
}
......
......@@ -41,6 +41,7 @@
#include "components/security_state/core/security_state.h"
#include "components/strings/grit/components_strings.h"
#include "components/url_formatter/elide_url.h"
#include "components/vector_icons/vector_icons.h"
#include "content/public/browser/web_contents.h"
#include "net/base/escape.h"
#include "third_party/metrics_proto/omnibox_event.pb.h"
......@@ -1828,8 +1829,7 @@ void OmniboxViewViews::UpdateContextMenu(ui::SimpleMenuModel* menu_contents) {
send_tab_to_self_sub_menu_model_.get());
}
#if !defined(OS_MACOSX)
menu_contents->SetIcon(index,
gfx::Image(*send_tab_to_self::GetImageSkia()));
menu_contents->SetIcon(index, kSendTabToSelfIcon);
#endif
menu_contents->InsertSeparatorAt(++index, ui::NORMAL_SEPARATOR);
}
......
......@@ -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_OPEN" file="common/folder_open.png" />
</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 expr="toolkit_views and not is_macosx">
<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