Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: chrome/browser/ui/views/download/download_item_view.cc

Issue 142523003: Renames gfx::FontList::Derive* family. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
(...skipping 24 matching lines...) Expand all
35 #include "ui/base/accessibility/accessible_view_state.h" 35 #include "ui/base/accessibility/accessible_view_state.h"
36 #include "ui/base/l10n/l10n_util.h" 36 #include "ui/base/l10n/l10n_util.h"
37 #include "ui/base/resource/resource_bundle.h" 37 #include "ui/base/resource/resource_bundle.h"
38 #include "ui/base/theme_provider.h" 38 #include "ui/base/theme_provider.h"
39 #include "ui/events/event.h" 39 #include "ui/events/event.h"
40 #include "ui/gfx/animation/slide_animation.h" 40 #include "ui/gfx/animation/slide_animation.h"
41 #include "ui/gfx/canvas.h" 41 #include "ui/gfx/canvas.h"
42 #include "ui/gfx/color_utils.h" 42 #include "ui/gfx/color_utils.h"
43 #include "ui/gfx/image/image.h" 43 #include "ui/gfx/image/image.h"
44 #include "ui/gfx/text_elider.h" 44 #include "ui/gfx/text_elider.h"
45 #include "ui/gfx/text_utils.h"
45 #include "ui/views/controls/button/label_button.h" 46 #include "ui/views/controls/button/label_button.h"
46 #include "ui/views/controls/label.h" 47 #include "ui/views/controls/label.h"
47 #include "ui/views/mouse_constants.h" 48 #include "ui/views/mouse_constants.h"
48 #include "ui/views/widget/root_view.h" 49 #include "ui/views/widget/root_view.h"
49 #include "ui/views/widget/widget.h" 50 #include "ui/views/widget/widget.h"
50 51
51 // TODO(paulg): These may need to be adjusted when download progress 52 // TODO(paulg): These may need to be adjusted when download progress
52 // animation is added, and also possibly to take into account 53 // animation is added, and also possibly to take into account
53 // different screen resolutions. 54 // different screen resolutions.
54 static const int kTextWidth = 140; // Pixels 55 static const int kTextWidth = 140; // Pixels
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 if (!IsShowingWarningDialog()) { 765 if (!IsShowingWarningDialog()) {
765 base::string16 filename; 766 base::string16 filename;
766 if (!disabled_while_opening_) { 767 if (!disabled_while_opening_) {
767 filename = gfx::ElideFilename(download()->GetFileNameToReportUser(), 768 filename = gfx::ElideFilename(download()->GetFileNameToReportUser(),
768 font_list_, kTextWidth); 769 font_list_, kTextWidth);
769 } else { 770 } else {
770 // First, Calculate the download status opening string width. 771 // First, Calculate the download status opening string width.
771 base::string16 status_string = 772 base::string16 status_string =
772 l10n_util::GetStringFUTF16(IDS_DOWNLOAD_STATUS_OPENING, 773 l10n_util::GetStringFUTF16(IDS_DOWNLOAD_STATUS_OPENING,
773 base::string16()); 774 base::string16());
774 int status_string_width = font_list_.GetStringWidth(status_string); 775 int status_string_width = gfx::GetStringWidth(status_string, font_list_);
775 // Then, elide the file name. 776 // Then, elide the file name.
776 base::string16 filename_string = 777 base::string16 filename_string =
777 gfx::ElideFilename(download()->GetFileNameToReportUser(), font_list_, 778 gfx::ElideFilename(download()->GetFileNameToReportUser(), font_list_,
778 kTextWidth - status_string_width); 779 kTextWidth - status_string_width);
779 // Last, concat the whole string. 780 // Last, concat the whole string.
780 filename = l10n_util::GetStringFUTF16(IDS_DOWNLOAD_STATUS_OPENING, 781 filename = l10n_util::GetStringFUTF16(IDS_DOWNLOAD_STATUS_OPENING,
781 filename_string); 782 filename_string);
782 } 783 }
783 784
784 int mirrored_x = GetMirroredXWithWidthInView( 785 int mirrored_x = GetMirroredXWithWidthInView(
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
1318 void DownloadItemView::AnimateStateTransition(State from, State to, 1319 void DownloadItemView::AnimateStateTransition(State from, State to,
1319 gfx::SlideAnimation* animation) { 1320 gfx::SlideAnimation* animation) {
1320 if (from == NORMAL && to == HOT) { 1321 if (from == NORMAL && to == HOT) {
1321 animation->Show(); 1322 animation->Show();
1322 } else if (from == HOT && to == NORMAL) { 1323 } else if (from == HOT && to == NORMAL) {
1323 animation->Hide(); 1324 animation->Hide();
1324 } else if (from != to) { 1325 } else if (from != to) {
1325 animation->Reset((to == HOT) ? 1.0 : 0.0); 1326 animation->Reset((to == HOT) ? 1.0 : 0.0);
1326 } 1327 }
1327 } 1328 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698