Chromium Code Reviews| Index: chrome/browser/ui/ash/launcher/browser_status_monitor.cc |
| diff --git a/chrome/browser/ui/ash/launcher/browser_status_monitor.cc b/chrome/browser/ui/ash/launcher/browser_status_monitor.cc |
| index 119bad52220375722e530bc12056e194fb54cd93..8431602cd542bd0a0eb9e511dc88c653bbce89af 100644 |
| --- a/chrome/browser/ui/ash/launcher/browser_status_monitor.cc |
| +++ b/chrome/browser/ui/ash/launcher/browser_status_monitor.cc |
| @@ -6,6 +6,7 @@ |
| #include "ash/aura/wm_window_aura.h" |
| #include "ash/common/shelf/shelf_item_types.h" |
| +#include "ash/common/wm_window_observer.h" |
| #include "ash/common/wm_window_property.h" |
| #include "ash/resources/grit/ash_resources.h" |
| #include "ash/shell.h" |
| @@ -23,7 +24,6 @@ |
| #include "chrome/browser/ui/settings_window_manager_observer.h" |
| #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| #include "chrome/browser/web_applications/web_app.h" |
| -#include "chrome/grit/generated_resources.h" |
|
James Cook
2016/09/28 20:41:03
Nice catch.
msw
2016/09/28 23:27:46
Acknowledged.
|
| #include "components/strings/grit/components_strings.h" |
| #include "content/public/browser/web_contents.h" |
| #include "content/public/browser/web_contents_observer.h" |
| @@ -85,19 +85,29 @@ class BrowserStatusMonitor::LocalWebContentsObserver |
| // Observes any new settings windows and sets their shelf icon (since they |
| // are excluded from BrowserShortcutLauncherItem). |
| class BrowserStatusMonitor::SettingsWindowObserver |
| - : public chrome::SettingsWindowManagerObserver { |
| + : public chrome::SettingsWindowManagerObserver, |
| + public ash::WmWindowObserver { |
| public: |
| SettingsWindowObserver() {} |
| ~SettingsWindowObserver() override {} |
| - // SettingsWindowManagerObserver |
| + // SettingsWindowManagerObserver: |
| void OnNewSettingsWindow(Browser* settings_browser) override { |
| - ash::ShelfItemDetails item_details; |
| - item_details.type = ash::TYPE_DIALOG; |
| - item_details.image_resource_id = IDR_ASH_SHELF_ICON_SETTINGS; |
| - item_details.title = l10n_util::GetStringUTF16(IDS_SETTINGS_TITLE); |
| aura::Window* aura_window = settings_browser->window()->GetNativeWindow(); |
| - ash::WmWindowAura::Get(aura_window)->SetShelfItemDetails(item_details); |
| + ash::WmWindow* window = ash::WmWindowAura::Get(aura_window); |
| + window->SetTitle(l10n_util::GetStringUTF16(IDS_SETTINGS_TITLE)); |
| + window->SetIntProperty(ash::WmWindowProperty::SHELF_ITEM_TYPE, |
| + ash::TYPE_DIALOG); |
| + window->SetIntProperty(ash::WmWindowProperty::SHELF_ICON_ID, |
| + IDR_ASH_SHELF_ICON_SETTINGS); |
| + window->AddObserver(this); |
|
James Cook
2016/09/28 20:41:03
Does this observer need to be cleaned up?
msw
2016/09/28 23:27:46
Done. (used WmWindowTracker instead)
|
| + } |
| + |
| + // ash::WmWindowObserver: |
| + void OnWindowTitleChanged(ash::WmWindow* window) override { |
| + // Override Chrome's product name prepending for Settings windows. |
|
James Cook
2016/09/28 20:41:03
super nit: Maybe just say "Name the window "Settin
msw
2016/09/28 23:27:46
Done.
|
| + if (window->GetTitle() != l10n_util::GetStringUTF16(IDS_SETTINGS_TITLE)) |
|
James Cook
2016/09/28 20:41:03
Aside: Ugh, aura::Window::SetTitle calls observers
msw
2016/09/28 23:27:46
Acknowledged. Worth following up?
James Cook
2016/09/29 02:49:46
Yeah, I think it's worth fixing. There are only a
|
| + window->SetTitle(l10n_util::GetStringUTF16(IDS_SETTINGS_TITLE)); |
| } |
| private: |