Index: chrome/browser/ui/ash/launcher/browser_status_monitor.h |
diff --git a/chrome/browser/ui/ash/launcher/browser_status_monitor.h b/chrome/browser/ui/ash/launcher/browser_status_monitor.h |
index 64098c3e331da93ed16f306fe29d74bba77dae0b..008318604e4a213759795592327a5dce6a80dd2f 100644 |
--- a/chrome/browser/ui/ash/launcher/browser_status_monitor.h |
+++ b/chrome/browser/ui/ash/launcher/browser_status_monitor.h |
@@ -12,8 +12,10 @@ |
#include "base/basictypes.h" |
#include "base/compiler_specific.h" |
#include "base/scoped_observer.h" |
+#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" |
@@ -27,7 +29,6 @@ class ActivationClient; |
} // namespace aura |
class Browser; |
-class ChromeLauncherController; |
// BrowserStatusMonitor monitors creation/deletion of Browser and its |
// TabStripModel to keep the launcher representation up to date as the |
@@ -41,6 +42,14 @@ class BrowserStatusMonitor : public aura::client::ActivationChangeObserver, |
explicit BrowserStatusMonitor(ChromeLauncherController* launcher_controller); |
virtual ~BrowserStatusMonitor(); |
+ // A shortcut to call the ChromeLauncherController's UpdateAppState(). |
+ void UpdateAppItemState(content::WebContents* contents, |
+ ChromeLauncherController::AppState app_state); |
+ |
+ // A shortcut to call the BrowserShortcutLauncherItemController's |
+ // UpdateBrowserItemState(). |
+ void UpdateBrowserItemState(); |
+ |
// aura::client::ActivationChangeObserver overrides: |
virtual void OnWindowActivated(aura::Window* gained_active, |
aura::Window* lost_active) OVERRIDE; |
@@ -65,26 +74,33 @@ class BrowserStatusMonitor : public aura::client::ActivationChangeObserver, |
virtual void TabInsertedAt(content::WebContents* contents, |
int index, |
bool foreground) OVERRIDE; |
- virtual void TabDetachedAt(content::WebContents* contents, |
- int index) OVERRIDE; |
- virtual void TabChangedAt( |
- content::WebContents* contents, |
- int index, |
- TabStripModelObserver::TabChangeType change_type) OVERRIDE; |
- virtual void TabReplacedAt(TabStripModel* tab_strip_model, |
- content::WebContents* old_contents, |
- content::WebContents* new_contents, |
- int index) OVERRIDE; |
+ virtual void TabClosingAt(TabStripModel* tab_strip_mode, |
+ content::WebContents* contents, |
+ int index) OVERRIDE; |
private: |
- typedef std::map<Browser*, std::string> BrowserToAppIDMap; |
+ // 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(); |
- // Update app state for |contents| and browser state. |
- void UpdateAppAndBrowserState(content::WebContents* contents); |
+ // content::WebContentsObserver overrides: |
+ virtual void DidNavigateMainFrame( |
+ const content::LoadCommittedDetails& details, |
+ const content::FrameNavigateParams& params) OVERRIDE; |
- // A shortcut to call the BrowserShortcutLauncherItemController's |
- // UpdateBrowserItemState(). |
- void UpdateBrowserItemState(); |
+ private: |
+ BrowserStatusMonitor* monitor_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(LocalWebContentsObserver); |
+ }; |
+ |
+ typedef std::map<Browser*, std::string> BrowserToAppIDMap; |
+ typedef std::map<content::WebContents*, LocalWebContentsObserver*> |
+ WebContentsToObserverMap; |
ChromeLauncherController* launcher_controller_; |
@@ -97,6 +113,8 @@ class BrowserStatusMonitor : public aura::client::ActivationChangeObserver, |
BrowserToAppIDMap browser_to_app_id_map_; |
+ WebContentsToObserverMap webcontents_to_observer_map_; |
+ |
DISALLOW_COPY_AND_ASSIGN(BrowserStatusMonitor); |
}; |