Commit 7de8523b authored by stevenjb's avatar stevenjb Committed by Commit bot

Set the shelf icon title explicitly for settings and task manager

This allows us to set the icon title (used for hovertext) independently
of the window title (which is empty for Settings windows).

BUG=406954

Review URL: https://codereview.chromium.org/507003002

Cr-Commit-Position: refs/heads/master@{#292029}
parent 44954d45
...@@ -40,12 +40,13 @@ void SetShelfItemDetailsForWindow(aura::Window* window, ...@@ -40,12 +40,13 @@ void SetShelfItemDetailsForWindow(aura::Window* window,
} }
void SetShelfItemDetailsForDialogWindow(aura::Window* window, void SetShelfItemDetailsForDialogWindow(aura::Window* window,
int image_resource_id) { int image_resource_id,
const base::string16& title) {
// |item_details| is owned by |window|. // |item_details| is owned by |window|.
ShelfItemDetails* item_details = new ShelfItemDetails; ShelfItemDetails* item_details = new ShelfItemDetails;
item_details->type = TYPE_DIALOG; item_details->type = TYPE_DIALOG;
item_details->image_resource_id = image_resource_id; item_details->image_resource_id = image_resource_id;
item_details->title = window->title(); item_details->title = title;
window->SetProperty(kShelfItemDetailsKey, item_details); window->SetProperty(kShelfItemDetailsKey, item_details);
} }
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "ash/ash_export.h" #include "ash/ash_export.h"
#include "ash/shelf/shelf_item_types.h" #include "ash/shelf/shelf_item_types.h"
#include "base/strings/string16.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
namespace aura { namespace aura {
...@@ -37,10 +38,11 @@ ASH_EXPORT ShelfID GetShelfIDForWindow(const aura::Window* window); ...@@ -37,10 +38,11 @@ ASH_EXPORT ShelfID GetShelfIDForWindow(const aura::Window* window);
ASH_EXPORT void SetShelfItemDetailsForWindow(aura::Window* window, ASH_EXPORT void SetShelfItemDetailsForWindow(aura::Window* window,
const ShelfItemDetails& details); const ShelfItemDetails& details);
// Creates a new ShelfItemDetails instance with type DIALOG and image id // Creates a new ShelfItemDetails instance with type DIALOG, image id
// |image_resource_id| and sets it for |window|. // |image_resource_id|, and title |title|, and sets it for |window|.
ASH_EXPORT void SetShelfItemDetailsForDialogWindow(aura::Window* window, ASH_EXPORT void SetShelfItemDetailsForDialogWindow(aura::Window* window,
int image_resource_id); int image_resource_id,
const base::string16& title);
// Clears ShelfItemDetails for |window|. // Clears ShelfItemDetails for |window|.
// If |window| has a ShelfItem by SetShelfItemDetailsForWindow(), it will // If |window| has a ShelfItem by SetShelfItemDetailsForWindow(), it will
......
...@@ -21,8 +21,10 @@ ...@@ -21,8 +21,10 @@
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_observer.h"
#include "grit/ash_resources.h" #include "grit/ash_resources.h"
#include "grit/generated_resources.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
#include "ui/aura/window_event_dispatcher.h" #include "ui/aura/window_event_dispatcher.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/screen.h" #include "ui/gfx/screen.h"
#include "ui/wm/public/activation_client.h" #include "ui/wm/public/activation_client.h"
...@@ -84,7 +86,8 @@ class BrowserStatusMonitor::SettingsWindowObserver ...@@ -84,7 +86,8 @@ class BrowserStatusMonitor::SettingsWindowObserver
virtual void OnNewSettingsWindow(Browser* settings_browser) OVERRIDE { virtual void OnNewSettingsWindow(Browser* settings_browser) OVERRIDE {
ash::SetShelfItemDetailsForDialogWindow( ash::SetShelfItemDetailsForDialogWindow(
settings_browser->window()->GetNativeWindow(), settings_browser->window()->GetNativeWindow(),
IDR_ASH_SHELF_ICON_SETTINGS); IDR_ASH_SHELF_ICON_SETTINGS,
l10n_util::GetStringUTF16(IDS_SETTINGS_TITLE));
} }
private: private:
......
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
#include "chrome/browser/ui/settings_window_manager.h" #include "chrome/browser/ui/settings_window_manager.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "grit/ash_resources.h" #include "grit/ash_resources.h"
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
MultiProfileBrowserStatusMonitor::MultiProfileBrowserStatusMonitor( MultiProfileBrowserStatusMonitor::MultiProfileBrowserStatusMonitor(
ChromeLauncherController* launcher_controller) ChromeLauncherController* launcher_controller)
...@@ -86,8 +88,9 @@ void MultiProfileBrowserStatusMonitor::ActiveUserChanged( ...@@ -86,8 +88,9 @@ void MultiProfileBrowserStatusMonitor::ActiveUserChanged(
} }
if (multi_user_util::IsProfileFromActiveUser(browser->profile())) { if (multi_user_util::IsProfileFromActiveUser(browser->profile())) {
ash::SetShelfItemDetailsForDialogWindow( ash::SetShelfItemDetailsForDialogWindow(
browser->window()->GetNativeWindow(), browser->window()->GetNativeWindow(),
IDR_ASH_SHELF_ICON_SETTINGS); IDR_ASH_SHELF_ICON_SETTINGS,
l10n_util::GetStringUTF16(IDS_SETTINGS_TITLE));
} else { } else {
ash::ClearShelfItemDetailsForWindow(browser->window()->GetNativeWindow()); ash::ClearShelfItemDetailsForWindow(browser->window()->GetNativeWindow());
} }
......
...@@ -498,9 +498,9 @@ void TaskManagerView::Show(Browser* browser) { ...@@ -498,9 +498,9 @@ void TaskManagerView::Show(Browser* browser) {
focus_manager->SetFocusedView(instance_->tab_table_); focus_manager->SetFocusedView(instance_->tab_table_);
#if defined(USE_ASH) #if defined(USE_ASH)
gfx::NativeWindow native_window = instance_->GetWidget()->GetNativeWindow();
ash::SetShelfItemDetailsForDialogWindow( ash::SetShelfItemDetailsForDialogWindow(
instance_->GetWidget()->GetNativeWindow(), native_window, IDR_ASH_SHELF_ICON_TASK_MANAGER, native_window->title());
IDR_ASH_SHELF_ICON_TASK_MANAGER);
#endif #endif
} }
......
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