#include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
#include "chrome/browser/ui/browser_list_observer.h"
#include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
-#include "content/public/browser/web_contents_observer.h"
-#include "ui/aura/client/activation_change_observer.h"
#include "ui/aura/window_observer.h"
#include "ui/gfx/display_observer.h"
+#include "ui/wm/public/activation_change_observer.h"
namespace aura {
class Window;
public TabStripModelObserver {
public:
explicit BrowserStatusMonitor(ChromeLauncherController* launcher_controller);
- virtual ~BrowserStatusMonitor();
+ ~BrowserStatusMonitor() override;
// A function which gets called when the current user has changed.
// Note that this function is called by the ChromeLauncherController to be
void UpdateBrowserItemState();
// aura::client::ActivationChangeObserver overrides:
- virtual void OnWindowActivated(aura::Window* gained_active,
- aura::Window* lost_active) OVERRIDE;
+ void OnWindowActivated(aura::Window* gained_active,
+ aura::Window* lost_active) override;
// aura::WindowObserver overrides:
- virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE;
+ void OnWindowDestroyed(aura::Window* window) override;
// chrome::BrowserListObserver overrides:
- virtual void OnBrowserAdded(Browser* browser) OVERRIDE;
- virtual void OnBrowserRemoved(Browser* browser) OVERRIDE;
+ void OnBrowserAdded(Browser* browser) override;
+ void OnBrowserRemoved(Browser* browser) override;
// gfx::DisplayObserver overrides:
- virtual void OnDisplayBoundsChanged(const gfx::Display& display) OVERRIDE;
- virtual void OnDisplayAdded(const gfx::Display& new_display) OVERRIDE;
- virtual void OnDisplayRemoved(const gfx::Display& old_display) OVERRIDE;
+ void OnDisplayAdded(const gfx::Display& new_display) override;
+ void OnDisplayRemoved(const gfx::Display& old_display) override;
+ void OnDisplayMetricsChanged(const gfx::Display& display,
+ uint32_t metrics) override;
// TabStripModelObserver overrides:
- virtual void ActiveTabChanged(content::WebContents* old_contents,
- content::WebContents* new_contents,
- int index,
- int reason) OVERRIDE;
- virtual void TabReplacedAt(TabStripModel* tab_strip_model,
- content::WebContents* old_contents,
- content::WebContents* new_contents,
- int index) OVERRIDE;
- virtual void TabInsertedAt(content::WebContents* contents,
- int index,
- bool foreground) OVERRIDE;
- virtual void TabClosingAt(TabStripModel* tab_strip_mode,
- content::WebContents* contents,
- int index) OVERRIDE;
+ void ActiveTabChanged(content::WebContents* old_contents,
+ content::WebContents* new_contents,
+ int index,
+ int reason) override;
+ void TabReplacedAt(TabStripModel* tab_strip_model,
+ content::WebContents* old_contents,
+ content::WebContents* new_contents,
+ int index) override;
+ void TabInsertedAt(content::WebContents* contents,
+ int index,
+ bool foreground) override;
+ void TabClosingAt(TabStripModel* tab_strip_mode,
+ content::WebContents* contents,
+ int index) override;
+
+ // Called from our own |LocalWebContentsObserver| when web contents did go
+ // away without any other notification. This might happen in case of
+ // application uninstalls, page crashes, ...).
+ void WebContentsDestroyed(content::WebContents* web_contents);
protected:
// Add a V1 application to the shelf. This can get overwritten for multi
bool IsV1AppInShelf(Browser* browser);
private:
- // This class monitors the WebContent of the all tab and notifies a navigation
- // to the BrowserStatusMonitor.
- class LocalWebContentsObserver : public content::WebContentsObserver {
- public:
- LocalWebContentsObserver(content::WebContents* contents,
- BrowserStatusMonitor* monitor);
- virtual ~LocalWebContentsObserver();
-
- // content::WebContentsObserver overrides:
- virtual void DidNavigateMainFrame(
- const content::LoadCommittedDetails& details,
- const content::FrameNavigateParams& params) OVERRIDE;
-
- private:
- BrowserStatusMonitor* monitor_;
-
- DISALLOW_COPY_AND_ASSIGN(LocalWebContentsObserver);
- };
+ class LocalWebContentsObserver;
+ class SettingsWindowObserver;
typedef std::map<Browser*, std::string> BrowserToAppIDMap;
typedef std::map<content::WebContents*, LocalWebContentsObserver*>
// Remove LocalWebContentsObserver for |contents|.
void RemoveWebContentsObserver(content::WebContents* contents);
- // Retruns the ShelfID for |contents|.
+ // Returns the ShelfID for |contents|.
ash::ShelfID GetShelfIDForWebContents(content::WebContents* contents);
+ // Sets the shelf id for browsers represented by the browser shortcut item.
+ void SetShelfIDForBrowserWindowContents(Browser* browser,
+ content::WebContents* web_contents);
+
ChromeLauncherController* launcher_controller_;
// Hold all observed activation clients.
ScopedObserver<aura::Window, aura::WindowObserver> observed_root_windows_;
BrowserToAppIDMap browser_to_app_id_map_;
-
WebContentsToObserverMap webcontents_to_observer_map_;
+ scoped_ptr<SettingsWindowObserver> settings_window_observer_;
DISALLOW_COPY_AND_ASSIGN(BrowserStatusMonitor);
};