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

Side by Side Diff: athena/wm/overview_toolbar.cc

Issue 641683003: C++11 override style change for athena (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: rebase Created 6 years, 2 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 | « athena/wm/bezel_controller.h ('k') | athena/wm/split_view_controller.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "athena/wm/overview_toolbar.h" 5 #include "athena/wm/overview_toolbar.h"
6 6
7 #include "athena/resources/grit/athena_resources.h" 7 #include "athena/resources/grit/athena_resources.h"
8 #include "athena/strings/grit/athena_strings.h" 8 #include "athena/strings/grit/athena_strings.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 21 matching lines...) Expand all
32 public: 32 public:
33 ActionButton(int resource_id, const base::string16& label) 33 ActionButton(int resource_id, const base::string16& label)
34 : resource_id_(resource_id), label_(label) { 34 : resource_id_(resource_id), label_(label) {
35 layer_.reset(new ui::Layer(ui::LAYER_TEXTURED)); 35 layer_.reset(new ui::Layer(ui::LAYER_TEXTURED));
36 layer_->set_delegate(this); 36 layer_->set_delegate(this);
37 layer_->SetFillsBoundsOpaquely(false); 37 layer_->SetFillsBoundsOpaquely(false);
38 layer_->SetVisible(true); 38 layer_->SetVisible(true);
39 layer_->SetOpacity(0); 39 layer_->SetOpacity(0);
40 } 40 }
41 41
42 virtual ~ActionButton() {} 42 ~ActionButton() override {}
43 43
44 static void DestroyAfterFadeout(scoped_ptr<ActionButton> button) { 44 static void DestroyAfterFadeout(scoped_ptr<ActionButton> button) {
45 ui::Layer* layer = button->layer(); 45 ui::Layer* layer = button->layer();
46 ui::ScopedLayerAnimationSettings settings(layer->GetAnimator()); 46 ui::ScopedLayerAnimationSettings settings(layer->GetAnimator());
47 settings.AddObserver(new ui::ClosureAnimationObserver( 47 settings.AddObserver(new ui::ClosureAnimationObserver(
48 base::Bind(&ActionButton::DestroyImmediately, base::Passed(&button)))); 48 base::Bind(&ActionButton::DestroyImmediately, base::Passed(&button))));
49 layer->SetOpacity(0); 49 layer->SetOpacity(0);
50 } 50 }
51 51
52 void SetPosition(const gfx::Point& position) { 52 void SetPosition(const gfx::Point& position) {
53 layer_->SetBounds( 53 layer_->SetBounds(
54 gfx::Rect(position, 54 gfx::Rect(position,
55 gfx::Size(kActionButtonImageSize, 55 gfx::Size(kActionButtonImageSize,
56 kActionButtonImageSize + kActionButtonTextSize))); 56 kActionButtonImageSize + kActionButtonTextSize)));
57 } 57 }
58 58
59 ui::Layer* layer() { return layer_.get(); } 59 ui::Layer* layer() { return layer_.get(); }
60 60
61 private: 61 private:
62 static void DestroyImmediately(scoped_ptr<ActionButton> button) { 62 static void DestroyImmediately(scoped_ptr<ActionButton> button) {
63 button.reset(); 63 button.reset();
64 } 64 }
65 65
66 // ui::LayerDelegate: 66 // ui::LayerDelegate:
67 virtual void OnPaintLayer(gfx::Canvas* canvas) override { 67 void OnPaintLayer(gfx::Canvas* canvas) override {
68 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); 68 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
69 canvas->DrawImageInt(*bundle.GetImageSkiaNamed(resource_id_), 0, 0); 69 canvas->DrawImageInt(*bundle.GetImageSkiaNamed(resource_id_), 0, 0);
70 gfx::ShadowValues shadow; 70 gfx::ShadowValues shadow;
71 shadow.push_back(gfx::ShadowValue(gfx::Point(0, 1), 2, SK_ColorBLACK)); 71 shadow.push_back(gfx::ShadowValue(gfx::Point(0, 1), 2, SK_ColorBLACK));
72 shadow.push_back(gfx::ShadowValue(gfx::Point(0, -1), 2, SK_ColorBLACK)); 72 shadow.push_back(gfx::ShadowValue(gfx::Point(0, -1), 2, SK_ColorBLACK));
73 canvas->DrawStringRectWithShadows(label_, 73 canvas->DrawStringRectWithShadows(label_,
74 gfx::FontList(), 74 gfx::FontList(),
75 SK_ColorWHITE, 75 SK_ColorWHITE,
76 gfx::Rect(0, 76 gfx::Rect(0,
77 kActionButtonImageSize, 77 kActionButtonImageSize,
78 kActionButtonImageSize, 78 kActionButtonImageSize,
79 kActionButtonTextSize), 79 kActionButtonTextSize),
80 0, 80 0,
81 gfx::Canvas::TEXT_ALIGN_CENTER, 81 gfx::Canvas::TEXT_ALIGN_CENTER,
82 shadow); 82 shadow);
83 } 83 }
84 84
85 virtual void OnDelegatedFrameDamage( 85 void OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) override {}
86 const gfx::Rect& damage_rect_in_dip) override {}
87 86
88 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) override {} 87 void OnDeviceScaleFactorChanged(float device_scale_factor) override {}
89 virtual base::Closure PrepareForLayerBoundsChange() override { 88 base::Closure PrepareForLayerBoundsChange() override {
90 return base::Closure(); 89 return base::Closure();
91 } 90 }
92 91
93 int resource_id_; 92 int resource_id_;
94 base::string16 label_; 93 base::string16 label_;
95 scoped_ptr<ui::Layer> layer_; 94 scoped_ptr<ui::Layer> layer_;
96 95
97 DISALLOW_COPY_AND_ASSIGN(ActionButton); 96 DISALLOW_COPY_AND_ASSIGN(ActionButton);
98 }; 97 };
99 98
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 button->layer()->GetAnimator()); 210 button->layer()->GetAnimator());
212 split_settings.SetTweenType(gfx::Tween::SMOOTH_IN_OUT); 211 split_settings.SetTweenType(gfx::Tween::SMOOTH_IN_OUT);
213 button->layer()->SetTransform(ComputeTransformFor(button)); 212 button->layer()->SetTransform(ComputeTransformFor(button));
214 bool button_is_enabled = 213 bool button_is_enabled =
215 (button == close_.get() && IsActionEnabled(ACTION_TYPE_CLOSE)) || 214 (button == close_.get() && IsActionEnabled(ACTION_TYPE_CLOSE)) ||
216 (button == split_.get() && IsActionEnabled(ACTION_TYPE_SPLIT)); 215 (button == split_.get() && IsActionEnabled(ACTION_TYPE_SPLIT));
217 button->layer()->SetOpacity((button_is_enabled && shown_) ? 1 : 0); 216 button->layer()->SetOpacity((button_is_enabled && shown_) ? 1 : 0);
218 } 217 }
219 218
220 } // namespace athena 219 } // namespace athena
OLDNEW
« no previous file with comments | « athena/wm/bezel_controller.h ('k') | athena/wm/split_view_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698