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

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

Issue 8600001: Fixes bug where clock button wasn't updating in response to a timezone (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge and allow NULL Created 9 years, 1 month 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/status_area_view_chromeos.h" 5 #include "chrome/browser/chromeos/status/status_area_view_chromeos.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/browser/chromeos/cros/cros_library.h" 8 #include "chrome/browser/chromeos/cros/cros_library.h"
9 #include "chrome/browser/chromeos/status/accessibility_menu_button.h" 9 #include "chrome/browser/chromeos/status/accessibility_menu_button.h"
10 #include "chrome/browser/chromeos/status/caps_lock_menu_button.h" 10 #include "chrome/browser/chromeos/status/caps_lock_menu_button.h"
(...skipping 12 matching lines...) Expand all
23 system::TimezoneSettings::GetInstance()->AddObserver(this); 23 system::TimezoneSettings::GetInstance()->AddObserver(this);
24 } 24 }
25 25
26 StatusAreaViewChromeos::~StatusAreaViewChromeos() { 26 StatusAreaViewChromeos::~StatusAreaViewChromeos() {
27 CrosLibrary::Get()->GetPowerLibrary()->RemoveObserver(this); 27 CrosLibrary::Get()->GetPowerLibrary()->RemoveObserver(this);
28 system::TimezoneSettings::GetInstance()->RemoveObserver(this); 28 system::TimezoneSettings::GetInstance()->RemoveObserver(this);
29 } 29 }
30 30
31 void StatusAreaViewChromeos::Init(StatusAreaButton::Delegate* delegate, 31 void StatusAreaViewChromeos::Init(StatusAreaButton::Delegate* delegate,
32 ScreenMode screen_mode) { 32 ScreenMode screen_mode) {
33 AddChromeosButtons(this, delegate, screen_mode); 33 AddChromeosButtons(this, delegate, screen_mode, NULL);
34 } 34 }
35 35
36 void StatusAreaViewChromeos::SystemResumed() { 36 void StatusAreaViewChromeos::SystemResumed() {
37 UpdateClockText(); 37 UpdateClockText();
38 } 38 }
39 39
40 void StatusAreaViewChromeos::TimezoneChanged(const icu::TimeZone& timezone) { 40 void StatusAreaViewChromeos::TimezoneChanged(const icu::TimeZone& timezone) {
41 UpdateClockText(); 41 UpdateClockText();
42 } 42 }
43 43
44 void StatusAreaViewChromeos::UpdateClockText() { 44 void StatusAreaViewChromeos::UpdateClockText() {
45 ClockMenuButton* clock_button = 45 ClockMenuButton* clock_button =
46 static_cast<ClockMenuButton*>(GetViewByID(VIEW_ID_STATUS_BUTTON_CLOCK)); 46 static_cast<ClockMenuButton*>(GetViewByID(VIEW_ID_STATUS_BUTTON_CLOCK));
47 if (clock_button) 47 if (clock_button)
48 clock_button->UpdateText(); 48 clock_button->UpdateText();
49 } 49 }
50 50
51 void StatusAreaViewChromeos::SetDefaultUse24HourClock(bool use_24hour_clock) { 51 void StatusAreaViewChromeos::SetDefaultUse24HourClock(bool use_24hour_clock) {
52 ClockMenuButton* clock_button = 52 ClockMenuButton* clock_button =
53 static_cast<ClockMenuButton*>(GetViewByID(VIEW_ID_STATUS_BUTTON_CLOCK)); 53 static_cast<ClockMenuButton*>(GetViewByID(VIEW_ID_STATUS_BUTTON_CLOCK));
54 if (clock_button) 54 if (clock_button)
55 clock_button->SetDefaultUse24HourClock(use_24hour_clock); 55 clock_button->SetDefaultUse24HourClock(use_24hour_clock);
56 } 56 }
57 57
58 // static 58 // static
59 void StatusAreaViewChromeos::AddChromeosButtons( 59 void StatusAreaViewChromeos::AddChromeosButtons(
60 StatusAreaView* status_area, 60 StatusAreaView* status_area,
61 StatusAreaButton::Delegate* delegate, 61 StatusAreaButton::Delegate* delegate,
62 ScreenMode screen_mode) { 62 ScreenMode screen_mode,
63 ClockMenuButton** clock_button) {
63 const bool border = true; 64 const bool border = true;
64 const bool no_border = false; 65 const bool no_border = false;
65 66
66 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kMemoryWidget)) 67 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kMemoryWidget))
67 status_area->AddButton(new MemoryMenuButton(delegate), no_border); 68 status_area->AddButton(new MemoryMenuButton(delegate), no_border);
68 69
69 status_area->AddButton( 70 status_area->AddButton(
70 new AccessibilityMenuButton(delegate, screen_mode), border); 71 new AccessibilityMenuButton(delegate, screen_mode), border);
71 status_area->AddButton(new CapsLockMenuButton(delegate), border); 72 status_area->AddButton(new CapsLockMenuButton(delegate), border);
72 status_area->AddButton(new ClockMenuButton(delegate), border); 73 ClockMenuButton* clock = new ClockMenuButton(delegate);
74 status_area->AddButton(clock, border);
75 if (clock_button)
76 *clock_button = clock;
73 77
74 status_area->AddButton( 78 status_area->AddButton(
75 new InputMethodMenuButton(delegate, screen_mode), no_border); 79 new InputMethodMenuButton(delegate, screen_mode), no_border);
76 status_area->AddButton( 80 status_area->AddButton(
77 new NetworkMenuButton(delegate, screen_mode), no_border); 81 new NetworkMenuButton(delegate, screen_mode), no_border);
78 status_area->AddButton(new PowerMenuButton(delegate), no_border); 82 status_area->AddButton(new PowerMenuButton(delegate), no_border);
79 } 83 }
80 84
81 } // namespace chromeos 85 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/status/status_area_view_chromeos.h ('k') | chrome/browser/chromeos/status/timezone_clock_updater.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698