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

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: 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/resume_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 "chrome/common/notification_observer.h" 14 #include "chrome/common/notification_observer.h"
14 #include "unicode/calendar.h" 15 #include "unicode/calendar.h"
15 #include "views/controls/button/menu_button.h" 16 #include "views/controls/button/menu_button.h"
16 #include "views/controls/menu/menu_2.h" 17 #include "views/controls/menu/menu_2.h"
17 #include "views/controls/menu/view_menu_delegate.h" 18 #include "views/controls/menu/view_menu_delegate.h"
18 19
19 namespace chromeos { 20 namespace chromeos {
20 21
21 class StatusAreaHost; 22 class StatusAreaHost;
22 23
23 // The clock menu button in the status area. 24 // The clock menu button in the status area.
24 // This button shows the current time. 25 // This button shows the current time.
25 class ClockMenuButton : public StatusAreaButton, 26 class ClockMenuButton : public StatusAreaButton,
26 public views::ViewMenuDelegate, 27 public views::ViewMenuDelegate,
27 public ui::MenuModel, 28 public ui::MenuModel,
29 public ResumeLibrary::Observer,
28 public SystemLibrary::Observer { 30 public SystemLibrary::Observer {
29 public: 31 public:
30 explicit ClockMenuButton(StatusAreaHost* host); 32 explicit ClockMenuButton(StatusAreaHost* host);
31 virtual ~ClockMenuButton(); 33 virtual ~ClockMenuButton();
32 34
33 // ui::MenuModel implementation. 35 // ui::MenuModel implementation.
34 virtual bool HasIcons() const { return false; } 36 virtual bool HasIcons() const { return false; }
35 virtual int GetItemCount() const; 37 virtual int GetItemCount() const;
36 virtual ui::MenuModel::ItemType GetTypeAt(int index) const; 38 virtual ui::MenuModel::ItemType GetTypeAt(int index) const;
37 virtual int GetCommandIdAt(int index) const { return index; } 39 virtual int GetCommandIdAt(int index) const { return index; }
38 virtual string16 GetLabelAt(int index) const; 40 virtual string16 GetLabelAt(int index) const;
39 virtual bool IsItemDynamicAt(int index) const { return true; } 41 virtual bool IsItemDynamicAt(int index) const { return true; }
40 virtual bool GetAcceleratorAt(int index, 42 virtual bool GetAcceleratorAt(int index,
41 ui::Accelerator* accelerator) const { return false; } 43 ui::Accelerator* accelerator) const { return false; }
42 virtual bool IsItemCheckedAt(int index) const { return false; } 44 virtual bool IsItemCheckedAt(int index) const { return false; }
43 virtual int GetGroupIdAt(int index) const { return 0; } 45 virtual int GetGroupIdAt(int index) const { return 0; }
44 virtual bool GetIconAt(int index, SkBitmap* icon) const { return false; } 46 virtual bool GetIconAt(int index, SkBitmap* icon) const { return false; }
45 virtual ui::ButtonMenuItemModel* GetButtonMenuItemAt(int index) const { 47 virtual ui::ButtonMenuItemModel* GetButtonMenuItemAt(int index) const {
46 return NULL; 48 return NULL;
47 } 49 }
48 virtual bool IsEnabledAt(int index) const; 50 virtual bool IsEnabledAt(int index) const;
49 virtual ui::MenuModel* GetSubmenuModelAt(int index) const { return NULL; } 51 virtual ui::MenuModel* GetSubmenuModelAt(int index) const { return NULL; }
50 virtual void HighlightChangedTo(int index) {} 52 virtual void HighlightChangedTo(int index) {}
51 virtual void ActivatedAt(int index); 53 virtual void ActivatedAt(int index);
52 virtual void MenuWillShow() {} 54 virtual void MenuWillShow() {}
53 55
56 // Overridden from ResumeLibrary::Observer:
57 virtual void SystemResumed();
58
54 // Overridden from SystemLibrary::Observer: 59 // Overridden from SystemLibrary::Observer:
55 virtual void TimezoneChanged(const icu::TimeZone& timezone); 60 virtual void TimezoneChanged(const icu::TimeZone& timezone);
56 61
57 // 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
58 // changes. 63 // changes.
59 void UpdateText(); 64 void UpdateText();
60 65
61 protected: 66 protected:
62 virtual int horizontal_padding() { return 3; } 67 virtual int horizontal_padding() { return 3; }
63 68
(...skipping 12 matching lines...) Expand all
76 scoped_ptr<views::Menu2> clock_menu_; 81 scoped_ptr<views::Menu2> clock_menu_;
77 82
78 StatusAreaHost* host_; 83 StatusAreaHost* host_;
79 84
80 DISALLOW_COPY_AND_ASSIGN(ClockMenuButton); 85 DISALLOW_COPY_AND_ASSIGN(ClockMenuButton);
81 }; 86 };
82 87
83 } // namespace chromeos 88 } // namespace chromeos
84 89
85 #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