OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/views/download_item_view.h" | 5 #include "chrome/browser/views/download_item_view.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 // to reflect our current bytes downloaded, time remaining. | 346 // to reflect our current bytes downloaded, time remaining. |
347 void DownloadItemView::OnDownloadUpdated(DownloadItem* download) { | 347 void DownloadItemView::OnDownloadUpdated(DownloadItem* download) { |
348 DCHECK(download == download_); | 348 DCHECK(download == download_); |
349 | 349 |
350 if (body_state_ == DANGEROUS && | 350 if (body_state_ == DANGEROUS && |
351 download->safety_state() == DownloadItem::DANGEROUS_BUT_VALIDATED) { | 351 download->safety_state() == DownloadItem::DANGEROUS_BUT_VALIDATED) { |
352 // We have been approved. | 352 // We have been approved. |
353 ClearDangerousMode(); | 353 ClearDangerousMode(); |
354 } | 354 } |
355 | 355 |
356 std::wstring status_text = model_->GetStatusText(); | 356 string16 status_text = model_->GetStatusText(); |
357 switch (download_->state()) { | 357 switch (download_->state()) { |
358 case DownloadItem::IN_PROGRESS: | 358 case DownloadItem::IN_PROGRESS: |
359 download_->is_paused() ? StopDownloadProgress() : StartDownloadProgress(); | 359 download_->is_paused() ? StopDownloadProgress() : StartDownloadProgress(); |
360 break; | 360 break; |
361 case DownloadItem::COMPLETE: | 361 case DownloadItem::COMPLETE: |
362 if (download_->auto_opened()) { | 362 if (download_->auto_opened()) { |
363 parent_->RemoveDownloadView(this); // This will delete us! | 363 parent_->RemoveDownloadView(this); // This will delete us! |
364 return; | 364 return; |
365 } | 365 } |
366 StopDownloadProgress(); | 366 StopDownloadProgress(); |
(...skipping 10 matching lines...) Expand all Loading... |
377 StopDownloadProgress(); | 377 StopDownloadProgress(); |
378 LoadIcon(); | 378 LoadIcon(); |
379 break; | 379 break; |
380 case DownloadItem::REMOVING: | 380 case DownloadItem::REMOVING: |
381 parent_->RemoveDownloadView(this); // This will delete us! | 381 parent_->RemoveDownloadView(this); // This will delete us! |
382 return; | 382 return; |
383 default: | 383 default: |
384 NOTREACHED(); | 384 NOTREACHED(); |
385 } | 385 } |
386 | 386 |
387 status_text_ = status_text; | 387 status_text_ = UTF16ToWideHack(status_text); |
388 UpdateAccessibleName(); | 388 UpdateAccessibleName(); |
389 | 389 |
390 // We use the parent's (DownloadShelfView's) SchedulePaint, since there | 390 // We use the parent's (DownloadShelfView's) SchedulePaint, since there |
391 // are spaces between each DownloadItemView that the parent is responsible | 391 // are spaces between each DownloadItemView that the parent is responsible |
392 // for painting. | 392 // for painting. |
393 GetParent()->SchedulePaint(); | 393 GetParent()->SchedulePaint(); |
394 } | 394 } |
395 | 395 |
396 void DownloadItemView::OnDownloadOpened(DownloadItem* download) { | 396 void DownloadItemView::OnDownloadOpened(DownloadItem* download) { |
397 disabled_while_opening_ = true; | 397 disabled_while_opening_ = true; |
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1071 | 1071 |
1072 // If the name has changed, call SetAccessibleName and notify | 1072 // If the name has changed, call SetAccessibleName and notify |
1073 // assistive technology that the name has changed so they can | 1073 // assistive technology that the name has changed so they can |
1074 // announce it immediately. | 1074 // announce it immediately. |
1075 if (new_name != current_name) { | 1075 if (new_name != current_name) { |
1076 SetAccessibleName(new_name); | 1076 SetAccessibleName(new_name); |
1077 if (GetWidget()) | 1077 if (GetWidget()) |
1078 NotifyAccessibilityEvent(AccessibilityTypes::EVENT_NAME_CHANGED); | 1078 NotifyAccessibilityEvent(AccessibilityTypes::EVENT_NAME_CHANGED); |
1079 } | 1079 } |
1080 } | 1080 } |
OLD | NEW |