Commit 730d6da6 authored by Mitsuru Oshima's avatar Mitsuru Oshima Committed by Commit Bot

Set the icon for Discover app using kOverrideWindowIconResourceIdKey

kWindowIconKey is used to pass the icon from views to aura/ash.
For BrowserView, it is created here:

https://cs.chromium.org/chromium/src/chrome/browser/ui/views/frame/browser_view.cc?rcl=d567caa14b94d1bac1d72e9c4dac9b7458786629&l=1918

A browser based custom app should use kOverrideWindowIconresourceIdKey
to override the default behavior in BrowesrView (which uses the favicon).

Bug: 881030
Test: manual
Change-Id: I7d536b1bd641e69642ceadbd33a4ad871483812e
Reviewed-on: https://chromium-review.googlesource.com/1210742Reviewed-by: default avatarAlexander Alekseev <alemate@chromium.org>
Commit-Queue: Mitsuru Oshima <oshima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#589255}
parent c56f0be1
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
#include "chrome/browser/ui/ash/launcher/discover_window_observer.h" #include "chrome/browser/ui/ash/launcher/discover_window_observer.h"
#include "ash/public/cpp/app_list/internal_app_id_constants.h" #include "ash/public/cpp/app_list/internal_app_id_constants.h"
#include "ash/public/cpp/resources/grit/ash_public_unscaled_resources.h"
#include "ash/public/cpp/shelf_item.h" #include "ash/public/cpp/shelf_item.h"
#include "ash/public/cpp/window_properties.h" #include "ash/public/cpp/window_properties.h"
#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser.h"
...@@ -14,11 +13,9 @@ ...@@ -14,11 +13,9 @@
#include "chrome/grit/generated_resources.h" #include "chrome/grit/generated_resources.h"
#include "components/strings/grit/components_strings.h" #include "components/strings/grit/components_strings.h"
#include "services/ws/public/mojom/window_manager.mojom.h" #include "services/ws/public/mojom/window_manager.mojom.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
#include "ui/base/class_property.h" #include "ui/base/class_property.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/image/image_skia.h" #include "ui/gfx/image/image_skia.h"
namespace { namespace {
...@@ -56,10 +53,5 @@ void DiscoverWindowObserver::OnNewDiscoverWindow(Browser* discover_browser) { ...@@ -56,10 +53,5 @@ void DiscoverWindowObserver::OnNewDiscoverWindow(Browser* discover_browser) {
const ash::ShelfID shelf_id(app_list::kInternalAppIdDiscover); const ash::ShelfID shelf_id(app_list::kInternalAppIdDiscover);
window->SetProperty(ash::kShelfIDKey, new std::string(shelf_id.Serialize())); window->SetProperty(ash::kShelfIDKey, new std::string(shelf_id.Serialize()));
window->SetProperty<int>(ash::kShelfItemTypeKey, ash::TYPE_APP); window->SetProperty<int>(ash::kShelfItemTypeKey, ash::TYPE_APP);
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
// The new gfx::ImageSkia instance is owned by the window itself.
window->SetProperty(
aura::client::kWindowIconKey,
new gfx::ImageSkia(*rb.GetImageSkiaNamed(IDR_DISCOVER_APP_192)));
aura_window_tracker_->Add(window); aura_window_tracker_->Add(window);
} }
...@@ -4,7 +4,9 @@ ...@@ -4,7 +4,9 @@
#include "chrome/browser/ui/webui/chromeos/login/discover/discover_window_manager.h" #include "chrome/browser/ui/webui/chromeos/login/discover/discover_window_manager.h"
#include "ash/public/cpp/resources/grit/ash_public_unscaled_resources.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/ash/window_properties.h"
#include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/browser_navigator_params.h" #include "chrome/browser/ui/browser_navigator_params.h"
...@@ -79,6 +81,9 @@ void DiscoverWindowManager::ShowChromeDiscoverPageForProfile(Profile* profile) { ...@@ -79,6 +81,9 @@ void DiscoverWindowManager::ShowChromeDiscoverPageForProfile(Profile* profile) {
.first->second = params.browser->session_id(); .first->second = params.browser->session_id();
DCHECK(params.browser->is_trusted_source()); DCHECK(params.browser->is_trusted_source());
auto* window = params.browser->window()->GetNativeWindow();
window->SetProperty(kOverrideWindowIconResourceIdKey, IDR_DISCOVER_APP_192);
for (DiscoverWindowManagerObserver& observer : observers_) for (DiscoverWindowManagerObserver& observer : observers_)
observer.OnNewDiscoverWindow(params.browser); observer.OnNewDiscoverWindow(params.browser);
} }
......
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