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

Side by Side Diff: ash/system/tray/tray_views.cc

Issue 10218002: ash: Make the buttons in the tray-popup headers accessible from keyboard. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « ash/system/tray/tray_views.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/tray/tray_views.h" 5 #include "ash/system/tray/tray_views.h"
6 6
7 #include "ash/system/tray/tray_constants.h" 7 #include "ash/system/tray/tray_constants.h"
8 #include "third_party/skia/include/core/SkBitmap.h" 8 #include "third_party/skia/include/core/SkBitmap.h"
9 #include "grit/ash_strings.h" 9 #include "grit/ash_strings.h"
10 #include "grit/ui_resources.h" 10 #include "grit/ui_resources.h"
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 : views::ToggleImageButton(listener) { 285 : views::ToggleImageButton(listener) {
286 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); 286 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
287 SetImage(views::CustomButton::BS_NORMAL, 287 SetImage(views::CustomButton::BS_NORMAL,
288 bundle.GetImageNamed(enabled_resource_id).ToSkBitmap()); 288 bundle.GetImageNamed(enabled_resource_id).ToSkBitmap());
289 SetToggledImage(views::CustomButton::BS_NORMAL, 289 SetToggledImage(views::CustomButton::BS_NORMAL,
290 bundle.GetImageNamed(disabled_resource_id).ToSkBitmap()); 290 bundle.GetImageNamed(disabled_resource_id).ToSkBitmap());
291 SetImageAlignment(views::ImageButton::ALIGN_CENTER, 291 SetImageAlignment(views::ImageButton::ALIGN_CENTER,
292 views::ImageButton::ALIGN_MIDDLE); 292 views::ImageButton::ALIGN_MIDDLE);
293 set_background(views::Background::CreateSolidBackground( 293 set_background(views::Background::CreateSolidBackground(
294 ash::kHeaderBackgroundColor)); 294 ash::kHeaderBackgroundColor));
295 set_focusable(true);
295 } 296 }
296 297
297 TrayPopupHeaderButton::~TrayPopupHeaderButton() {} 298 TrayPopupHeaderButton::~TrayPopupHeaderButton() {}
298 299
299 gfx::Size TrayPopupHeaderButton::GetPreferredSize() { 300 gfx::Size TrayPopupHeaderButton::GetPreferredSize() {
300 return gfx::Size(ash::kTrayPopupItemHeight, ash::kTrayPopupItemHeight); 301 return gfx::Size(ash::kTrayPopupItemHeight, ash::kTrayPopupItemHeight);
301 } 302 }
302 303
303 void TrayPopupHeaderButton::OnPaintBorder(gfx::Canvas* canvas) { 304 void TrayPopupHeaderButton::OnPaintBorder(gfx::Canvas* canvas) {
304 // Left border. 305 // Left border.
305 canvas->FillRect(gfx::Rect(0, 0, 1, height()), ash::kBorderDarkColor); 306 canvas->FillRect(gfx::Rect(0, 0, 1, height()), ash::kBorderDarkColor);
306 } 307 }
307 308
309 void TrayPopupHeaderButton::OnPaintFocusBorder(gfx::Canvas* canvas) {
310 if (HasFocus() && (focusable() || IsAccessibilityFocusable())) {
311 canvas->DrawRect(gfx::Rect(2, 1, width() - 4, height() - 3),
312 kFocusBorderColor);
313 }
314 }
315
308 void TrayPopupHeaderButton::StateChanged() { 316 void TrayPopupHeaderButton::StateChanged() {
309 set_background(views::Background::CreateSolidBackground( 317 set_background(views::Background::CreateSolidBackground(
310 IsHotTracked() ? ash::kHeaderHoverBackgroundColor : 318 IsHotTracked() ? ash::kHeaderHoverBackgroundColor :
311 ash::kHeaderBackgroundColor)); 319 ash::kHeaderBackgroundColor));
312 } 320 }
313 321
314 views::View* CreateDetailedHeaderEntry(int string_id, 322 views::View* CreateDetailedHeaderEntry(int string_id,
315 ViewClickListener* listener) { 323 ViewClickListener* listener) {
316 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 324 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
317 HoverHighlightView* container = new HoverHighlightView(listener); 325 HoverHighlightView* container = new HoverHighlightView(listener);
(...skipping 22 matching lines...) Expand all
340 label->SetAutoColorReadabilityEnabled(false); 348 label->SetAutoColorReadabilityEnabled(false);
341 label->SetEnabledColor(SK_ColorWHITE); 349 label->SetEnabledColor(SK_ColorWHITE);
342 label->SetBackgroundColor(SkColorSetARGB(0, 255, 255, 255)); 350 label->SetBackgroundColor(SkColorSetARGB(0, 255, 255, 255));
343 label->SetShadowColors(SkColorSetARGB(64, 0, 0, 0), 351 label->SetShadowColors(SkColorSetARGB(64, 0, 0, 0),
344 SkColorSetARGB(64, 0, 0, 0)); 352 SkColorSetARGB(64, 0, 0, 0));
345 label->SetShadowOffset(0, 1); 353 label->SetShadowOffset(0, 1);
346 } 354 }
347 355
348 } // namespace internal 356 } // namespace internal
349 } // namespace ash 357 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/tray/tray_views.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698