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

Side by Side Diff: ash/shelf/shelf_button.cc

Issue 1998933002: Update shelf spacing in Chrome OS according to the MD specs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 4 years, 6 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
« no previous file with comments | « ash/shelf/overflow_button.cc ('k') | ash/shelf/shelf_layout_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/shelf/shelf_button.h" 5 #include "ash/shelf/shelf_button.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/ash_switches.h" 9 #include "ash/ash_switches.h"
10 #include "ash/common/ash_constants.h" 10 #include "ash/common/ash_constants.h"
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 bar_id = IDR_ASH_SHELF_UNDERLINE_ACTIVE; 502 bar_id = IDR_ASH_SHELF_UNDERLINE_ACTIVE;
503 else if (state_ & STATE_ATTENTION) 503 else if (state_ & STATE_ATTENTION)
504 bar_id = IDR_ASH_SHELF_UNDERLINE_ATTENTION; 504 bar_id = IDR_ASH_SHELF_UNDERLINE_ATTENTION;
505 else if (state_ & STATE_RUNNING) 505 else if (state_ & STATE_RUNNING)
506 bar_id = IDR_ASH_SHELF_UNDERLINE_RUNNING; 506 bar_id = IDR_ASH_SHELF_UNDERLINE_RUNNING;
507 507
508 if (bar_id != 0) { 508 if (bar_id != 0) {
509 Shelf* shelf = shelf_view_->shelf(); 509 Shelf* shelf = shelf_view_->shelf();
510 gfx::ImageSkia image; 510 gfx::ImageSkia image;
511 if (ash::MaterialDesignController::IsShelfMaterial()) { 511 if (ash::MaterialDesignController::IsShelfMaterial()) {
512 gfx::Size size(kShelfButtonSize, kShelfSize); 512 gfx::Size size(GetShelfConstant(SHELF_BUTTON_SIZE),
513 GetShelfConstant(SHELF_SIZE));
513 gfx::Canvas canvas(size, kIndicatorCanvasScale, true /* is_opaque */); 514 gfx::Canvas canvas(size, kIndicatorCanvasScale, true /* is_opaque */);
514 PaintIndicatorOnCanvas(&canvas, size); 515 PaintIndicatorOnCanvas(&canvas, size);
515 image = gfx::ImageSkia(canvas.ExtractImageRep()); 516 image = gfx::ImageSkia(canvas.ExtractImageRep());
516 } else { 517 } else {
517 ResourceBundle* rb = &ResourceBundle::GetSharedInstance(); 518 ResourceBundle* rb = &ResourceBundle::GetSharedInstance();
518 image = *rb->GetImageNamed(bar_id).ToImageSkia(); 519 image = *rb->GetImageNamed(bar_id).ToImageSkia();
519 } 520 }
520 if (!shelf->IsHorizontalAlignment()) { 521 if (!shelf->IsHorizontalAlignment()) {
521 image = gfx::ImageSkiaOperations::CreateRotatedImage( 522 image = gfx::ImageSkiaOperations::CreateRotatedImage(
522 image, shelf->alignment() == SHELF_ALIGNMENT_LEFT 523 image, shelf->alignment() == SHELF_ALIGNMENT_LEFT
523 ? SkBitmapOperations::ROTATION_90_CW 524 ? SkBitmapOperations::ROTATION_90_CW
524 : SkBitmapOperations::ROTATION_270_CW); 525 : SkBitmapOperations::ROTATION_270_CW);
525 } 526 }
526 bar_->SetImage(image); 527 bar_->SetImage(image);
527 bar_->SetHorizontalAlignment(shelf->SelectValueForShelfAlignment( 528 bar_->SetHorizontalAlignment(shelf->SelectValueForShelfAlignment(
528 views::ImageView::CENTER, views::ImageView::LEADING, 529 views::ImageView::CENTER, views::ImageView::LEADING,
529 views::ImageView::TRAILING)); 530 views::ImageView::TRAILING));
530 bar_->SetVerticalAlignment(shelf->SelectValueForShelfAlignment( 531 bar_->SetVerticalAlignment(shelf->SelectValueForShelfAlignment(
531 views::ImageView::TRAILING, views::ImageView::CENTER, 532 views::ImageView::TRAILING, views::ImageView::CENTER,
532 views::ImageView::CENTER)); 533 views::ImageView::CENTER));
533 bar_->SchedulePaint(); 534 bar_->SchedulePaint();
534 } 535 }
535 bar_->SetVisible(bar_id != 0 && state_ != STATE_NORMAL); 536 bar_->SetVisible(bar_id != 0 && state_ != STATE_NORMAL);
536 } 537 }
537 538
538 } // namespace ash 539 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/overflow_button.cc ('k') | ash/shelf/shelf_layout_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698