| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 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_UI_VIEWS_AURA_STATUS_AREA_HOST_AURA_H_ | |
| 6 #define CHROME_BROWSER_UI_VIEWS_AURA_STATUS_AREA_HOST_AURA_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "base/compiler_specific.h" | |
| 10 #include "chrome/browser/chromeos/status/status_area_button.h" | |
| 11 #include "chrome/browser/ui/browser_list.h" | |
| 12 #include "content/public/browser/notification_observer.h" | |
| 13 #include "content/public/browser/notification_registrar.h" | |
| 14 | |
| 15 #if defined(OS_CHROMEOS) | |
| 16 #include "base/memory/scoped_ptr.h" | |
| 17 #include "chrome/browser/chromeos/login/login_html_dialog.h" | |
| 18 #endif | |
| 19 | |
| 20 class ClockUpdater; | |
| 21 class StatusAreaView; | |
| 22 | |
| 23 namespace views { | |
| 24 class Views; | |
| 25 class Widget; | |
| 26 } | |
| 27 | |
| 28 class StatusAreaHostAura : public StatusAreaButton::Delegate, | |
| 29 public BrowserList::Observer, | |
| 30 public content::NotificationObserver { | |
| 31 public: | |
| 32 // Returns the padding between the corner of the status area and the corner of | |
| 33 // the screen when we're displaying either the login/lock screen or a browser | |
| 34 // window in compact mode. Exposed here for tests. | |
| 35 static gfx::Size GetCompactModeLoginAndLockOffset(); | |
| 36 static gfx::Size GetCompactModeBrowserOffset(); | |
| 37 | |
| 38 StatusAreaHostAura(); | |
| 39 virtual ~StatusAreaHostAura(); | |
| 40 | |
| 41 // Returns the status area view. | |
| 42 StatusAreaView* GetStatusArea(); | |
| 43 | |
| 44 // Instantiates and sets |status_area_view_|, and sets it as the contents of | |
| 45 // a new views::Widget |status_area_widget_| which is returned. | |
| 46 // The caller is expected to take ownership of |status_area_widget_|. | |
| 47 views::Widget* CreateStatusArea(); | |
| 48 | |
| 49 // Adds the buttons to the status area. This is called separately, after | |
| 50 // the profile has been initialized. | |
| 51 void AddButtons(); | |
| 52 | |
| 53 // StatusAreaButton::Delegate implementation. | |
| 54 virtual bool ShouldExecuteStatusAreaCommand( | |
| 55 const views::View* button_view, int command_id) const OVERRIDE; | |
| 56 virtual void ExecuteStatusAreaCommand( | |
| 57 const views::View* button_view, int command_id) OVERRIDE; | |
| 58 virtual StatusAreaButton::TextStyle GetStatusAreaTextStyle() const OVERRIDE; | |
| 59 virtual void ButtonVisibilityChanged(views::View* button_view) OVERRIDE; | |
| 60 | |
| 61 // BrowserList::Observer implementation. | |
| 62 virtual void OnBrowserAdded(const Browser* browser) OVERRIDE {} | |
| 63 virtual void OnBrowserRemoved(const Browser* browser) OVERRIDE {} | |
| 64 virtual void OnBrowserSetLastActive(const Browser* browser) OVERRIDE; | |
| 65 | |
| 66 // content::NotificationObserver implementation. | |
| 67 virtual void Observe(int type, | |
| 68 const content::NotificationSource& source, | |
| 69 const content::NotificationDetails& details) OVERRIDE; | |
| 70 | |
| 71 private: | |
| 72 // Is either the login or lock screen currently displayed? | |
| 73 bool IsLoginOrLockScreenDisplayed() const; | |
| 74 | |
| 75 // Triggers an update of the status area text style and position. | |
| 76 void UpdateAppearance(); | |
| 77 | |
| 78 // Owned by caller of CreateStatusArea(). | |
| 79 views::Widget* status_area_widget_; | |
| 80 // Owned by status_area_widget_. | |
| 81 StatusAreaView* status_area_view_; | |
| 82 | |
| 83 #if defined(OS_CHROMEOS) | |
| 84 // Proxy settings dialog that can be invoked from network menu. | |
| 85 scoped_ptr<chromeos::LoginHtmlDialog> proxy_settings_dialog_; | |
| 86 | |
| 87 scoped_ptr<ClockUpdater> clock_updater_; | |
| 88 #endif | |
| 89 | |
| 90 content::NotificationRegistrar registrar_; | |
| 91 | |
| 92 DISALLOW_COPY_AND_ASSIGN(StatusAreaHostAura); | |
| 93 }; | |
| 94 | |
| 95 #endif // CHROME_BROWSER_UI_VIEWS_AURA_STATUS_AREA_HOST_AURA_H_ | |
| OLD | NEW |