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/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/callback.h" | 11 #include "base/callback.h" |
11 #include "base/file_path.h" | 12 #include "base/file_path.h" |
12 #include "base/i18n/break_iterator.h" | 13 #include "base/i18n/break_iterator.h" |
13 #include "base/i18n/rtl.h" | 14 #include "base/i18n/rtl.h" |
14 #include "base/metrics/histogram.h" | 15 #include "base/metrics/histogram.h" |
15 #include "base/string_util.h" | 16 #include "base/string_util.h" |
16 #include "base/sys_string_conversions.h" | 17 #include "base/sys_string_conversions.h" |
17 #include "base/utf_string_conversions.h" | 18 #include "base/utf_string_conversions.h" |
18 #include "chrome/browser/browser_process.h" | 19 #include "chrome/browser/browser_process.h" |
19 #include "chrome/browser/download/chrome_download_manager_delegate.h" | 20 #include "chrome/browser/download/chrome_download_manager_delegate.h" |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 // are spaces between each DownloadItemView that the parent is responsible | 387 // are spaces between each DownloadItemView that the parent is responsible |
387 // for painting. | 388 // for painting. |
388 parent()->SchedulePaint(); | 389 parent()->SchedulePaint(); |
389 } | 390 } |
390 | 391 |
391 void DownloadItemView::OnDownloadOpened(DownloadItem* download) { | 392 void DownloadItemView::OnDownloadOpened(DownloadItem* download) { |
392 disabled_while_opening_ = true; | 393 disabled_while_opening_ = true; |
393 SetEnabled(false); | 394 SetEnabled(false); |
394 MessageLoop::current()->PostDelayedTask( | 395 MessageLoop::current()->PostDelayedTask( |
395 FROM_HERE, | 396 FROM_HERE, |
396 reenable_method_factory_.NewRunnableMethod(&DownloadItemView::Reenable), | 397 base::Bind(&DownloadItemView::Reenable, |
| 398 reenable_method_factory_.GetWeakPtr()), |
397 kDisabledOnOpenDuration); | 399 kDisabledOnOpenDuration); |
398 | 400 |
399 // Notify our parent. | 401 // Notify our parent. |
400 parent_->OpenedDownload(this); | 402 parent_->OpenedDownload(this); |
401 } | 403 } |
402 | 404 |
403 // View overrides | 405 // View overrides |
404 | 406 |
405 // In dangerous mode we have to layout our buttons. | 407 // In dangerous mode we have to layout our buttons. |
406 void DownloadItemView::Layout() { | 408 void DownloadItemView::Layout() { |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1110 // If the name has changed, notify assistive technology that the name | 1112 // If the name has changed, notify assistive technology that the name |
1111 // has changed so they can announce it immediately. | 1113 // has changed so they can announce it immediately. |
1112 if (new_name != accessible_name_) { | 1114 if (new_name != accessible_name_) { |
1113 accessible_name_ = new_name; | 1115 accessible_name_ = new_name; |
1114 if (GetWidget()) { | 1116 if (GetWidget()) { |
1115 GetWidget()->NotifyAccessibilityEvent( | 1117 GetWidget()->NotifyAccessibilityEvent( |
1116 this, ui::AccessibilityTypes::EVENT_NAME_CHANGED, true); | 1118 this, ui::AccessibilityTypes::EVENT_NAME_CHANGED, true); |
1117 } | 1119 } |
1118 } | 1120 } |
1119 } | 1121 } |
OLD | NEW |