OLD | NEW |
1 // Copyright (c) 2010 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" |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 ClockMenuButton::ClockMenuButton(StatusAreaHost* host) | 28 ClockMenuButton::ClockMenuButton(StatusAreaHost* host) |
29 : StatusAreaButton(this), | 29 : StatusAreaButton(this), |
30 host_(host) { | 30 host_(host) { |
31 // Add as SystemLibrary observer. We update the clock if timezone changes. | 31 // Add as SystemLibrary observer. We update the clock if timezone changes. |
32 CrosLibrary::Get()->GetSystemLibrary()->AddObserver(this); | 32 CrosLibrary::Get()->GetSystemLibrary()->AddObserver(this); |
33 | 33 |
34 set_border(NULL); | 34 set_border(NULL); |
35 set_use_menu_button_paint(true); | 35 set_use_menu_button_paint(true); |
36 SetFont(ResourceBundle::GetSharedInstance().GetFont( | 36 SetFont(ResourceBundle::GetSharedInstance().GetFont( |
37 ResourceBundle::BaseFont).DeriveFont(1, gfx::Font::BOLD)); | 37 ResourceBundle::BaseFont).DeriveFont(1)); |
38 SetEnabledColor(0xB3FFFFFF); // White with 70% Alpha | 38 SetEnabledColor(0xB3FFFFFF); // White with 70% Alpha |
39 SetShowMultipleIconStates(false); | 39 SetShowMultipleIconStates(false); |
40 set_alignment(TextButton::ALIGN_CENTER); | 40 set_alignment(TextButton::ALIGN_CENTER); |
41 UpdateTextAndSetNextTimer(); | 41 UpdateTextAndSetNextTimer(); |
42 } | 42 } |
43 | 43 |
44 ClockMenuButton::~ClockMenuButton() { | 44 ClockMenuButton::~ClockMenuButton() { |
45 CrosLibrary::Get()->GetSystemLibrary()->RemoveObserver(this); | 45 CrosLibrary::Get()->GetSystemLibrary()->RemoveObserver(this); |
46 } | 46 } |
47 | 47 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 void ClockMenuButton::RunMenu(views::View* source, const gfx::Point& pt) { | 120 void ClockMenuButton::RunMenu(views::View* source, const gfx::Point& pt) { |
121 if (!clock_menu_.get()) | 121 if (!clock_menu_.get()) |
122 clock_menu_.reset(new views::Menu2(this)); | 122 clock_menu_.reset(new views::Menu2(this)); |
123 else | 123 else |
124 clock_menu_->Rebuild(); | 124 clock_menu_->Rebuild(); |
125 clock_menu_->UpdateStates(); | 125 clock_menu_->UpdateStates(); |
126 clock_menu_->RunMenuAt(pt, views::Menu2::ALIGN_TOPRIGHT); | 126 clock_menu_->RunMenuAt(pt, views::Menu2::ALIGN_TOPRIGHT); |
127 } | 127 } |
128 | 128 |
129 } // namespace chromeos | 129 } // namespace chromeos |
OLD | NEW |