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 "chrome/browser/ui/views/download/download_item_view_md.h" | 5 #include "chrome/browser/ui/views/download/download_item_view_md.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <vector> | 10 #include <vector> |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 DownloadShelfView* parent) | 148 DownloadShelfView* parent) |
149 : shelf_(parent), | 149 : shelf_(parent), |
150 status_text_(l10n_util::GetStringUTF16(IDS_DOWNLOAD_STATUS_STARTING)), | 150 status_text_(l10n_util::GetStringUTF16(IDS_DOWNLOAD_STATUS_STARTING)), |
151 dropdown_state_(NORMAL), | 151 dropdown_state_(NORMAL), |
152 mode_(NORMAL_MODE), | 152 mode_(NORMAL_MODE), |
153 dragging_(false), | 153 dragging_(false), |
154 starting_drag_(false), | 154 starting_drag_(false), |
155 model_(download_item), | 155 model_(download_item), |
156 save_button_(nullptr), | 156 save_button_(nullptr), |
157 discard_button_(nullptr), | 157 discard_button_(nullptr), |
158 dropdown_button_(nullptr), | 158 dropdown_button_(new BarControlButton(this)), |
159 dangerous_download_label_(nullptr), | 159 dangerous_download_label_(nullptr), |
160 dangerous_download_label_sized_(false), | 160 dangerous_download_label_sized_(false), |
161 disabled_while_opening_(false), | 161 disabled_while_opening_(false), |
162 creation_time_(base::Time::Now()), | 162 creation_time_(base::Time::Now()), |
163 time_download_warning_shown_(base::Time()), | 163 time_download_warning_shown_(base::Time()), |
164 weak_ptr_factory_(this) { | 164 weak_ptr_factory_(this) { |
165 DCHECK(download()); | 165 DCHECK(download()); |
166 DCHECK(ui::MaterialDesignController::IsModeMaterial()); | 166 DCHECK(ui::MaterialDesignController::IsModeMaterial()); |
167 download()->AddObserver(this); | 167 download()->AddObserver(this); |
168 set_context_menu_controller(this); | 168 set_context_menu_controller(this); |
169 | 169 |
| 170 AddChildView(dropdown_button_); |
| 171 |
170 LoadIcon(); | 172 LoadIcon(); |
171 | 173 |
172 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 174 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
173 font_list_ = | 175 font_list_ = |
174 rb.GetFontList(ui::ResourceBundle::BaseFont).DeriveWithSizeDelta(1); | 176 rb.GetFontList(ui::ResourceBundle::BaseFont).DeriveWithSizeDelta(1); |
175 status_font_list_ = | 177 status_font_list_ = |
176 rb.GetFontList(ui::ResourceBundle::BaseFont).DeriveWithSizeDelta(-2); | 178 rb.GetFontList(ui::ResourceBundle::BaseFont).DeriveWithSizeDelta(-2); |
177 | 179 |
178 body_hover_animation_.reset(new gfx::SlideAnimation(this)); | 180 body_hover_animation_.reset(new gfx::SlideAnimation(this)); |
179 drop_hover_animation_.reset(new gfx::SlideAnimation(this)); | 181 drop_hover_animation_.reset(new gfx::SlideAnimation(this)); |
180 | 182 |
181 SetAccessibilityFocusable(true); | 183 SetAccessibilityFocusable(true); |
182 | 184 |
183 OnDownloadUpdated(download()); | 185 OnDownloadUpdated(download()); |
184 | 186 |
185 dropdown_button_ = new BarControlButton(this); | |
186 AddChildView(dropdown_button_); | |
187 SetDropdownState(NORMAL); | 187 SetDropdownState(NORMAL); |
188 UpdateColorsFromTheme(); | 188 UpdateColorsFromTheme(); |
189 } | 189 } |
190 | 190 |
191 DownloadItemViewMd::~DownloadItemViewMd() { | 191 DownloadItemViewMd::~DownloadItemViewMd() { |
192 StopDownloadProgress(); | 192 StopDownloadProgress(); |
193 download()->RemoveObserver(this); | 193 download()->RemoveObserver(this); |
194 | 194 |
195 // ExperienceSampling: If the user took no action to remove the warning | 195 // ExperienceSampling: If the user took no action to remove the warning |
196 // before it disappeared, then the user effectively dismissed the download | 196 // before it disappeared, then the user effectively dismissed the download |
197 // without keeping it. | 197 // without keeping it. |
198 if (sampling_event_.get()) | 198 if (sampling_event_.get()) |
199 sampling_event_->CreateUserDecisionEvent(ExperienceSamplingEvent::kIgnore); | 199 sampling_event_->CreateUserDecisionEvent(ExperienceSamplingEvent::kIgnore); |
200 } | 200 } |
201 | 201 |
202 // Progress animation handlers. | 202 // Progress animation handlers. |
203 | 203 |
204 void DownloadItemViewMd::StartDownloadProgress() { | 204 void DownloadItemViewMd::StartDownloadProgress() { |
205 if (progress_timer_.IsRunning()) | 205 if (progress_timer_.IsRunning()) |
206 return; | 206 return; |
207 progress_start_time_ = base::TimeTicks::Now(); | 207 progress_start_time_ = base::TimeTicks::Now(); |
208 progress_timer_.Start( | 208 progress_timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds( |
209 FROM_HERE, | 209 DownloadShelf::kProgressRateMs), |
210 base::TimeDelta::FromMilliseconds(DownloadShelf::kProgressRateMs), | 210 base::Bind(&DownloadItemViewMd::ProgressTimerFired, |
211 base::Bind(&DownloadItemViewMd::SchedulePaint, base::Unretained(this))); | 211 base::Unretained(this))); |
212 } | 212 } |
213 | 213 |
214 void DownloadItemViewMd::StopDownloadProgress() { | 214 void DownloadItemViewMd::StopDownloadProgress() { |
215 if (!progress_timer_.IsRunning()) | 215 if (!progress_timer_.IsRunning()) |
216 return; | 216 return; |
217 previous_progress_elapsed_ += base::TimeTicks::Now() - progress_start_time_; | 217 previous_progress_elapsed_ += base::TimeTicks::Now() - progress_start_time_; |
218 progress_start_time_ = base::TimeTicks(); | 218 progress_start_time_ = base::TimeTicks(); |
219 progress_timer_.Stop(); | 219 progress_timer_.Stop(); |
220 } | 220 } |
221 | 221 |
(...skipping 14 matching lines...) Expand all Loading... |
236 // Update the progress graphic on the icon and our text status label | 236 // Update the progress graphic on the icon and our text status label |
237 // to reflect our current bytes downloaded, time remaining. | 237 // to reflect our current bytes downloaded, time remaining. |
238 void DownloadItemViewMd::OnDownloadUpdated(DownloadItem* download_item) { | 238 void DownloadItemViewMd::OnDownloadUpdated(DownloadItem* download_item) { |
239 DCHECK_EQ(download(), download_item); | 239 DCHECK_EQ(download(), download_item); |
240 | 240 |
241 if (!model_.ShouldShowInShelf()) { | 241 if (!model_.ShouldShowInShelf()) { |
242 shelf_->RemoveDownloadView(this); // This will delete us! | 242 shelf_->RemoveDownloadView(this); // This will delete us! |
243 return; | 243 return; |
244 } | 244 } |
245 | 245 |
246 if (IsShowingWarningDialog() && !model_.IsDangerous()) { | 246 if (IsShowingWarningDialog() != model_.IsDangerous()) { |
247 // We have been approved. | 247 ToggleWarningDialog(); |
248 ClearWarningDialog(); | |
249 } else if (!IsShowingWarningDialog() && model_.IsDangerous()) { | |
250 ShowWarningDialog(); | |
251 // Force the shelf to layout again as our size has changed. | |
252 shelf_->Layout(); | |
253 SchedulePaint(); | |
254 } else { | 248 } else { |
255 base::string16 status_text = model_.GetStatusText(); | |
256 switch (download()->GetState()) { | 249 switch (download()->GetState()) { |
257 case DownloadItem::IN_PROGRESS: | 250 case DownloadItem::IN_PROGRESS: |
258 download()->IsPaused() ? StopDownloadProgress() | 251 download()->IsPaused() ? StopDownloadProgress() |
259 : StartDownloadProgress(); | 252 : StartDownloadProgress(); |
260 LoadIconIfItemPathChanged(); | 253 LoadIconIfItemPathChanged(); |
261 break; | 254 break; |
262 case DownloadItem::INTERRUPTED: | 255 case DownloadItem::INTERRUPTED: |
263 StopDownloadProgress(); | 256 StopDownloadProgress(); |
264 complete_animation_.reset(new gfx::SlideAnimation(this)); | 257 complete_animation_.reset(new gfx::SlideAnimation(this)); |
265 complete_animation_->SetSlideDuration(kInterruptedAnimationDurationMs); | 258 complete_animation_->SetSlideDuration(kInterruptedAnimationDurationMs); |
266 complete_animation_->SetTweenType(gfx::Tween::LINEAR); | 259 complete_animation_->SetTweenType(gfx::Tween::LINEAR); |
267 complete_animation_->Show(); | 260 complete_animation_->Show(); |
268 SchedulePaint(); | |
269 LoadIcon(); | 261 LoadIcon(); |
270 break; | 262 break; |
271 case DownloadItem::COMPLETE: | 263 case DownloadItem::COMPLETE: |
272 if (model_.ShouldRemoveFromShelfWhenComplete()) { | 264 if (model_.ShouldRemoveFromShelfWhenComplete()) { |
273 shelf_->RemoveDownloadView(this); // This will delete us! | 265 shelf_->RemoveDownloadView(this); // This will delete us! |
274 return; | 266 return; |
275 } | 267 } |
276 StopDownloadProgress(); | 268 StopDownloadProgress(); |
277 complete_animation_.reset(new gfx::SlideAnimation(this)); | 269 complete_animation_.reset(new gfx::SlideAnimation(this)); |
278 complete_animation_->SetSlideDuration(kCompleteAnimationDurationMs); | 270 complete_animation_->SetSlideDuration(kCompleteAnimationDurationMs); |
279 complete_animation_->SetTweenType(gfx::Tween::LINEAR); | 271 complete_animation_->SetTweenType(gfx::Tween::LINEAR); |
280 complete_animation_->Show(); | 272 complete_animation_->Show(); |
281 SchedulePaint(); | |
282 LoadIcon(); | 273 LoadIcon(); |
283 break; | 274 break; |
284 case DownloadItem::CANCELLED: | 275 case DownloadItem::CANCELLED: |
285 StopDownloadProgress(); | 276 StopDownloadProgress(); |
286 if (complete_animation_) | 277 if (complete_animation_) |
287 complete_animation_->Stop(); | 278 complete_animation_->Stop(); |
288 LoadIcon(); | 279 LoadIcon(); |
289 break; | 280 break; |
290 default: | 281 default: |
291 NOTREACHED(); | 282 NOTREACHED(); |
292 } | 283 } |
293 status_text_ = status_text; | 284 status_text_ = model_.GetStatusText(); |
| 285 SchedulePaint(); |
294 } | 286 } |
295 | 287 |
296 base::string16 new_tip = model_.GetTooltipText(font_list_, kTooltipMaxWidth); | 288 base::string16 new_tip = model_.GetTooltipText(font_list_, kTooltipMaxWidth); |
297 if (new_tip != tooltip_text_) { | 289 if (new_tip != tooltip_text_) { |
298 tooltip_text_ = new_tip; | 290 tooltip_text_ = new_tip; |
299 TooltipTextChanged(); | 291 TooltipTextChanged(); |
300 } | 292 } |
301 | 293 |
302 UpdateAccessibleName(); | 294 UpdateAccessibleName(); |
303 | |
304 // We use the parent's (DownloadShelfView's) SchedulePaint, since there | |
305 // are spaces between each DownloadItemViewMd that the parent is responsible | |
306 // for painting. | |
307 shelf_->SchedulePaint(); | |
308 } | 295 } |
309 | 296 |
310 void DownloadItemViewMd::OnDownloadDestroyed(DownloadItem* download) { | 297 void DownloadItemViewMd::OnDownloadDestroyed(DownloadItem* download) { |
311 shelf_->RemoveDownloadView(this); // This will delete us! | 298 shelf_->RemoveDownloadView(this); // This will delete us! |
312 } | 299 } |
313 | 300 |
314 void DownloadItemViewMd::OnDownloadOpened(DownloadItem* download) { | 301 void DownloadItemViewMd::OnDownloadOpened(DownloadItem* download) { |
315 disabled_while_opening_ = true; | 302 disabled_while_opening_ = true; |
316 SetEnabled(false); | 303 SetEnabled(false); |
317 base::MessageLoop::current()->task_runner()->PostDelayedTask( | 304 base::MessageLoop::current()->task_runner()->PostDelayedTask( |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 | 471 |
485 void DownloadItemViewMd::ShowContextMenuForView( | 472 void DownloadItemViewMd::ShowContextMenuForView( |
486 View* source, | 473 View* source, |
487 const gfx::Point& point, | 474 const gfx::Point& point, |
488 ui::MenuSourceType source_type) { | 475 ui::MenuSourceType source_type) { |
489 ShowContextMenuImpl(gfx::Rect(point, gfx::Size()), source_type); | 476 ShowContextMenuImpl(gfx::Rect(point, gfx::Size()), source_type); |
490 } | 477 } |
491 | 478 |
492 void DownloadItemViewMd::ButtonPressed(views::Button* sender, | 479 void DownloadItemViewMd::ButtonPressed(views::Button* sender, |
493 const ui::Event& event) { | 480 const ui::Event& event) { |
494 if (dropdown_button_ && sender == dropdown_button_) { | 481 if (sender == dropdown_button_) { |
495 // TODO(estade): this is copied from ToolbarActionView but should be shared | 482 // TODO(estade): this is copied from ToolbarActionView but should be shared |
496 // one way or another. | 483 // one way or another. |
497 ui::MenuSourceType type = ui::MENU_SOURCE_NONE; | 484 ui::MenuSourceType type = ui::MENU_SOURCE_NONE; |
498 if (event.IsMouseEvent()) | 485 if (event.IsMouseEvent()) |
499 type = ui::MENU_SOURCE_MOUSE; | 486 type = ui::MENU_SOURCE_MOUSE; |
500 else if (event.IsKeyEvent()) | 487 else if (event.IsKeyEvent()) |
501 type = ui::MENU_SOURCE_KEYBOARD; | 488 type = ui::MENU_SOURCE_KEYBOARD; |
502 else if (event.IsGestureEvent()) | 489 else if (event.IsGestureEvent()) |
503 type = ui::MENU_SOURCE_TOUCH; | 490 type = ui::MENU_SOURCE_TOUCH; |
504 SetDropdownState(PUSHED); | 491 SetDropdownState(PUSHED); |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 | 812 |
826 dropdown_button_->SetIcon( | 813 dropdown_button_->SetIcon( |
827 new_state == PUSHED ? gfx::VectorIconId::FIND_NEXT | 814 new_state == PUSHED ? gfx::VectorIconId::FIND_NEXT |
828 : gfx::VectorIconId::FIND_PREV, | 815 : gfx::VectorIconId::FIND_PREV, |
829 base::Bind(&DownloadItemViewMd::GetTextColor, base::Unretained(this))); | 816 base::Bind(&DownloadItemViewMd::GetTextColor, base::Unretained(this))); |
830 dropdown_button_->OnThemeChanged(); | 817 dropdown_button_->OnThemeChanged(); |
831 dropdown_state_ = new_state; | 818 dropdown_state_ = new_state; |
832 SchedulePaint(); | 819 SchedulePaint(); |
833 } | 820 } |
834 | 821 |
| 822 void DownloadItemViewMd::ToggleWarningDialog() { |
| 823 if (model_.IsDangerous()) |
| 824 ShowWarningDialog(); |
| 825 else |
| 826 ClearWarningDialog(); |
| 827 |
| 828 // We need to load the icon now that the download has the real path. |
| 829 LoadIcon(); |
| 830 |
| 831 // Force the shelf to layout again as our size has changed. |
| 832 shelf_->Layout(); |
| 833 shelf_->SchedulePaint(); |
| 834 } |
| 835 |
835 void DownloadItemViewMd::ClearWarningDialog() { | 836 void DownloadItemViewMd::ClearWarningDialog() { |
836 DCHECK(download()->GetDangerType() == | 837 DCHECK(download()->GetDangerType() == |
837 content::DOWNLOAD_DANGER_TYPE_USER_VALIDATED); | 838 content::DOWNLOAD_DANGER_TYPE_USER_VALIDATED); |
838 DCHECK(mode_ == DANGEROUS_MODE || mode_ == MALICIOUS_MODE); | 839 DCHECK(mode_ == DANGEROUS_MODE || mode_ == MALICIOUS_MODE); |
839 | 840 |
840 mode_ = NORMAL_MODE; | 841 mode_ = NORMAL_MODE; |
841 dropdown_state_ = NORMAL; | 842 dropdown_state_ = NORMAL; |
842 | 843 |
843 // ExperienceSampling: User proceeded through the warning. | 844 // ExperienceSampling: User proceeded through the warning. |
844 if (sampling_event_.get()) { | 845 if (sampling_event_.get()) { |
845 sampling_event_->CreateUserDecisionEvent(ExperienceSamplingEvent::kProceed); | 846 sampling_event_->CreateUserDecisionEvent(ExperienceSamplingEvent::kProceed); |
846 sampling_event_.reset(NULL); | 847 sampling_event_.reset(NULL); |
847 } | 848 } |
848 // Remove the views used by the warning dialog. | 849 // Remove the views used by the warning dialog. |
849 if (save_button_) { | 850 if (save_button_) { |
850 RemoveChildView(save_button_); | 851 RemoveChildView(save_button_); |
851 delete save_button_; | 852 delete save_button_; |
852 save_button_ = NULL; | 853 save_button_ = NULL; |
853 } | 854 } |
854 RemoveChildView(discard_button_); | 855 RemoveChildView(discard_button_); |
855 delete discard_button_; | 856 delete discard_button_; |
856 discard_button_ = NULL; | 857 discard_button_ = NULL; |
857 RemoveChildView(dangerous_download_label_); | 858 RemoveChildView(dangerous_download_label_); |
858 delete dangerous_download_label_; | 859 delete dangerous_download_label_; |
859 dangerous_download_label_ = NULL; | 860 dangerous_download_label_ = NULL; |
860 dangerous_download_label_sized_ = false; | 861 dangerous_download_label_sized_ = false; |
861 cached_button_size_.SetSize(0, 0); | 862 cached_button_size_.SetSize(0, 0); |
862 | 863 |
863 // Set the accessible name back to the status and filename instead of the | |
864 // download warning. | |
865 UpdateAccessibleName(); | |
866 | |
867 // We need to load the icon now that the download has the real path. | 864 // We need to load the icon now that the download has the real path. |
868 LoadIcon(); | 865 LoadIcon(); |
869 | 866 |
870 // Force the shelf to layout again as our size has changed. | 867 dropdown_button_->SetVisible(true); |
871 shelf_->Layout(); | |
872 shelf_->SchedulePaint(); | |
873 | |
874 TooltipTextChanged(); | |
875 } | 868 } |
876 | 869 |
877 void DownloadItemViewMd::ShowWarningDialog() { | 870 void DownloadItemViewMd::ShowWarningDialog() { |
878 DCHECK(mode_ != DANGEROUS_MODE && mode_ != MALICIOUS_MODE); | 871 DCHECK(mode_ != DANGEROUS_MODE && mode_ != MALICIOUS_MODE); |
879 time_download_warning_shown_ = base::Time::Now(); | 872 time_download_warning_shown_ = base::Time::Now(); |
880 content::DownloadDangerType danger_type = download()->GetDangerType(); | 873 content::DownloadDangerType danger_type = download()->GetDangerType(); |
881 RecordDangerousDownloadWarningShown(danger_type); | 874 RecordDangerousDownloadWarningShown(danger_type); |
882 #if defined(FULL_SAFE_BROWSING) | 875 #if defined(FULL_SAFE_BROWSING) |
883 if (model_.ShouldAllowDownloadFeedback()) { | 876 if (model_.ShouldAllowDownloadFeedback()) { |
884 safe_browsing::DownloadFeedbackService::RecordEligibleDownloadShown( | 877 safe_browsing::DownloadFeedbackService::RecordEligibleDownloadShown( |
(...skipping 26 matching lines...) Expand all Loading... |
911 AddChildView(discard_button_); | 904 AddChildView(discard_button_); |
912 | 905 |
913 base::string16 dangerous_label = | 906 base::string16 dangerous_label = |
914 model_.GetWarningText(font_list_, kTextWidth); | 907 model_.GetWarningText(font_list_, kTextWidth); |
915 dangerous_download_label_ = new views::Label(dangerous_label); | 908 dangerous_download_label_ = new views::Label(dangerous_label); |
916 dangerous_download_label_->SetMultiLine(true); | 909 dangerous_download_label_->SetMultiLine(true); |
917 dangerous_download_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 910 dangerous_download_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
918 dangerous_download_label_->SetAutoColorReadabilityEnabled(false); | 911 dangerous_download_label_->SetAutoColorReadabilityEnabled(false); |
919 AddChildView(dangerous_download_label_); | 912 AddChildView(dangerous_download_label_); |
920 SizeLabelToMinWidth(); | 913 SizeLabelToMinWidth(); |
921 TooltipTextChanged(); | 914 |
| 915 dropdown_button_->SetVisible(false); |
922 } | 916 } |
923 | 917 |
924 gfx::ImageSkia DownloadItemViewMd::GetWarningIcon() { | 918 gfx::ImageSkia DownloadItemViewMd::GetWarningIcon() { |
925 switch (download()->GetDangerType()) { | 919 switch (download()->GetDangerType()) { |
926 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_URL: | 920 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_URL: |
927 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT: | 921 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT: |
928 case content::DOWNLOAD_DANGER_TYPE_UNCOMMON_CONTENT: | 922 case content::DOWNLOAD_DANGER_TYPE_UNCOMMON_CONTENT: |
929 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_HOST: | 923 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_HOST: |
930 case content::DOWNLOAD_DANGER_TYPE_POTENTIALLY_UNWANTED: | 924 case content::DOWNLOAD_DANGER_TYPE_POTENTIALLY_UNWANTED: |
931 return gfx::CreateVectorIcon(gfx::VectorIconId::REMOVE_CIRCLE, | 925 return gfx::CreateVectorIcon(gfx::VectorIconId::REMOVE_CIRCLE, |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1068 gfx::SlideAnimation* animation) { | 1062 gfx::SlideAnimation* animation) { |
1069 if (from == NORMAL && to == HOT) { | 1063 if (from == NORMAL && to == HOT) { |
1070 animation->Show(); | 1064 animation->Show(); |
1071 } else if (from == HOT && to == NORMAL) { | 1065 } else if (from == HOT && to == NORMAL) { |
1072 animation->Hide(); | 1066 animation->Hide(); |
1073 } else if (from != to) { | 1067 } else if (from != to) { |
1074 animation->Reset((to == HOT) ? 1.0 : 0.0); | 1068 animation->Reset((to == HOT) ? 1.0 : 0.0); |
1075 } | 1069 } |
1076 } | 1070 } |
1077 | 1071 |
| 1072 void DownloadItemViewMd::ProgressTimerFired() { |
| 1073 // Only repaint for the indeterminate size case. Otherwise, we'll repaint only |
| 1074 // when there's an update notified via OnDownloadUpdated(). |
| 1075 if (model_.PercentComplete() < 0) |
| 1076 SchedulePaint(); |
| 1077 } |
| 1078 |
1078 SkColor DownloadItemViewMd::GetTextColor() { | 1079 SkColor DownloadItemViewMd::GetTextColor() { |
1079 return GetTextColorForThemeProvider(GetThemeProvider()); | 1080 return GetTextColorForThemeProvider(GetThemeProvider()); |
1080 } | 1081 } |
1081 | 1082 |
1082 SkColor DownloadItemViewMd::GetDimmedTextColor() { | 1083 SkColor DownloadItemViewMd::GetDimmedTextColor() { |
1083 return SkColorSetA(GetTextColor(), 0xC7); | 1084 return SkColorSetA(GetTextColor(), 0xC7); |
1084 } | 1085 } |
OLD | NEW |