Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Side by Side Diff: chrome/browser/chromeos/status/clock_menu_button.h

Issue 6486007: Introducing ResumeLibrary to track system resume signal (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ResumeLibrary removed, its functions moved to PowerLibrary Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #ifndef CHROME_BROWSER_CHROMEOS_STATUS_CLOCK_MENU_BUTTON_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_STATUS_CLOCK_MENU_BUTTON_H_
6 #define CHROME_BROWSER_CHROMEOS_STATUS_CLOCK_MENU_BUTTON_H_ 6 #define CHROME_BROWSER_CHROMEOS_STATUS_CLOCK_MENU_BUTTON_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/scoped_ptr.h" 9 #include "base/scoped_ptr.h"
10 #include "base/timer.h" 10 #include "base/timer.h"
11 #include "chrome/browser/chromeos/cros/power_library.h"
11 #include "chrome/browser/chromeos/cros/system_library.h" 12 #include "chrome/browser/chromeos/cros/system_library.h"
12 #include "chrome/browser/chromeos/status/status_area_button.h" 13 #include "chrome/browser/chromeos/status/status_area_button.h"
13 #include "unicode/calendar.h" 14 #include "unicode/calendar.h"
14 #include "views/controls/button/menu_button.h" 15 #include "views/controls/button/menu_button.h"
15 #include "views/controls/menu/menu_2.h" 16 #include "views/controls/menu/menu_2.h"
16 #include "views/controls/menu/view_menu_delegate.h" 17 #include "views/controls/menu/view_menu_delegate.h"
17 18
18 namespace chromeos { 19 namespace chromeos {
19 20
20 class StatusAreaHost; 21 class StatusAreaHost;
21 22
22 // The clock menu button in the status area. 23 // The clock menu button in the status area.
23 // This button shows the current time. 24 // This button shows the current time.
24 class ClockMenuButton : public StatusAreaButton, 25 class ClockMenuButton : public StatusAreaButton,
25 public views::ViewMenuDelegate, 26 public views::ViewMenuDelegate,
26 public ui::MenuModel, 27 public ui::MenuModel,
28 public PowerLibrary::Observer,
27 public SystemLibrary::Observer { 29 public SystemLibrary::Observer {
28 public: 30 public:
29 explicit ClockMenuButton(StatusAreaHost* host); 31 explicit ClockMenuButton(StatusAreaHost* host);
30 virtual ~ClockMenuButton(); 32 virtual ~ClockMenuButton();
31 33
32 // ui::MenuModel implementation. 34 // ui::MenuModel implementation.
33 virtual bool HasIcons() const { return false; } 35 virtual bool HasIcons() const { return false; }
34 virtual int GetItemCount() const; 36 virtual int GetItemCount() const;
35 virtual ui::MenuModel::ItemType GetTypeAt(int index) const; 37 virtual ui::MenuModel::ItemType GetTypeAt(int index) const;
36 virtual int GetCommandIdAt(int index) const { return index; } 38 virtual int GetCommandIdAt(int index) const { return index; }
37 virtual string16 GetLabelAt(int index) const; 39 virtual string16 GetLabelAt(int index) const;
38 virtual bool IsItemDynamicAt(int index) const { return true; } 40 virtual bool IsItemDynamicAt(int index) const { return true; }
39 virtual bool GetAcceleratorAt(int index, 41 virtual bool GetAcceleratorAt(int index,
40 ui::Accelerator* accelerator) const { return false; } 42 ui::Accelerator* accelerator) const { return false; }
41 virtual bool IsItemCheckedAt(int index) const { return false; } 43 virtual bool IsItemCheckedAt(int index) const { return false; }
42 virtual int GetGroupIdAt(int index) const { return 0; } 44 virtual int GetGroupIdAt(int index) const { return 0; }
43 virtual bool GetIconAt(int index, SkBitmap* icon) const { return false; } 45 virtual bool GetIconAt(int index, SkBitmap* icon) const { return false; }
44 virtual ui::ButtonMenuItemModel* GetButtonMenuItemAt(int index) const { 46 virtual ui::ButtonMenuItemModel* GetButtonMenuItemAt(int index) const {
45 return NULL; 47 return NULL;
46 } 48 }
47 virtual bool IsEnabledAt(int index) const; 49 virtual bool IsEnabledAt(int index) const;
48 virtual ui::MenuModel* GetSubmenuModelAt(int index) const { return NULL; } 50 virtual ui::MenuModel* GetSubmenuModelAt(int index) const { return NULL; }
49 virtual void HighlightChangedTo(int index) {} 51 virtual void HighlightChangedTo(int index) {}
50 virtual void ActivatedAt(int index); 52 virtual void ActivatedAt(int index);
51 virtual void MenuWillShow() {} 53 virtual void MenuWillShow() {}
52 54
55 // Overridden from ResumeLibrary::Observer:
56 virtual void PowerChanged(PowerLibrary* obj) {}
57 virtual void SystemResumed();
58
53 // Overridden from SystemLibrary::Observer: 59 // Overridden from SystemLibrary::Observer:
54 virtual void TimezoneChanged(const icu::TimeZone& timezone); 60 virtual void TimezoneChanged(const icu::TimeZone& timezone);
55 61
56 // Updates the time on the menu button. Can be called by host if timezone 62 // Updates the time on the menu button. Can be called by host if timezone
57 // changes. 63 // changes.
58 void UpdateText(); 64 void UpdateText();
59 65
60 protected: 66 protected:
61 virtual int horizontal_padding() { return 3; } 67 virtual int horizontal_padding() { return 3; }
62 68
(...skipping 12 matching lines...) Expand all
75 scoped_ptr<views::Menu2> clock_menu_; 81 scoped_ptr<views::Menu2> clock_menu_;
76 82
77 StatusAreaHost* host_; 83 StatusAreaHost* host_;
78 84
79 DISALLOW_COPY_AND_ASSIGN(ClockMenuButton); 85 DISALLOW_COPY_AND_ASSIGN(ClockMenuButton);
80 }; 86 };
81 87
82 } // namespace chromeos 88 } // namespace chromeos
83 89
84 #endif // CHROME_BROWSER_CHROMEOS_STATUS_CLOCK_MENU_BUTTON_H_ 90 #endif // CHROME_BROWSER_CHROMEOS_STATUS_CLOCK_MENU_BUTTON_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698