OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
9 #include "base/i18n/time_formatting.h" | 9 #include "base/i18n/time_formatting.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
11 #include "base/time.h" | 11 #include "base/time.h" |
(...skipping 15 matching lines...) Expand all Loading... |
27 ClockMenuButton::ClockMenuButton(StatusAreaHost* host) | 27 ClockMenuButton::ClockMenuButton(StatusAreaHost* host) |
28 : MenuButton(NULL, std::wstring(), this, false), | 28 : MenuButton(NULL, std::wstring(), this, false), |
29 host_(host) { | 29 host_(host) { |
30 // Add as SystemLibrary observer. We update the clock if timezone changes. | 30 // Add as SystemLibrary observer. We update the clock if timezone changes. |
31 CrosLibrary::Get()->GetSystemLibrary()->AddObserver(this); | 31 CrosLibrary::Get()->GetSystemLibrary()->AddObserver(this); |
32 | 32 |
33 set_border(NULL); | 33 set_border(NULL); |
34 SetFont(ResourceBundle::GetSharedInstance().GetFont( | 34 SetFont(ResourceBundle::GetSharedInstance().GetFont( |
35 ResourceBundle::BaseFont).DeriveFont(1, gfx::Font::BOLD)); | 35 ResourceBundle::BaseFont).DeriveFont(1, gfx::Font::BOLD)); |
36 SetEnabledColor(0xB3FFFFFF); // White with 70% Alpha | 36 SetEnabledColor(0xB3FFFFFF); // White with 70% Alpha |
37 SetShowHighlighted(false); | 37 SetShowMultipleStates(false); |
38 set_alignment(TextButton::ALIGN_RIGHT); | 38 set_alignment(TextButton::ALIGN_RIGHT); |
39 UpdateTextAndSetNextTimer(); | 39 UpdateTextAndSetNextTimer(); |
40 } | 40 } |
41 | 41 |
42 ClockMenuButton::~ClockMenuButton() { | 42 ClockMenuButton::~ClockMenuButton() { |
43 CrosLibrary::Get()->GetSystemLibrary()->RemoveObserver(this); | 43 CrosLibrary::Get()->GetSystemLibrary()->RemoveObserver(this); |
44 } | 44 } |
45 | 45 |
46 void ClockMenuButton::UpdateTextAndSetNextTimer() { | 46 void ClockMenuButton::UpdateTextAndSetNextTimer() { |
47 UpdateText(); | 47 UpdateText(); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 void ClockMenuButton::RunMenu(views::View* source, const gfx::Point& pt) { | 127 void ClockMenuButton::RunMenu(views::View* source, const gfx::Point& pt) { |
128 if (!clock_menu_.get()) | 128 if (!clock_menu_.get()) |
129 clock_menu_.reset(new views::Menu2(this)); | 129 clock_menu_.reset(new views::Menu2(this)); |
130 else | 130 else |
131 clock_menu_->Rebuild(); | 131 clock_menu_->Rebuild(); |
132 clock_menu_->UpdateStates(); | 132 clock_menu_->UpdateStates(); |
133 clock_menu_->RunMenuAt(pt, views::Menu2::ALIGN_TOPRIGHT); | 133 clock_menu_->RunMenuAt(pt, views::Menu2::ALIGN_TOPRIGHT); |
134 } | 134 } |
135 | 135 |
136 } // namespace chromeos | 136 } // namespace chromeos |
OLD | NEW |