OLD | NEW |
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 "ui/app_list/views/app_list_view.h" | 5 #include "ui/app_list/views/app_list_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 #endif | 80 #endif |
81 return true; | 81 return true; |
82 } | 82 } |
83 | 83 |
84 // The background for the App List overlay, which appears as a white rounded | 84 // The background for the App List overlay, which appears as a white rounded |
85 // rectangle with the given radius and the same size as the target view. | 85 // rectangle with the given radius and the same size as the target view. |
86 class AppListOverlayBackground : public views::Background { | 86 class AppListOverlayBackground : public views::Background { |
87 public: | 87 public: |
88 AppListOverlayBackground(int corner_radius) | 88 AppListOverlayBackground(int corner_radius) |
89 : corner_radius_(corner_radius) {}; | 89 : corner_radius_(corner_radius) {}; |
90 virtual ~AppListOverlayBackground() {}; | 90 ~AppListOverlayBackground() override{}; |
91 | 91 |
92 // Overridden from views::Background: | 92 // Overridden from views::Background: |
93 virtual void Paint(gfx::Canvas* canvas, views::View* view) const override { | 93 void Paint(gfx::Canvas* canvas, views::View* view) const override { |
94 SkPaint paint; | 94 SkPaint paint; |
95 paint.setStyle(SkPaint::kFill_Style); | 95 paint.setStyle(SkPaint::kFill_Style); |
96 paint.setColor(SK_ColorWHITE); | 96 paint.setColor(SK_ColorWHITE); |
97 canvas->DrawRoundRect(view->GetContentsBounds(), corner_radius_, paint); | 97 canvas->DrawRoundRect(view->GetContentsBounds(), corner_radius_, paint); |
98 } | 98 } |
99 | 99 |
100 private: | 100 private: |
101 const int corner_radius_; | 101 const int corner_radius_; |
102 | 102 |
103 DISALLOW_COPY_AND_ASSIGN(AppListOverlayBackground); | 103 DISALLOW_COPY_AND_ASSIGN(AppListOverlayBackground); |
104 }; | 104 }; |
105 | 105 |
106 } // namespace | 106 } // namespace |
107 | 107 |
108 // An animation observer to hide the view at the end of the animation. | 108 // An animation observer to hide the view at the end of the animation. |
109 class HideViewAnimationObserver : public ui::ImplicitAnimationObserver { | 109 class HideViewAnimationObserver : public ui::ImplicitAnimationObserver { |
110 public: | 110 public: |
111 HideViewAnimationObserver() | 111 HideViewAnimationObserver() |
112 : frame_(NULL), | 112 : frame_(NULL), |
113 target_(NULL) { | 113 target_(NULL) { |
114 } | 114 } |
115 | 115 |
116 virtual ~HideViewAnimationObserver() { | 116 ~HideViewAnimationObserver() override { |
117 if (target_) | 117 if (target_) |
118 StopObservingImplicitAnimations(); | 118 StopObservingImplicitAnimations(); |
119 } | 119 } |
120 | 120 |
121 void SetTarget(views::View* target) { | 121 void SetTarget(views::View* target) { |
122 if (target_) | 122 if (target_) |
123 StopObservingImplicitAnimations(); | 123 StopObservingImplicitAnimations(); |
124 target_ = target; | 124 target_ = target; |
125 } | 125 } |
126 | 126 |
127 void set_frame(views::BubbleFrameView* frame) { frame_ = frame; } | 127 void set_frame(views::BubbleFrameView* frame) { frame_ = frame; } |
128 | 128 |
129 private: | 129 private: |
130 // Overridden from ui::ImplicitAnimationObserver: | 130 // Overridden from ui::ImplicitAnimationObserver: |
131 virtual void OnImplicitAnimationsCompleted() override { | 131 void OnImplicitAnimationsCompleted() override { |
132 if (target_) { | 132 if (target_) { |
133 target_->SetVisible(false); | 133 target_->SetVisible(false); |
134 target_ = NULL; | 134 target_ = NULL; |
135 | 135 |
136 // Should update the background by invoking SchedulePaint(). | 136 // Should update the background by invoking SchedulePaint(). |
137 if (frame_) | 137 if (frame_) |
138 frame_->SchedulePaint(); | 138 frame_->SchedulePaint(); |
139 } | 139 } |
140 } | 140 } |
141 | 141 |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 speech_view_->layer()->SetTransform(speech_transform); | 606 speech_view_->layer()->SetTransform(speech_transform); |
607 } | 607 } |
608 | 608 |
609 if (will_appear) | 609 if (will_appear) |
610 speech_view_->SetVisible(true); | 610 speech_view_->SetVisible(true); |
611 else | 611 else |
612 app_list_main_view_->SetVisible(true); | 612 app_list_main_view_->SetVisible(true); |
613 } | 613 } |
614 | 614 |
615 } // namespace app_list | 615 } // namespace app_list |
OLD | NEW |