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

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

Issue 10668009: UI refinement for left/right ash tray and bubble. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 8 years, 5 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/system_tray_bubble.cc ('k') | ash/system/tray/tray_constants.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 (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_background_view.h" 5 #include "ash/system/tray/tray_background_view.h"
6 6
7 #include "ash/launcher/background_animator.h" 7 #include "ash/launcher/background_animator.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/shell_window_ids.h" 9 #include "ash/shell_window_ids.h"
10 #include "ash/system/tray/tray_constants.h" 10 #include "ash/system/tray/tray_constants.h"
(...skipping 21 matching lines...) Expand all
32 void set_alpha(int alpha) { alpha_ = alpha; } 32 void set_alpha(int alpha) { alpha_ = alpha; }
33 33
34 private: 34 private:
35 // Overridden from views::Background. 35 // Overridden from views::Background.
36 virtual void Paint(gfx::Canvas* canvas, views::View* view) const OVERRIDE { 36 virtual void Paint(gfx::Canvas* canvas, views::View* view) const OVERRIDE {
37 SkPaint paint; 37 SkPaint paint;
38 paint.setAntiAlias(true); 38 paint.setAntiAlias(true);
39 paint.setStyle(SkPaint::kFill_Style); 39 paint.setStyle(SkPaint::kFill_Style);
40 paint.setColor(SkColorSetARGB(alpha_, 0, 0, 0)); 40 paint.setColor(SkColorSetARGB(alpha_, 0, 0, 0));
41 SkPath path; 41 SkPath path;
42 gfx::Rect bounds(view->bounds()); 42 gfx::Rect bounds(view->GetLocalBounds());
43 SkScalar radius = SkIntToScalar(kTrayRoundedBorderRadius); 43 SkScalar radius = SkIntToScalar(kTrayRoundedBorderRadius);
44 path.addRoundRect(gfx::RectToSkRect(bounds), radius, radius); 44 path.addRoundRect(gfx::RectToSkRect(bounds), radius, radius);
45 canvas->DrawPath(path, paint); 45 canvas->DrawPath(path, paint);
46 } 46 }
47 47
48 int alpha_; 48 int alpha_;
49 49
50 DISALLOW_COPY_AND_ASSIGN(TrayBackground); 50 DISALLOW_COPY_AND_ASSIGN(TrayBackground);
51 }; 51 };
52 52
53 //////////////////////////////////////////////////////////////////////////////// 53 ////////////////////////////////////////////////////////////////////////////////
54 // TrayBackgroundView 54 // TrayBackgroundView
55 55
56 TrayBackgroundView::TrayBackgroundView() 56 TrayBackgroundView::TrayBackgroundView()
57 : shelf_alignment_(SHELF_ALIGNMENT_BOTTOM), 57 : shelf_alignment_(SHELF_ALIGNMENT_BOTTOM),
58 background_(NULL), 58 background_(NULL),
59 ALLOW_THIS_IN_INITIALIZER_LIST(hide_background_animator_( 59 ALLOW_THIS_IN_INITIALIZER_LIST(hide_background_animator_(
60 this, 0, kTrayBackgroundAlpha)), 60 this, 0, kTrayBackgroundAlpha)),
61 ALLOW_THIS_IN_INITIALIZER_LIST(hover_background_animator_( 61 ALLOW_THIS_IN_INITIALIZER_LIST(hover_background_animator_(
62 this, 0, kTrayBackgroundHoverAlpha - kTrayBackgroundAlpha)) { 62 this, 0, kTrayBackgroundHoverAlpha - kTrayBackgroundAlpha)) {
63 set_border(views::Border::CreateEmptyBorder(0, 0,
64 kPaddingFromBottomOfScreenBottomAlignment,
65 kPaddingFromRightEdgeOfScreenBottomAlignment));
66 set_notify_enter_exit_on_child(true); 63 set_notify_enter_exit_on_child(true);
67 64
68 // Initially we want to paint the background, but without the hover effect. 65 // Initially we want to paint the background, but without the hover effect.
69 SetPaintsBackground(true, internal::BackgroundAnimator::CHANGE_IMMEDIATE); 66 SetPaintsBackground(true, internal::BackgroundAnimator::CHANGE_IMMEDIATE);
70 hover_background_animator_.SetPaintsBackground(false, 67 hover_background_animator_.SetPaintsBackground(false,
71 internal::BackgroundAnimator::CHANGE_IMMEDIATE); 68 internal::BackgroundAnimator::CHANGE_IMMEDIATE);
72 } 69 }
73 70
74 TrayBackgroundView::~TrayBackgroundView() { 71 TrayBackgroundView::~TrayBackgroundView() {
75 } 72 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 internal::BackgroundAnimator::ChangeType change_type) { 110 internal::BackgroundAnimator::ChangeType change_type) {
114 hide_background_animator_.SetPaintsBackground(value, change_type); 111 hide_background_animator_.SetPaintsBackground(value, change_type);
115 } 112 }
116 113
117 void TrayBackgroundView::SetShelfAlignment(ShelfAlignment alignment) { 114 void TrayBackgroundView::SetShelfAlignment(ShelfAlignment alignment) {
118 shelf_alignment_ = alignment; 115 shelf_alignment_ = alignment;
119 } 116 }
120 117
121 } // namespace internal 118 } // namespace internal
122 } // namespace ash 119 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/tray/system_tray_bubble.cc ('k') | ash/system/tray/tray_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698