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 "chrome/browser/chromeos/ui/idle_app_name_notification_view.h" | 5 #include "chrome/browser/chromeos/ui/idle_app_name_notification_view.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/shell_delegate.h" | 10 #include "ash/shell_delegate.h" |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 void RemoveMessage() { | 161 void RemoveMessage() { |
162 aura::Window* widget_view = GetWidget()->GetNativeView(); | 162 aura::Window* widget_view = GetWidget()->GetNativeView(); |
163 ui::Layer* layer = widget_view->layer(); | 163 ui::Layer* layer = widget_view->layer(); |
164 ui::ScopedLayerAnimationSettings settings(layer->GetAnimator()); | 164 ui::ScopedLayerAnimationSettings settings(layer->GetAnimator()); |
165 settings.AddObserver(this); | 165 settings.AddObserver(this); |
166 gfx::Rect rect = widget_view->bounds(); | 166 gfx::Rect rect = widget_view->bounds(); |
167 rect.set_y(-GetPreferredSize().height()); | 167 rect.set_y(-GetPreferredSize().height()); |
168 layer->SetBounds(rect); | 168 layer->SetBounds(rect); |
169 } | 169 } |
170 | 170 |
171 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { | 171 virtual void OnPaint(gfx::Canvas* canvas) override { |
172 SkPaint paint; | 172 SkPaint paint; |
173 paint.setStyle(SkPaint::kFill_Style); | 173 paint.setStyle(SkPaint::kFill_Style); |
174 paint.setColor(kWindowBackgroundColor); | 174 paint.setColor(kWindowBackgroundColor); |
175 canvas->DrawRoundRect(GetLocalBounds(), kWindowCornerRadius, paint); | 175 canvas->DrawRoundRect(GetLocalBounds(), kWindowCornerRadius, paint); |
176 views::WidgetDelegateView::OnPaint(canvas); | 176 views::WidgetDelegateView::OnPaint(canvas); |
177 } | 177 } |
178 | 178 |
179 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE { | 179 virtual void GetAccessibleState(ui::AXViewState* state) override { |
180 state->name = spoken_text_; | 180 state->name = spoken_text_; |
181 state->role = ui::AX_ROLE_ALERT; | 181 state->role = ui::AX_ROLE_ALERT; |
182 } | 182 } |
183 | 183 |
184 // ImplicitAnimationObserver overrides | 184 // ImplicitAnimationObserver overrides |
185 virtual void OnImplicitAnimationsCompleted() OVERRIDE { | 185 virtual void OnImplicitAnimationsCompleted() override { |
186 Close(); | 186 Close(); |
187 } | 187 } |
188 | 188 |
189 private: | 189 private: |
190 // Adds the label to the view, using |text| with a |font| and a |text_color|. | 190 // Adds the label to the view, using |text| with a |font| and a |text_color|. |
191 void AddLabel(const base::string16& text, | 191 void AddLabel(const base::string16& text, |
192 const gfx::FontList& font, | 192 const gfx::FontList& font, |
193 SkColor text_color) { | 193 SkColor text_color) { |
194 views::Label* label = new views::Label; | 194 views::Label* label = new views::Label; |
195 label->SetText(text); | 195 label->SetText(text); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 | 267 |
268 view_ = new IdleAppNameNotificationDelegateView( | 268 view_ = new IdleAppNameNotificationDelegateView( |
269 this, | 269 this, |
270 app_name, | 270 app_name, |
271 error, | 271 error, |
272 message_visibility_time_in_ms + animation_time_ms); | 272 message_visibility_time_in_ms + animation_time_ms); |
273 CreateAndShowWidgetWithContent(view_, view_, animation_time_ms); | 273 CreateAndShowWidgetWithContent(view_, view_, animation_time_ms); |
274 } | 274 } |
275 | 275 |
276 } // namespace chromeos | 276 } // namespace chromeos |
OLD | NEW |