window_switcher_button.h revision 72a454cd3513ac24fbdd0e0cb9ad70b86a99b801
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 3// found in the LICENSE file. 4 5#ifndef CHROME_BROWSER_CHROMEOS_STATUS_WINDOW_SWITCHER_BUTTON_H_ 6#define CHROME_BROWSER_CHROMEOS_STATUS_WINDOW_SWITCHER_BUTTON_H_ 7#pragma once 8 9#include "base/scoped_ptr.h" 10#include "chrome/browser/chromeos/status/status_area_button.h" 11#include "chrome/browser/ui/browser_list.h" 12#include "chrome/common/notification_observer.h" 13#include "views/controls/button/menu_button.h" 14#include "views/controls/menu/view_menu_delegate.h" 15 16namespace chromeos { 17 18class StatusAreaHost; 19 20// The window switcher button in the status area. This button allows 21// the user to move to the next window if they click on the icon. 22class WindowSwitcherButton : public StatusAreaButton, 23 public views::ViewMenuDelegate, 24 public BrowserList::Observer { 25 public: 26 explicit WindowSwitcherButton(StatusAreaHost* host); 27 virtual ~WindowSwitcherButton(); 28 29 private: 30 // Updates the status of the button based on the state of the 31 // browser list. 32 void UpdateStatus(); 33 34 // BrowserList::Observer API 35 virtual void OnBrowserAdded(const Browser* browser); 36 virtual void OnBrowserRemoved(const Browser* browser); 37 38 // views::ViewMenuDelegate implementation. 39 virtual void RunMenu(views::View* source, const gfx::Point& pt); 40 41 StatusAreaHost* host_; 42 43 DISALLOW_COPY_AND_ASSIGN(WindowSwitcherButton); 44}; 45 46} // namespace chromeos 47 48#endif // CHROME_BROWSER_CHROMEOS_STATUS_WINDOW_SWITCHER_BUTTON_H_ 49