| 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.h" | 5 #include "chrome/browser/ui/views/download/download_item_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 if (sampling_event_.get()) | 230 if (sampling_event_.get()) |
| 231 sampling_event_->CreateUserDecisionEvent(ExperienceSamplingEvent::kIgnore); | 231 sampling_event_->CreateUserDecisionEvent(ExperienceSamplingEvent::kIgnore); |
| 232 } | 232 } |
| 233 | 233 |
| 234 // Progress animation handlers. | 234 // Progress animation handlers. |
| 235 | 235 |
| 236 void DownloadItemView::StartDownloadProgress() { | 236 void DownloadItemView::StartDownloadProgress() { |
| 237 if (progress_timer_.IsRunning()) | 237 if (progress_timer_.IsRunning()) |
| 238 return; | 238 return; |
| 239 progress_start_time_ = base::TimeTicks::Now(); | 239 progress_start_time_ = base::TimeTicks::Now(); |
| 240 progress_timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds( | 240 progress_timer_.Start( |
| 241 DownloadShelf::kProgressRateMs), | 241 FROM_HERE, |
| 242 this, &DownloadItemView::SchedulePaint); | 242 base::TimeDelta::FromMilliseconds(DownloadShelf::kProgressRateMs), |
| 243 base::Bind(&DownloadItemView::SchedulePaint, base::Unretained(this))); |
| 243 } | 244 } |
| 244 | 245 |
| 245 void DownloadItemView::StopDownloadProgress() { | 246 void DownloadItemView::StopDownloadProgress() { |
| 246 if (!progress_timer_.IsRunning()) | 247 if (!progress_timer_.IsRunning()) |
| 247 return; | 248 return; |
| 248 previous_progress_elapsed_ += base::TimeTicks::Now() - progress_start_time_; | 249 previous_progress_elapsed_ += base::TimeTicks::Now() - progress_start_time_; |
| 249 progress_start_time_ = base::TimeTicks(); | 250 progress_start_time_ = base::TimeTicks(); |
| 250 progress_timer_.Stop(); | 251 progress_timer_.Stop(); |
| 251 } | 252 } |
| 252 | 253 |
| (...skipping 1125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1378 void DownloadItemView::AnimateStateTransition(State from, State to, | 1379 void DownloadItemView::AnimateStateTransition(State from, State to, |
| 1379 gfx::SlideAnimation* animation) { | 1380 gfx::SlideAnimation* animation) { |
| 1380 if (from == NORMAL && to == HOT) { | 1381 if (from == NORMAL && to == HOT) { |
| 1381 animation->Show(); | 1382 animation->Show(); |
| 1382 } else if (from == HOT && to == NORMAL) { | 1383 } else if (from == HOT && to == NORMAL) { |
| 1383 animation->Hide(); | 1384 animation->Hide(); |
| 1384 } else if (from != to) { | 1385 } else if (from != to) { |
| 1385 animation->Reset((to == HOT) ? 1.0 : 0.0); | 1386 animation->Reset((to == HOT) ? 1.0 : 0.0); |
| 1386 } | 1387 } |
| 1387 } | 1388 } |
| OLD | NEW |