| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/chromeos/status/window_switcher_button.h" | 5 #include "chrome/browser/chromeos/status/window_switcher_button.h" |
| 6 | 6 |
| 7 #include "chrome/browser/chromeos/status/status_area_host.h" | 7 #include "chrome/browser/chromeos/status/status_area_host.h" |
| 8 #include "chrome/browser/chromeos/wm_ipc.h" | 8 #include "chrome/browser/chromeos/wm_ipc.h" |
| 9 #include "chrome/browser/ui/browser_window.h" | 9 #include "chrome/browser/ui/browser_window.h" |
| 10 #include "grit/generated_resources.h" | 10 #include "grit/generated_resources.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 BrowserList::const_iterator iter; | 21 BrowserList::const_iterator iter; |
| 22 for (iter = BrowserList::begin(); iter != BrowserList::end(); ++iter) { | 22 for (iter = BrowserList::begin(); iter != BrowserList::end(); ++iter) { |
| 23 if ((*iter)->type() == Browser::TYPE_NORMAL) | 23 if ((*iter)->type() == Browser::TYPE_NORMAL) |
| 24 count++; | 24 count++; |
| 25 } | 25 } |
| 26 return count; | 26 return count; |
| 27 } | 27 } |
| 28 } | 28 } |
| 29 | 29 |
| 30 WindowSwitcherButton::WindowSwitcherButton(StatusAreaHost* host) | 30 WindowSwitcherButton::WindowSwitcherButton(StatusAreaHost* host) |
| 31 : StatusAreaButton(this), | 31 : StatusAreaButton(host, this) { |
| 32 host_(host) { | |
| 33 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 32 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 34 SetIcon(*rb.GetBitmapNamed(IDR_STATUSBAR_WINDOW_SWITCHER)); | 33 SetIcon(*rb.GetBitmapNamed(IDR_STATUSBAR_WINDOW_SWITCHER)); |
| 35 SetEnabled(true); | 34 SetEnabled(true); |
| 36 | 35 |
| 37 UpdateStatus(); | 36 UpdateStatus(); |
| 38 BrowserList::AddObserver(this); | 37 BrowserList::AddObserver(this); |
| 39 } | 38 } |
| 40 | 39 |
| 41 WindowSwitcherButton::~WindowSwitcherButton() { | 40 WindowSwitcherButton::~WindowSwitcherButton() { |
| 42 BrowserList::RemoveObserver(this); | 41 BrowserList::RemoveObserver(this); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 void WindowSwitcherButton::OnBrowserAdded(const Browser* browser) { | 84 void WindowSwitcherButton::OnBrowserAdded(const Browser* browser) { |
| 86 UpdateStatus(); | 85 UpdateStatus(); |
| 87 } | 86 } |
| 88 | 87 |
| 89 // Called immediately after a browser is removed from the list | 88 // Called immediately after a browser is removed from the list |
| 90 void WindowSwitcherButton::OnBrowserRemoved(const Browser* browser) { | 89 void WindowSwitcherButton::OnBrowserRemoved(const Browser* browser) { |
| 91 UpdateStatus(); | 90 UpdateStatus(); |
| 92 } | 91 } |
| 93 | 92 |
| 94 } // namespace chromeos | 93 } // namespace chromeos |
| OLD | NEW |