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" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
13 #include "base/i18n/break_iterator.h" | 13 #include "base/i18n/break_iterator.h" |
14 #include "base/i18n/rtl.h" | 14 #include "base/i18n/rtl.h" |
15 #include "base/metrics/histogram.h" | 15 #include "base/metrics/histogram.h" |
16 #include "base/string_util.h" | 16 #include "base/string_util.h" |
17 #include "base/stringprintf.h" | 17 #include "base/stringprintf.h" |
18 #include "base/sys_string_conversions.h" | 18 #include "base/sys_string_conversions.h" |
19 #include "base/utf_string_conversions.h" | 19 #include "base/utf_string_conversions.h" |
20 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
21 #include "chrome/browser/download/chrome_download_manager_delegate.h" | 21 #include "chrome/browser/download/chrome_download_manager_delegate.h" |
22 #include "chrome/browser/download/download_item_model.h" | 22 #include "chrome/browser/download/download_item_model.h" |
23 #include "chrome/browser/download/download_util.h" | 23 #include "chrome/browser/download/download_util.h" |
24 #include "chrome/browser/themes/theme_service.h" | 24 #include "chrome/browser/themes/theme_service.h" |
25 #include "chrome/browser/ui/views/download/download_shelf_context_menu_view.h" | 25 #include "chrome/browser/ui/views/download/download_shelf_context_menu_view.h" |
26 #include "chrome/browser/ui/views/download/download_shelf_view.h" | 26 #include "chrome/browser/ui/views/download/download_shelf_view.h" |
27 #include "grit/generated_resources.h" | 27 #include "grit/generated_resources.h" |
28 #include "grit/theme_resources.h" | 28 #include "grit/theme_resources.h" |
| 29 #include "third_party/icu/public/common/unicode/uchar.h" |
29 #include "ui/base/accessibility/accessible_view_state.h" | 30 #include "ui/base/accessibility/accessible_view_state.h" |
30 #include "ui/base/animation/slide_animation.h" | 31 #include "ui/base/animation/slide_animation.h" |
31 #include "ui/base/events/event.h" | 32 #include "ui/base/events/event.h" |
32 #include "ui/base/l10n/l10n_util.h" | 33 #include "ui/base/l10n/l10n_util.h" |
33 #include "ui/base/resource/resource_bundle.h" | 34 #include "ui/base/resource/resource_bundle.h" |
34 #include "ui/base/text/text_elider.h" | 35 #include "ui/base/text/text_elider.h" |
35 #include "ui/gfx/canvas.h" | 36 #include "ui/gfx/canvas.h" |
36 #include "ui/gfx/color_utils.h" | 37 #include "ui/gfx/color_utils.h" |
37 #include "ui/gfx/image/image.h" | 38 #include "ui/gfx/image/image.h" |
38 #include "ui/views/controls/button/text_button.h" | 39 #include "ui/views/controls/button/text_button.h" |
39 #include "ui/views/controls/label.h" | 40 #include "ui/views/controls/label.h" |
40 #include "ui/views/widget/root_view.h" | 41 #include "ui/views/widget/root_view.h" |
41 #include "ui/views/widget/widget.h" | 42 #include "ui/views/widget/widget.h" |
42 #include "unicode/uchar.h" | |
43 | 43 |
44 // TODO(paulg): These may need to be adjusted when download progress | 44 // TODO(paulg): These may need to be adjusted when download progress |
45 // animation is added, and also possibly to take into account | 45 // animation is added, and also possibly to take into account |
46 // different screen resolutions. | 46 // different screen resolutions. |
47 static const int kTextWidth = 140; // Pixels | 47 static const int kTextWidth = 140; // Pixels |
48 static const int kDangerousTextWidth = 200; // Pixels | 48 static const int kDangerousTextWidth = 200; // Pixels |
49 static const int kHorizontalTextPadding = 2; // Pixels | 49 static const int kHorizontalTextPadding = 2; // Pixels |
50 static const int kVerticalPadding = 3; // Pixels | 50 static const int kVerticalPadding = 3; // Pixels |
51 static const int kVerticalTextSpacer = 2; // Pixels | 51 static const int kVerticalTextSpacer = 2; // Pixels |
52 static const int kVerticalTextPadding = 2; // Pixels | 52 static const int kVerticalTextPadding = 2; // Pixels |
(...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1216 void DownloadItemView::AnimateStateTransition(State from, State to, | 1216 void DownloadItemView::AnimateStateTransition(State from, State to, |
1217 ui::SlideAnimation* animation) { | 1217 ui::SlideAnimation* animation) { |
1218 if (from == NORMAL && to == HOT) { | 1218 if (from == NORMAL && to == HOT) { |
1219 animation->Show(); | 1219 animation->Show(); |
1220 } else if (from == HOT && to == NORMAL) { | 1220 } else if (from == HOT && to == NORMAL) { |
1221 animation->Hide(); | 1221 animation->Hide(); |
1222 } else if (from != to) { | 1222 } else if (from != to) { |
1223 animation->Reset((to == HOT) ? 1.0 : 0.0); | 1223 animation->Reset((to == HOT) ? 1.0 : 0.0); |
1224 } | 1224 } |
1225 } | 1225 } |
OLD | NEW |