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

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

Issue 7324017: Split SystemAccess into TimezoneSettings, StatisticsProvider, and SyslogsProvider. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 9 years, 5 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 #include "chrome/browser/chromeos/status/clock_menu_button.h" 5 #include "chrome/browser/chromeos/status/clock_menu_button.h"
6 6
7 #include "base/i18n/time_formatting.h" 7 #include "base/i18n/time_formatting.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 22 matching lines...) Expand all
33 } // namespace 33 } // namespace
34 34
35 namespace chromeos { 35 namespace chromeos {
36 36
37 // Amount of slop to add into the timer to make sure we're into the next minute 37 // Amount of slop to add into the timer to make sure we're into the next minute
38 // when the timer goes off. 38 // when the timer goes off.
39 const int kTimerSlopSeconds = 1; 39 const int kTimerSlopSeconds = 1;
40 40
41 ClockMenuButton::ClockMenuButton(StatusAreaHost* host) 41 ClockMenuButton::ClockMenuButton(StatusAreaHost* host)
42 : StatusAreaButton(host, this) { 42 : StatusAreaButton(host, this) {
43 // Add as SystemAccess observer. We update the clock if timezone changes. 43 // Add as TimezoneSettings observer. We update the clock if timezone changes.
44 SystemAccess::GetInstance()->AddObserver(this); 44 system::TimezoneSettings::GetInstance()->AddObserver(this);
45 CrosLibrary::Get()->GetPowerLibrary()->AddObserver(this); 45 CrosLibrary::Get()->GetPowerLibrary()->AddObserver(this);
46 // Start monitoring the kUse24HourClock preference. 46 // Start monitoring the kUse24HourClock preference.
47 if (host->GetProfile()) { // This can be NULL in the login screen. 47 if (host->GetProfile()) { // This can be NULL in the login screen.
48 registrar_.Init(host->GetProfile()->GetPrefs()); 48 registrar_.Init(host->GetProfile()->GetPrefs());
49 registrar_.Add(prefs::kUse24HourClock, this); 49 registrar_.Add(prefs::kUse24HourClock, this);
50 } 50 }
51 51
52 UpdateTextAndSetNextTimer(); 52 UpdateTextAndSetNextTimer();
53 } 53 }
54 54
55 ClockMenuButton::~ClockMenuButton() { 55 ClockMenuButton::~ClockMenuButton() {
56 CrosLibrary::Get()->GetPowerLibrary()->RemoveObserver(this); 56 CrosLibrary::Get()->GetPowerLibrary()->RemoveObserver(this);
57 SystemAccess::GetInstance()->RemoveObserver(this); 57 system::TimezoneSettings::GetInstance()->RemoveObserver(this);
58 } 58 }
59 59
60 void ClockMenuButton::UpdateTextAndSetNextTimer() { 60 void ClockMenuButton::UpdateTextAndSetNextTimer() {
61 UpdateText(); 61 UpdateText();
62 62
63 // Try to set the timer to go off at the next change of the minute. We don't 63 // Try to set the timer to go off at the next change of the minute. We don't
64 // want to have the timer go off more than necessary since that will cause 64 // want to have the timer go off more than necessary since that will cause
65 // the CPU to wake up and consume power. 65 // the CPU to wake up and consume power.
66 base::Time now = base::Time::Now(); 66 base::Time now = base::Time::Now();
67 base::Time::Exploded exploded; 67 base::Time::Exploded exploded;
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 const string16 clock_open_options_label = 191 const string16 clock_open_options_label =
192 l10n_util::GetStringUTF16(IDS_STATUSBAR_CLOCK_OPEN_OPTIONS_DIALOG); 192 l10n_util::GetStringUTF16(IDS_STATUSBAR_CLOCK_OPEN_OPTIONS_DIALOG);
193 menu_->AppendMenuItemWithLabel( 193 menu_->AppendMenuItemWithLabel(
194 CLOCK_OPEN_OPTIONS_ITEM, 194 CLOCK_OPEN_OPTIONS_ITEM,
195 UTF16ToWide(clock_open_options_label)); 195 UTF16ToWide(clock_open_options_label));
196 } 196 }
197 } 197 }
198 } 198 }
199 199
200 } // namespace chromeos 200 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/status/clock_menu_button.h ('k') | chrome/browser/chromeos/status/clock_menu_button_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698