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

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

Issue 13584010: views: Migrate the cases of "new .*NativeTextButton(" to LabelButton. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: back out the changes to one_click_signin_bubble_view.* Created 7 years, 8 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 20 matching lines...) Expand all
31 #include "ui/base/accessibility/accessible_view_state.h" 31 #include "ui/base/accessibility/accessible_view_state.h"
32 #include "ui/base/animation/slide_animation.h" 32 #include "ui/base/animation/slide_animation.h"
33 #include "ui/base/events/event.h" 33 #include "ui/base/events/event.h"
34 #include "ui/base/l10n/l10n_util.h" 34 #include "ui/base/l10n/l10n_util.h"
35 #include "ui/base/resource/resource_bundle.h" 35 #include "ui/base/resource/resource_bundle.h"
36 #include "ui/base/text/text_elider.h" 36 #include "ui/base/text/text_elider.h"
37 #include "ui/base/theme_provider.h" 37 #include "ui/base/theme_provider.h"
38 #include "ui/gfx/canvas.h" 38 #include "ui/gfx/canvas.h"
39 #include "ui/gfx/color_utils.h" 39 #include "ui/gfx/color_utils.h"
40 #include "ui/gfx/image/image.h" 40 #include "ui/gfx/image/image.h"
41 #include "ui/views/controls/button/text_button.h" 41 #include "ui/views/controls/button/label_button.h"
42 #include "ui/views/controls/label.h" 42 #include "ui/views/controls/label.h"
43 #include "ui/views/widget/root_view.h" 43 #include "ui/views/widget/root_view.h"
44 #include "ui/views/widget/widget.h" 44 #include "ui/views/widget/widget.h"
45 45
46 // TODO(paulg): These may need to be adjusted when download progress 46 // TODO(paulg): These may need to be adjusted when download progress
47 // animation is added, and also possibly to take into account 47 // animation is added, and also possibly to take into account
48 // different screen resolutions. 48 // different screen resolutions.
49 static const int kTextWidth = 140; // Pixels 49 static const int kTextWidth = 140; // Pixels
50 static const int kDangerousTextWidth = 200; // Pixels 50 static const int kDangerousTextWidth = 200; // Pixels
51 static const int kHorizontalTextPadding = 2; // Pixels 51 static const int kHorizontalTextPadding = 2; // Pixels
(...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after
1037 TooltipTextChanged(); 1037 TooltipTextChanged();
1038 } 1038 }
1039 1039
1040 void DownloadItemView::ShowWarningDialog() { 1040 void DownloadItemView::ShowWarningDialog() {
1041 DCHECK(mode_ != DANGEROUS_MODE && mode_ != MALICIOUS_MODE); 1041 DCHECK(mode_ != DANGEROUS_MODE && mode_ != MALICIOUS_MODE);
1042 mode_ = ((model_.IsMalicious()) ? MALICIOUS_MODE : DANGEROUS_MODE); 1042 mode_ = ((model_.IsMalicious()) ? MALICIOUS_MODE : DANGEROUS_MODE);
1043 1043
1044 body_state_ = NORMAL; 1044 body_state_ = NORMAL;
1045 drop_down_state_ = NORMAL; 1045 drop_down_state_ = NORMAL;
1046 if (mode_ == DANGEROUS_MODE) { 1046 if (mode_ == DANGEROUS_MODE) {
1047 save_button_ = new views::NativeTextButton( 1047 save_button_ = new views::LabelButton(
1048 this, model_.GetWarningConfirmButtonText()); 1048 this, model_.GetWarningConfirmButtonText());
1049 save_button_->set_ignore_minimum_size(true); 1049 save_button_->SetStyle(views::Button::STYLE_NATIVE_TEXTBUTTON);
1050 AddChildView(save_button_); 1050 AddChildView(save_button_);
1051 } 1051 }
1052 discard_button_ = new views::NativeTextButton( 1052 discard_button_ = new views::LabelButton(
1053 this, l10n_util::GetStringUTF16(IDS_DISCARD_DOWNLOAD)); 1053 this, l10n_util::GetStringUTF16(IDS_DISCARD_DOWNLOAD));
1054 discard_button_->set_ignore_minimum_size(true); 1054 discard_button_->SetStyle(views::Button::STYLE_NATIVE_TEXTBUTTON);
1055 AddChildView(discard_button_); 1055 AddChildView(discard_button_);
1056 1056
1057 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 1057 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
1058 // The dangerous download label text and icon are different under 1058 // The dangerous download label text and icon are different under
1059 // different cases. 1059 // different cases.
1060 if (mode_ == MALICIOUS_MODE) { 1060 if (mode_ == MALICIOUS_MODE) {
1061 warning_icon_ = rb.GetImageSkiaNamed(IDR_SAFEBROWSING_WARNING); 1061 warning_icon_ = rb.GetImageSkiaNamed(IDR_SAFEBROWSING_WARNING);
1062 } else { 1062 } else {
1063 // The download file has dangerous file type (e.g.: an executable). 1063 // The download file has dangerous file type (e.g.: an executable).
1064 warning_icon_ = rb.GetImageSkiaNamed(IDR_WARNING); 1064 warning_icon_ = rb.GetImageSkiaNamed(IDR_WARNING);
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/download/download_item_view.h ('k') | chrome/browser/ui/views/extensions/disabled_extensions_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698