| OLD | NEW |
| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 virtual 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 virtual void OnDelegatedFrameDamage( |
| 86 const gfx::Rect& damage_rect_in_dip) OVERRIDE {} | 86 const gfx::Rect& damage_rect_in_dip) override {} |
| 87 | 87 |
| 88 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE {} | 88 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) override {} |
| 89 virtual base::Closure PrepareForLayerBoundsChange() OVERRIDE { | 89 virtual base::Closure PrepareForLayerBoundsChange() override { |
| 90 return base::Closure(); | 90 return base::Closure(); |
| 91 } | 91 } |
| 92 | 92 |
| 93 int resource_id_; | 93 int resource_id_; |
| 94 base::string16 label_; | 94 base::string16 label_; |
| 95 scoped_ptr<ui::Layer> layer_; | 95 scoped_ptr<ui::Layer> layer_; |
| 96 | 96 |
| 97 DISALLOW_COPY_AND_ASSIGN(ActionButton); | 97 DISALLOW_COPY_AND_ASSIGN(ActionButton); |
| 98 }; | 98 }; |
| 99 | 99 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 button->layer()->GetAnimator()); | 211 button->layer()->GetAnimator()); |
| 212 split_settings.SetTweenType(gfx::Tween::SMOOTH_IN_OUT); | 212 split_settings.SetTweenType(gfx::Tween::SMOOTH_IN_OUT); |
| 213 button->layer()->SetTransform(ComputeTransformFor(button)); | 213 button->layer()->SetTransform(ComputeTransformFor(button)); |
| 214 bool button_is_enabled = | 214 bool button_is_enabled = |
| 215 (button == close_.get() && IsActionEnabled(ACTION_TYPE_CLOSE)) || | 215 (button == close_.get() && IsActionEnabled(ACTION_TYPE_CLOSE)) || |
| 216 (button == split_.get() && IsActionEnabled(ACTION_TYPE_SPLIT)); | 216 (button == split_.get() && IsActionEnabled(ACTION_TYPE_SPLIT)); |
| 217 button->layer()->SetOpacity((button_is_enabled && shown_) ? 1 : 0); | 217 button->layer()->SetOpacity((button_is_enabled && shown_) ? 1 : 0); |
| 218 } | 218 } |
| 219 | 219 |
| 220 } // namespace athena | 220 } // namespace athena |
| OLD | NEW |