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

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

Issue 7720012: Moves ownership of MenuItemView to MenuRunner as well as responbility (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unit test Created 9 years, 4 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/memory/scoped_ptr.h" 9 #include "base/memory/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/power_library.h"
12 #include "chrome/browser/chromeos/status/status_area_button.h" 12 #include "chrome/browser/chromeos/status/status_area_button.h"
13 #include "chrome/browser/prefs/pref_change_registrar.h" 13 #include "chrome/browser/prefs/pref_change_registrar.h"
14 #include "chrome/browser/prefs/pref_member.h" 14 #include "chrome/browser/prefs/pref_member.h"
15 #include "content/common/content_notification_types.h" 15 #include "content/common/content_notification_types.h"
16 #include "content/common/notification_observer.h" 16 #include "content/common/notification_observer.h"
17 #include "chrome/browser/chromeos/system/timezone_settings.h" 17 #include "chrome/browser/chromeos/system/timezone_settings.h"
18 #include "unicode/calendar.h" 18 #include "unicode/calendar.h"
19 #include "views/controls/button/menu_button.h" 19 #include "views/controls/button/menu_button.h"
20 #include "views/controls/menu/menu_delegate.h" 20 #include "views/controls/menu/menu_delegate.h"
21 #include "views/controls/menu/view_menu_delegate.h" 21 #include "views/controls/menu/view_menu_delegate.h"
22 22
23 namespace views { 23 namespace views {
24 class MenuItemView; 24 class MenuRunner;
25 } 25 }
26 26
27 namespace chromeos { 27 namespace chromeos {
28 28
29 class StatusAreaHost; 29 class StatusAreaHost;
30 30
31 // The clock menu button in the status area. 31 // The clock menu button in the status area.
32 // This button shows the current time. 32 // This button shows the current time.
33 class ClockMenuButton : public StatusAreaButton, 33 class ClockMenuButton : public StatusAreaButton,
34 public views::MenuDelegate, 34 public views::MenuDelegate,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 73
74 // Create and initialize menu if not already present. 74 // Create and initialize menu if not already present.
75 void EnsureMenu(); 75 void EnsureMenu();
76 76
77 // Updates text and schedules the timer to fire at the next minute interval. 77 // Updates text and schedules the timer to fire at the next minute interval.
78 void UpdateTextAndSetNextTimer(); 78 void UpdateTextAndSetNextTimer();
79 79
80 base::OneShotTimer<ClockMenuButton> timer_; 80 base::OneShotTimer<ClockMenuButton> timer_;
81 81
82 // The clock menu. 82 // The clock menu.
83 // NOTE: we use a scoped_ptr here as menu calls into 'this' from the 83 scoped_ptr<views::MenuRunner> menu_runner_;
84 // constructor.
85 scoped_ptr<views::MenuItemView> menu_;
86 84
87 PrefChangeRegistrar registrar_; 85 PrefChangeRegistrar registrar_;
88 86
89 DISALLOW_COPY_AND_ASSIGN(ClockMenuButton); 87 DISALLOW_COPY_AND_ASSIGN(ClockMenuButton);
90 }; 88 };
91 89
92 } // namespace chromeos 90 } // namespace chromeos
93 91
94 #endif // CHROME_BROWSER_CHROMEOS_STATUS_CLOCK_MENU_BUTTON_H_ 92 #endif // CHROME_BROWSER_CHROMEOS_STATUS_CLOCK_MENU_BUTTON_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698