| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 if (sampling_event_.get()) | 235 if (sampling_event_.get()) |
| 236 sampling_event_->CreateUserDecisionEvent(ExperienceSamplingEvent::kIgnore); | 236 sampling_event_->CreateUserDecisionEvent(ExperienceSamplingEvent::kIgnore); |
| 237 } | 237 } |
| 238 | 238 |
| 239 // Progress animation handlers. | 239 // Progress animation handlers. |
| 240 | 240 |
| 241 void DownloadItemViewMd::StartDownloadProgress() { | 241 void DownloadItemViewMd::StartDownloadProgress() { |
| 242 if (progress_timer_.IsRunning()) | 242 if (progress_timer_.IsRunning()) |
| 243 return; | 243 return; |
| 244 progress_start_time_ = base::TimeTicks::Now(); | 244 progress_start_time_ = base::TimeTicks::Now(); |
| 245 progress_timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds( | 245 progress_timer_.Start( |
| 246 DownloadShelf::kProgressRateMs), | 246 FROM_HERE, |
| 247 this, &DownloadItemViewMd::SchedulePaint); | 247 base::TimeDelta::FromMilliseconds(DownloadShelf::kProgressRateMs), |
| 248 base::Bind(&DownloadItemViewMd::SchedulePaint, base::Unretained(this))); |
| 248 } | 249 } |
| 249 | 250 |
| 250 void DownloadItemViewMd::StopDownloadProgress() { | 251 void DownloadItemViewMd::StopDownloadProgress() { |
| 251 if (!progress_timer_.IsRunning()) | 252 if (!progress_timer_.IsRunning()) |
| 252 return; | 253 return; |
| 253 previous_progress_elapsed_ += base::TimeTicks::Now() - progress_start_time_; | 254 previous_progress_elapsed_ += base::TimeTicks::Now() - progress_start_time_; |
| 254 progress_start_time_ = base::TimeTicks(); | 255 progress_start_time_ = base::TimeTicks(); |
| 255 progress_timer_.Stop(); | 256 progress_timer_.Stop(); |
| 256 } | 257 } |
| 257 | 258 |
| (...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1110 State to, | 1111 State to, |
| 1111 gfx::SlideAnimation* animation) { | 1112 gfx::SlideAnimation* animation) { |
| 1112 if (from == NORMAL && to == HOT) { | 1113 if (from == NORMAL && to == HOT) { |
| 1113 animation->Show(); | 1114 animation->Show(); |
| 1114 } else if (from == HOT && to == NORMAL) { | 1115 } else if (from == HOT && to == NORMAL) { |
| 1115 animation->Hide(); | 1116 animation->Hide(); |
| 1116 } else if (from != to) { | 1117 } else if (from != to) { |
| 1117 animation->Reset((to == HOT) ? 1.0 : 0.0); | 1118 animation->Reset((to == HOT) ? 1.0 : 0.0); |
| 1118 } | 1119 } |
| 1119 } | 1120 } |
| OLD | NEW |