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

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

Issue 273223002: views: Make view::Views::GetPreferredSize() const. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More compile fix for ToT Created 6 years, 7 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/throbber_view.h ('k') | ash/system/tray/tray_background_view.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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/system/tray/throbber_view.h" 5 #include "ash/system/tray/throbber_view.h"
6 6
7 #include "ash/system/tray/tray_constants.h" 7 #include "ash/system/tray/tray_constants.h"
8 #include "grit/ash_resources.h" 8 #include "grit/ash_resources.h"
9 #include "ui/base/resource/resource_bundle.h" 9 #include "ui/base/resource/resource_bundle.h"
10 #include "ui/compositor/layer.h" 10 #include "ui/compositor/layer.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 AddChildView(throbber_); 49 AddChildView(throbber_);
50 50
51 SetPaintToLayer(true); 51 SetPaintToLayer(true);
52 layer()->SetFillsBoundsOpaquely(false); 52 layer()->SetFillsBoundsOpaquely(false);
53 layer()->SetOpacity(0.0); 53 layer()->SetOpacity(0.0);
54 } 54 }
55 55
56 ThrobberView::~ThrobberView() { 56 ThrobberView::~ThrobberView() {
57 } 57 }
58 58
59 gfx::Size ThrobberView::GetPreferredSize() { 59 gfx::Size ThrobberView::GetPreferredSize() const {
60 return gfx::Size(ash::kTrayPopupItemHeight, ash::kTrayPopupItemHeight); 60 return gfx::Size(ash::kTrayPopupItemHeight, ash::kTrayPopupItemHeight);
61 } 61 }
62 62
63 void ThrobberView::Layout() { 63 void ThrobberView::Layout() {
64 View* child = child_at(0); 64 View* child = child_at(0);
65 gfx::Size ps = child->GetPreferredSize(); 65 gfx::Size ps = child->GetPreferredSize();
66 child->SetBounds((width() - ps.width()) / 2, 66 child->SetBounds((width() - ps.width()) / 2,
67 (height() - ps.height()) / 2, 67 (height() - ps.height()) / 2,
68 ps.width(), ps.height()); 68 ps.width(), ps.height());
69 SizeToPreferredSize(); 69 SizeToPreferredSize();
(...skipping 28 matching lines...) Expand all
98 layer()->GetAnimator()->StopAnimating(); 98 layer()->GetAnimator()->StopAnimating();
99 99
100 ui::ScopedLayerAnimationSettings animation(layer()->GetAnimator()); 100 ui::ScopedLayerAnimationSettings animation(layer()->GetAnimator());
101 animation.SetTransitionDuration( 101 animation.SetTransitionDuration(
102 base::TimeDelta::FromMilliseconds(kThrobberAnimationDurationMs)); 102 base::TimeDelta::FromMilliseconds(kThrobberAnimationDurationMs));
103 103
104 layer()->SetOpacity(start_throbber ? 1.0 : 0.0); 104 layer()->SetOpacity(start_throbber ? 1.0 : 0.0);
105 } 105 }
106 106
107 } // namespace ash 107 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/tray/throbber_view.h ('k') | ash/system/tray/tray_background_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698