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/shelf/shelf_util.h" | 7 #include "ash/shelf/shelf_util.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/wm/window_util.h" | 9 #include "ash/wm/window_util.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 state = ChromeLauncherController::APP_STATE_ACTIVE; | 53 state = ChromeLauncherController::APP_STATE_ACTIVE; |
54 | 54 |
55 monitor_->UpdateAppItemState(web_contents(), state); | 55 monitor_->UpdateAppItemState(web_contents(), state); |
56 monitor_->UpdateBrowserItemState(); | 56 monitor_->UpdateBrowserItemState(); |
57 | 57 |
58 // Navigating may change the ShelfID associated with the WebContents. | 58 // Navigating may change the ShelfID associated with the WebContents. |
59 if (browser->tab_strip_model()->GetActiveWebContents() == web_contents()) | 59 if (browser->tab_strip_model()->GetActiveWebContents() == web_contents()) |
60 monitor_->SetShelfIDForBrowserWindowContents(browser, web_contents()); | 60 monitor_->SetShelfIDForBrowserWindowContents(browser, web_contents()); |
61 } | 61 } |
62 | 62 |
63 virtual void WebContentsDestroyed( | 63 virtual void WebContentsDestroyed() OVERRIDE { |
64 content::WebContents* web_content) OVERRIDE { | 64 // We can only come here when there was a non standard termination like |
65 if (web_content == web_contents()) { | 65 // an app got un-installed while running, etc. |
66 // We can only come here when there was a non standard termination like | 66 monitor_->WebContentsDestroyed(web_contents()); |
67 // an app got un-installed while running, etc. | 67 // |this| is gone now. |
68 monitor_->WebContentsDestroyed(web_content); | |
69 // |this| is gone now. | |
70 } | |
71 } | 68 } |
72 | 69 |
73 private: | 70 private: |
74 BrowserStatusMonitor* monitor_; | 71 BrowserStatusMonitor* monitor_; |
75 | 72 |
76 DISALLOW_COPY_AND_ASSIGN(LocalWebContentsObserver); | 73 DISALLOW_COPY_AND_ASSIGN(LocalWebContentsObserver); |
77 }; | 74 }; |
78 | 75 |
79 // Observes any new settings windows and sets their shelf icon (since they | 76 // Observes any new settings windows and sets their shelf icon (since they |
80 // are excluded from BrowserShortcutLauncherItem). | 77 // are excluded from BrowserShortcutLauncherItem). |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 content::WebContents* contents) { | 381 content::WebContents* contents) { |
385 return launcher_controller_->GetShelfIDForWebContents(contents); | 382 return launcher_controller_->GetShelfIDForWebContents(contents); |
386 } | 383 } |
387 | 384 |
388 void BrowserStatusMonitor::SetShelfIDForBrowserWindowContents( | 385 void BrowserStatusMonitor::SetShelfIDForBrowserWindowContents( |
389 Browser* browser, | 386 Browser* browser, |
390 content::WebContents* web_contents) { | 387 content::WebContents* web_contents) { |
391 launcher_controller_->GetBrowserShortcutLauncherItemController()-> | 388 launcher_controller_->GetBrowserShortcutLauncherItemController()-> |
392 SetShelfIDForBrowserWindowContents(browser, web_contents); | 389 SetShelfIDForBrowserWindowContents(browser, web_contents); |
393 } | 390 } |
OLD | NEW |