| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_item_view.h" | 5 #include "chrome/browser/ui/views/download_item_view.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 default: | 386 default: |
| 387 NOTREACHED(); | 387 NOTREACHED(); |
| 388 } | 388 } |
| 389 | 389 |
| 390 status_text_ = UTF16ToWideHack(status_text); | 390 status_text_ = UTF16ToWideHack(status_text); |
| 391 UpdateAccessibleName(); | 391 UpdateAccessibleName(); |
| 392 | 392 |
| 393 // We use the parent's (DownloadShelfView's) SchedulePaint, since there | 393 // We use the parent's (DownloadShelfView's) SchedulePaint, since there |
| 394 // are spaces between each DownloadItemView that the parent is responsible | 394 // are spaces between each DownloadItemView that the parent is responsible |
| 395 // for painting. | 395 // for painting. |
| 396 GetParent()->SchedulePaint(); | 396 parent()->SchedulePaint(); |
| 397 } | 397 } |
| 398 | 398 |
| 399 void DownloadItemView::OnDownloadOpened(DownloadItem* download) { | 399 void DownloadItemView::OnDownloadOpened(DownloadItem* download) { |
| 400 disabled_while_opening_ = true; | 400 disabled_while_opening_ = true; |
| 401 SetEnabled(false); | 401 SetEnabled(false); |
| 402 MessageLoop::current()->PostDelayedTask( | 402 MessageLoop::current()->PostDelayedTask( |
| 403 FROM_HERE, | 403 FROM_HERE, |
| 404 reenable_method_factory_.NewRunnableMethod(&DownloadItemView::Reenable), | 404 reenable_method_factory_.NewRunnableMethod(&DownloadItemView::Reenable), |
| 405 kDisabledOnOpenDuration); | 405 kDisabledOnOpenDuration); |
| 406 | 406 |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 954 // open downloads super quickly, we should be concerned about clickjacking. | 954 // open downloads super quickly, we should be concerned about clickjacking. |
| 955 UMA_HISTOGRAM_LONG_TIMES("clickjacking.open_download", | 955 UMA_HISTOGRAM_LONG_TIMES("clickjacking.open_download", |
| 956 base::Time::Now() - creation_time_); | 956 base::Time::Now() - creation_time_); |
| 957 download_->OpenDownload(); | 957 download_->OpenDownload(); |
| 958 UpdateAccessibleName(); | 958 UpdateAccessibleName(); |
| 959 } | 959 } |
| 960 | 960 |
| 961 void DownloadItemView::OnExtractIconComplete(IconManager::Handle handle, | 961 void DownloadItemView::OnExtractIconComplete(IconManager::Handle handle, |
| 962 SkBitmap* icon_bitmap) { | 962 SkBitmap* icon_bitmap) { |
| 963 if (icon_bitmap) | 963 if (icon_bitmap) |
| 964 GetParent()->SchedulePaint(); | 964 parent()->SchedulePaint(); |
| 965 } | 965 } |
| 966 | 966 |
| 967 void DownloadItemView::LoadIcon() { | 967 void DownloadItemView::LoadIcon() { |
| 968 IconManager* im = g_browser_process->icon_manager(); | 968 IconManager* im = g_browser_process->icon_manager(); |
| 969 im->LoadIcon(download_->GetUserVerifiedFilePath(), | 969 im->LoadIcon(download_->GetUserVerifiedFilePath(), |
| 970 IconLoader::SMALL, &icon_consumer_, | 970 IconLoader::SMALL, &icon_consumer_, |
| 971 NewCallback(this, &DownloadItemView::OnExtractIconComplete)); | 971 NewCallback(this, &DownloadItemView::OnExtractIconComplete)); |
| 972 } | 972 } |
| 973 | 973 |
| 974 bool DownloadItemView::GetTooltipText(const gfx::Point& p, | 974 bool DownloadItemView::GetTooltipText(const gfx::Point& p, |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1074 | 1074 |
| 1075 // If the name has changed, call SetAccessibleName and notify | 1075 // If the name has changed, call SetAccessibleName and notify |
| 1076 // assistive technology that the name has changed so they can | 1076 // assistive technology that the name has changed so they can |
| 1077 // announce it immediately. | 1077 // announce it immediately. |
| 1078 if (new_name != current_name) { | 1078 if (new_name != current_name) { |
| 1079 SetAccessibleName(new_name); | 1079 SetAccessibleName(new_name); |
| 1080 if (GetWidget()) | 1080 if (GetWidget()) |
| 1081 NotifyAccessibilityEvent(AccessibilityTypes::EVENT_NAME_CHANGED); | 1081 NotifyAccessibilityEvent(AccessibilityTypes::EVENT_NAME_CHANGED); |
| 1082 } | 1082 } |
| 1083 } | 1083 } |
| OLD | NEW |