| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 // destroyed. The |app_name| is a string which gets used as message and | 108 // destroyed. The |app_name| is a string which gets used as message and |
| 109 // |error| is true if something is not correct. | 109 // |error| is true if something is not correct. |
| 110 // |message_visibility_time_in_ms| ms's after creation the message will start | 110 // |message_visibility_time_in_ms| ms's after creation the message will start |
| 111 // to remove itself from the screen. | 111 // to remove itself from the screen. |
| 112 IdleAppNameNotificationDelegateView(IdleAppNameNotificationView *owner, | 112 IdleAppNameNotificationDelegateView(IdleAppNameNotificationView *owner, |
| 113 const base::string16& app_name, | 113 const base::string16& app_name, |
| 114 bool error, | 114 bool error, |
| 115 int message_visibility_time_in_ms) | 115 int message_visibility_time_in_ms) |
| 116 : owner_(owner), | 116 : owner_(owner), |
| 117 widget_closed_(false) { | 117 widget_closed_(false) { |
| 118 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 118 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); |
| 119 // Add the application name label to the message. | 119 // Add the application name label to the message. |
| 120 AddLabel(app_name, | 120 AddLabel(app_name, rb->GetFontList(ui::ResourceBundle::BoldFont), |
| 121 rb.GetFontList(ui::ResourceBundle::BoldFont), | |
| 122 error ? kErrorTextColor : kTextColor); | 121 error ? kErrorTextColor : kTextColor); |
| 123 spoken_text_ = app_name; | 122 spoken_text_ = app_name; |
| 124 SetLayoutManager(new views::FillLayout); | 123 SetLayoutManager(new views::FillLayout); |
| 125 | 124 |
| 126 // Set a timer which will trigger to remove the message after the given | 125 // Set a timer which will trigger to remove the message after the given |
| 127 // time. | 126 // time. |
| 128 hide_timer_.Start( | 127 hide_timer_.Start( |
| 129 FROM_HERE, | 128 FROM_HERE, |
| 130 base::TimeDelta::FromMilliseconds(message_visibility_time_in_ms), | 129 base::TimeDelta::FromMilliseconds(message_visibility_time_in_ms), |
| 131 this, | 130 this, |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 | 264 |
| 266 view_ = new IdleAppNameNotificationDelegateView( | 265 view_ = new IdleAppNameNotificationDelegateView( |
| 267 this, | 266 this, |
| 268 app_name, | 267 app_name, |
| 269 error, | 268 error, |
| 270 message_visibility_time_in_ms + animation_time_ms); | 269 message_visibility_time_in_ms + animation_time_ms); |
| 271 CreateAndShowWidgetWithContent(view_, view_, animation_time_ms); | 270 CreateAndShowWidgetWithContent(view_, view_, animation_time_ms); |
| 272 } | 271 } |
| 273 | 272 |
| 274 } // namespace chromeos | 273 } // namespace chromeos |
| OLD | NEW |