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

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: 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 ClockMenuButton* clock_button = NULL;
34 AddChromeosButtons(this, delegate, screen_mode, &clock_button);
34 } 35 }
35 36
36 void StatusAreaViewChromeos::SystemResumed() { 37 void StatusAreaViewChromeos::SystemResumed() {
37 UpdateClockText(); 38 UpdateClockText();
38 } 39 }
39 40
40 void StatusAreaViewChromeos::TimezoneChanged(const icu::TimeZone& timezone) { 41 void StatusAreaViewChromeos::TimezoneChanged(const icu::TimeZone& timezone) {
41 UpdateClockText(); 42 UpdateClockText();
42 } 43 }
43 44
44 void StatusAreaViewChromeos::UpdateClockText() { 45 void StatusAreaViewChromeos::UpdateClockText() {
45 ClockMenuButton* clock_button = 46 ClockMenuButton* clock_button =
46 static_cast<ClockMenuButton*>(GetViewByID(VIEW_ID_STATUS_BUTTON_CLOCK)); 47 static_cast<ClockMenuButton*>(GetViewByID(VIEW_ID_STATUS_BUTTON_CLOCK));
47 if (clock_button) 48 if (clock_button)
48 clock_button->UpdateText(); 49 clock_button->UpdateText();
49 } 50 }
50 51
51 void StatusAreaViewChromeos::SetDefaultUse24HourClock(bool use_24hour_clock) { 52 void StatusAreaViewChromeos::SetDefaultUse24HourClock(bool use_24hour_clock) {
52 ClockMenuButton* clock_button = 53 ClockMenuButton* clock_button =
53 static_cast<ClockMenuButton*>(GetViewByID(VIEW_ID_STATUS_BUTTON_CLOCK)); 54 static_cast<ClockMenuButton*>(GetViewByID(VIEW_ID_STATUS_BUTTON_CLOCK));
54 if (clock_button) 55 if (clock_button)
55 clock_button->SetDefaultUse24HourClock(use_24hour_clock); 56 clock_button->SetDefaultUse24HourClock(use_24hour_clock);
56 } 57 }
57 58
58 // static 59 // static
59 void StatusAreaViewChromeos::AddChromeosButtons( 60 void StatusAreaViewChromeos::AddChromeosButtons(
60 StatusAreaView* status_area, 61 StatusAreaView* status_area,
61 StatusAreaButton::Delegate* delegate, 62 StatusAreaButton::Delegate* delegate,
62 ScreenMode screen_mode) { 63 ScreenMode screen_mode,
64 ClockMenuButton** clock_button) {
stevenjb 2011/11/18 23:06:11 Oh, one more nit. We might want to allow this to b
sky 2011/11/18 23:12:55 Done.
63 const bool border = true; 65 const bool border = true;
64 const bool no_border = false; 66 const bool no_border = false;
65 67
66 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kMemoryWidget)) 68 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kMemoryWidget))
67 status_area->AddButton(new MemoryMenuButton(delegate), no_border); 69 status_area->AddButton(new MemoryMenuButton(delegate), no_border);
68 70
69 status_area->AddButton( 71 status_area->AddButton(
70 new AccessibilityMenuButton(delegate, screen_mode), border); 72 new AccessibilityMenuButton(delegate, screen_mode), border);
71 status_area->AddButton(new CapsLockMenuButton(delegate), border); 73 status_area->AddButton(new CapsLockMenuButton(delegate), border);
72 status_area->AddButton(new ClockMenuButton(delegate), border); 74 *clock_button = new ClockMenuButton(delegate);
75 status_area->AddButton(*clock_button, border);
73 76
74 status_area->AddButton( 77 status_area->AddButton(
75 new InputMethodMenuButton(delegate, screen_mode), no_border); 78 new InputMethodMenuButton(delegate, screen_mode), no_border);
76 status_area->AddButton( 79 status_area->AddButton(
77 new NetworkMenuButton(delegate, screen_mode), no_border); 80 new NetworkMenuButton(delegate, screen_mode), no_border);
78 status_area->AddButton(new PowerMenuButton(delegate), no_border); 81 status_area->AddButton(new PowerMenuButton(delegate), no_border);
79 } 82 }
80 83
81 } // namespace chromeos 84 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698