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

Side by Side Diff: chrome/browser/chromeos/ui/idle_app_name_notification_view.cc

Issue 854053002: Update {virtual,override,final} to follow C++11 style in chrome/browser/chromeos/ui. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
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 "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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 125
126 // Set a timer which will trigger to remove the message after the given 126 // Set a timer which will trigger to remove the message after the given
127 // time. 127 // time.
128 hide_timer_.Start( 128 hide_timer_.Start(
129 FROM_HERE, 129 FROM_HERE,
130 base::TimeDelta::FromMilliseconds(message_visibility_time_in_ms), 130 base::TimeDelta::FromMilliseconds(message_visibility_time_in_ms),
131 this, 131 this,
132 &IdleAppNameNotificationDelegateView::RemoveMessage); 132 &IdleAppNameNotificationDelegateView::RemoveMessage);
133 } 133 }
134 134
135 virtual ~IdleAppNameNotificationDelegateView() { 135 ~IdleAppNameNotificationDelegateView() override {
136 // The widget is already closing, but the other cleanup items need to be 136 // The widget is already closing, but the other cleanup items need to be
137 // performed. 137 // performed.
138 widget_closed_ = true; 138 widget_closed_ = true;
139 Close(); 139 Close();
140 } 140 }
141 141
142 // Close the widget immediately. This can be called from the owner or from 142 // Close the widget immediately. This can be called from the owner or from
143 // this class. 143 // this class.
144 void Close() { 144 void Close() {
145 // Stop the timer (if it was running). 145 // Stop the timer (if it was running).
(...skipping 15 matching lines...) Expand all
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 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 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 void OnImplicitAnimationsCompleted() override { Close(); }
186 Close();
187 }
188 186
189 private: 187 private:
190 // Adds the label to the view, using |text| with a |font| and a |text_color|. 188 // Adds the label to the view, using |text| with a |font| and a |text_color|.
191 void AddLabel(const base::string16& text, 189 void AddLabel(const base::string16& text,
192 const gfx::FontList& font, 190 const gfx::FontList& font,
193 SkColor text_color) { 191 SkColor text_color) {
194 views::Label* label = new views::Label; 192 views::Label* label = new views::Label;
195 label->SetText(text); 193 label->SetText(text);
196 label->SetHorizontalAlignment(gfx::ALIGN_CENTER); 194 label->SetHorizontalAlignment(gfx::ALIGN_CENTER);
197 label->SetFontList(font); 195 label->SetFontList(font);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 265
268 view_ = new IdleAppNameNotificationDelegateView( 266 view_ = new IdleAppNameNotificationDelegateView(
269 this, 267 this,
270 app_name, 268 app_name,
271 error, 269 error,
272 message_visibility_time_in_ms + animation_time_ms); 270 message_visibility_time_in_ms + animation_time_ms);
273 CreateAndShowWidgetWithContent(view_, view_, animation_time_ms); 271 CreateAndShowWidgetWithContent(view_, view_, animation_time_ms);
274 } 272 }
275 273
276 } // namespace chromeos 274 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/ui/focus_ring_layer.h ('k') | chrome/browser/chromeos/ui/idle_app_name_notification_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698