OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/ash/launcher/browser_status_monitor.h" | 5 #include "chrome/browser/ui/ash/launcher/browser_status_monitor.h" |
6 | 6 |
| 7 #include "ash/aura/wm_window_aura.h" |
| 8 #include "ash/common/shelf/shelf_item_types.h" |
| 9 #include "ash/common/wm_window_property.h" |
7 #include "ash/resources/grit/ash_resources.h" | 10 #include "ash/resources/grit/ash_resources.h" |
8 #include "ash/shelf/shelf_util.h" | |
9 #include "ash/shell.h" | 11 #include "ash/shell.h" |
10 #include "ash/wm/window_util.h" | 12 #include "ash/wm/window_util.h" |
11 #include "base/macros.h" | 13 #include "base/macros.h" |
12 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
13 #include "chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controll
er.h" | 15 #include "chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controll
er.h" |
14 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 16 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
15 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_util.h" | 17 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_util.h" |
16 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
17 #include "chrome/browser/ui/browser_finder.h" | 19 #include "chrome/browser/ui/browser_finder.h" |
18 #include "chrome/browser/ui/browser_list.h" | 20 #include "chrome/browser/ui/browser_list.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 // Observes any new settings windows and sets their shelf icon (since they | 85 // Observes any new settings windows and sets their shelf icon (since they |
84 // are excluded from BrowserShortcutLauncherItem). | 86 // are excluded from BrowserShortcutLauncherItem). |
85 class BrowserStatusMonitor::SettingsWindowObserver | 87 class BrowserStatusMonitor::SettingsWindowObserver |
86 : public chrome::SettingsWindowManagerObserver { | 88 : public chrome::SettingsWindowManagerObserver { |
87 public: | 89 public: |
88 SettingsWindowObserver() {} | 90 SettingsWindowObserver() {} |
89 ~SettingsWindowObserver() override {} | 91 ~SettingsWindowObserver() override {} |
90 | 92 |
91 // SettingsWindowManagerObserver | 93 // SettingsWindowManagerObserver |
92 void OnNewSettingsWindow(Browser* settings_browser) override { | 94 void OnNewSettingsWindow(Browser* settings_browser) override { |
93 ash::SetShelfItemDetailsForDialogWindow( | 95 ash::ShelfItemDetails item_details; |
94 settings_browser->window()->GetNativeWindow(), | 96 item_details.type = ash::TYPE_DIALOG; |
95 IDR_ASH_SHELF_ICON_SETTINGS, | 97 item_details.image_resource_id = IDR_ASH_SHELF_ICON_SETTINGS; |
96 l10n_util::GetStringUTF16(IDS_SETTINGS_TITLE)); | 98 item_details.title = l10n_util::GetStringUTF16(IDS_SETTINGS_TITLE); |
| 99 aura::Window* aura_window = settings_browser->window()->GetNativeWindow(); |
| 100 ash::WmWindowAura::Get(aura_window)->SetShelfItemDetails(item_details); |
97 } | 101 } |
98 | 102 |
99 private: | 103 private: |
100 DISALLOW_COPY_AND_ASSIGN(SettingsWindowObserver); | 104 DISALLOW_COPY_AND_ASSIGN(SettingsWindowObserver); |
101 }; | 105 }; |
102 | 106 |
103 BrowserStatusMonitor::BrowserStatusMonitor( | 107 BrowserStatusMonitor::BrowserStatusMonitor( |
104 ChromeLauncherController* launcher_controller) | 108 ChromeLauncherController* launcher_controller) |
105 : launcher_controller_(launcher_controller), | 109 : launcher_controller_(launcher_controller), |
106 settings_window_observer_(new SettingsWindowObserver), | 110 settings_window_observer_(new SettingsWindowObserver), |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 content::WebContents* contents) { | 325 content::WebContents* contents) { |
322 return launcher_controller_->GetShelfIDForWebContents(contents); | 326 return launcher_controller_->GetShelfIDForWebContents(contents); |
323 } | 327 } |
324 | 328 |
325 void BrowserStatusMonitor::SetShelfIDForBrowserWindowContents( | 329 void BrowserStatusMonitor::SetShelfIDForBrowserWindowContents( |
326 Browser* browser, | 330 Browser* browser, |
327 content::WebContents* web_contents) { | 331 content::WebContents* web_contents) { |
328 launcher_controller_->GetBrowserShortcutLauncherItemController()-> | 332 launcher_controller_->GetBrowserShortcutLauncherItemController()-> |
329 SetShelfIDForBrowserWindowContents(browser, web_contents); | 333 SetShelfIDForBrowserWindowContents(browser, web_contents); |
330 } | 334 } |
OLD | NEW |