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

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

Issue 3158014: Added tooltips to stats bar items. (Closed)
Patch Set: Fixed browser tests. Created 10 years, 3 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
OLDNEW
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 // Make sure that the timer fires on the next minute. Without this, if it is 64 // Make sure that the timer fires on the next minute. Without this, if it is
65 // called just a teeny bit early, then it will skip the next minute. 65 // called just a teeny bit early, then it will skip the next minute.
66 seconds_left += kTimerSlopSeconds; 66 seconds_left += kTimerSlopSeconds;
67 67
68 timer_.Start(base::TimeDelta::FromSeconds(seconds_left), this, 68 timer_.Start(base::TimeDelta::FromSeconds(seconds_left), this,
69 &ClockMenuButton::UpdateTextAndSetNextTimer); 69 &ClockMenuButton::UpdateTextAndSetNextTimer);
70 } 70 }
71 71
72 void ClockMenuButton::UpdateText() { 72 void ClockMenuButton::UpdateText() {
73 SetText(base::TimeFormatTimeOfDay(base::Time::Now())); 73 base::Time time(base::Time::Now());
74 SetText(base::TimeFormatTimeOfDay(time));
75 SetTooltipText(base::TimeFormatShortDate(time));
74 SchedulePaint(); 76 SchedulePaint();
75 } 77 }
76 78
77 //////////////////////////////////////////////////////////////////////////////// 79 ////////////////////////////////////////////////////////////////////////////////
78 // ClockMenuButton, menus::MenuModel implementation: 80 // ClockMenuButton, menus::MenuModel implementation:
79 81
80 int ClockMenuButton::GetItemCount() const { 82 int ClockMenuButton::GetItemCount() const {
81 // If options dialog is unavailable, don't count a separator and configure 83 // If options dialog is unavailable, don't count a separator and configure
82 // menu item. 84 // menu item.
83 return host_->ShouldOpenButtonOptions(this) ? 3 : 1; 85 return host_->ShouldOpenButtonOptions(this) ? 3 : 1;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 void ClockMenuButton::RunMenu(views::View* source, const gfx::Point& pt) { 120 void ClockMenuButton::RunMenu(views::View* source, const gfx::Point& pt) {
119 if (!clock_menu_.get()) 121 if (!clock_menu_.get())
120 clock_menu_.reset(new views::Menu2(this)); 122 clock_menu_.reset(new views::Menu2(this));
121 else 123 else
122 clock_menu_->Rebuild(); 124 clock_menu_->Rebuild();
123 clock_menu_->UpdateStates(); 125 clock_menu_->UpdateStates();
124 clock_menu_->RunMenuAt(pt, views::Menu2::ALIGN_TOPRIGHT); 126 clock_menu_->RunMenuAt(pt, views::Menu2::ALIGN_TOPRIGHT);
125 } 127 }
126 128
127 } // namespace chromeos 129 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/login_browsertest.cc ('k') | chrome/browser/chromeos/status/feedback_menu_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698