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

Side by Side Diff: ash/system/date/date_view.cc

Issue 108063004: Give up focus if the focused view becomes unfocusable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Extracted to common code into FocusManager class Created 7 years 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ash/system/date/date_view.h" 5 #include "ash/system/date/date_view.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/system/tray/system_tray_delegate.h" 8 #include "ash/system/tray/system_tray_delegate.h"
9 #include "ash/system/tray/tray_constants.h" 9 #include "ash/system/tray/tray_constants.h"
10 #include "ash/system/tray/tray_utils.h" 10 #include "ash/system/tray/tray_utils.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 : hour_type_(ash::Shell::GetInstance()->system_tray_delegate()-> 130 : hour_type_(ash::Shell::GetInstance()->system_tray_delegate()->
131 GetHourClockType()), 131 GetHourClockType()),
132 actionable_(false) { 132 actionable_(false) {
133 SetLayoutManager( 133 SetLayoutManager(
134 new views::BoxLayout( 134 new views::BoxLayout(
135 views::BoxLayout::kVertical, 0, 0, 0)); 135 views::BoxLayout::kVertical, 0, 0, 0));
136 date_label_ = CreateLabel(); 136 date_label_ = CreateLabel();
137 date_label_->SetEnabledColor(kHeaderTextColorNormal); 137 date_label_->SetEnabledColor(kHeaderTextColorNormal);
138 UpdateTextInternal(base::Time::Now()); 138 UpdateTextInternal(base::Time::Now());
139 AddChildView(date_label_); 139 AddChildView(date_label_);
140 set_focusable(actionable_); 140 SetFocusable(actionable_);
141 } 141 }
142 142
143 DateView::~DateView() { 143 DateView::~DateView() {
144 } 144 }
145 145
146 void DateView::SetActionable(bool actionable) { 146 void DateView::SetActionable(bool actionable) {
147 actionable_ = actionable; 147 actionable_ = actionable;
148 set_focusable(actionable_); 148 SetFocusable(actionable_);
149 } 149 }
150 150
151 void DateView::UpdateTimeFormat() { 151 void DateView::UpdateTimeFormat() {
152 hour_type_ = 152 hour_type_ =
153 ash::Shell::GetInstance()->system_tray_delegate()->GetHourClockType(); 153 ash::Shell::GetInstance()->system_tray_delegate()->GetHourClockType();
154 UpdateText(); 154 UpdateText();
155 } 155 }
156 156
157 void DateView::UpdateTextInternal(const base::Time& now) { 157 void DateView::UpdateTextInternal(const base::Time& now) {
158 SetAccessibleName( 158 SetAccessibleName(
(...skipping 29 matching lines...) Expand all
188 } 188 }
189 189
190 /////////////////////////////////////////////////////////////////////////////// 190 ///////////////////////////////////////////////////////////////////////////////
191 191
192 TimeView::TimeView(TrayDate::ClockLayout clock_layout) 192 TimeView::TimeView(TrayDate::ClockLayout clock_layout)
193 : hour_type_(ash::Shell::GetInstance()->system_tray_delegate()-> 193 : hour_type_(ash::Shell::GetInstance()->system_tray_delegate()->
194 GetHourClockType()) { 194 GetHourClockType()) {
195 SetupLabels(); 195 SetupLabels();
196 UpdateTextInternal(base::Time::Now()); 196 UpdateTextInternal(base::Time::Now());
197 UpdateClockLayout(clock_layout); 197 UpdateClockLayout(clock_layout);
198 set_focusable(false); 198 SetFocusable(false);
199 } 199 }
200 200
201 TimeView::~TimeView() { 201 TimeView::~TimeView() {
202 } 202 }
203 203
204 void TimeView::UpdateTimeFormat() { 204 void TimeView::UpdateTimeFormat() {
205 hour_type_ = 205 hour_type_ =
206 ash::Shell::GetInstance()->system_tray_delegate()->GetHourClockType(); 206 ash::Shell::GetInstance()->system_tray_delegate()->GetHourClockType();
207 UpdateText(); 207 UpdateText();
208 } 208 }
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 void TimeView::SetupLabel(views::Label* label) { 299 void TimeView::SetupLabel(views::Label* label) {
300 label->set_owned_by_client(); 300 label->set_owned_by_client();
301 SetupLabelForTray(label); 301 SetupLabelForTray(label);
302 gfx::Font font = label->font(); 302 gfx::Font font = label->font();
303 label->SetFont(font.DeriveFont(0, font.GetStyle() & ~gfx::Font::BOLD)); 303 label->SetFont(font.DeriveFont(0, font.GetStyle() & ~gfx::Font::BOLD));
304 } 304 }
305 305
306 } // namespace tray 306 } // namespace tray
307 } // namespace internal 307 } // namespace internal
308 } // namespace ash 308 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698