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

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

Issue 2251263003: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 3 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
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_md.h" 5 #include "chrome/browser/ui/views/download/download_item_view_md.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <vector> 10 #include <vector>
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 486
487 void DownloadItemViewMd::AddInkDropLayer(ui::Layer* ink_drop_layer) { 487 void DownloadItemViewMd::AddInkDropLayer(ui::Layer* ink_drop_layer) {
488 InkDropHostView::AddInkDropLayer(ink_drop_layer); 488 InkDropHostView::AddInkDropLayer(ink_drop_layer);
489 // The layer that's added to host the ink drop layer must mask to bounds 489 // The layer that's added to host the ink drop layer must mask to bounds
490 // so the hover effect is clipped while animating open. 490 // so the hover effect is clipped while animating open.
491 layer()->SetMasksToBounds(true); 491 layer()->SetMasksToBounds(true);
492 } 492 }
493 493
494 std::unique_ptr<views::InkDropRipple> DownloadItemViewMd::CreateInkDropRipple() 494 std::unique_ptr<views::InkDropRipple> DownloadItemViewMd::CreateInkDropRipple()
495 const { 495 const {
496 return base::WrapUnique(new views::FloodFillInkDropRipple( 496 return base::MakeUnique<views::FloodFillInkDropRipple>(
497 GetLocalBounds(), GetInkDropCenterBasedOnLastEvent(), 497 GetLocalBounds(), GetInkDropCenterBasedOnLastEvent(),
498 color_utils::DeriveDefaultIconColor(GetTextColor()), 498 color_utils::DeriveDefaultIconColor(GetTextColor()),
499 ink_drop_visible_opacity())); 499 ink_drop_visible_opacity());
500 } 500 }
501 501
502 std::unique_ptr<views::InkDropHighlight> 502 std::unique_ptr<views::InkDropHighlight>
503 DownloadItemViewMd::CreateInkDropHighlight() const { 503 DownloadItemViewMd::CreateInkDropHighlight() const {
504 if (IsShowingWarningDialog()) 504 if (IsShowingWarningDialog())
505 return nullptr; 505 return nullptr;
506 506
507 gfx::Size size = GetPreferredSize(); 507 gfx::Size size = GetPreferredSize();
508 return base::WrapUnique(new views::InkDropHighlight( 508 return base::MakeUnique<views::InkDropHighlight>(
509 size, kInkDropSmallCornerRadius, 509 size, kInkDropSmallCornerRadius,
510 gfx::RectF(gfx::SizeF(size)).CenterPoint(), 510 gfx::RectF(gfx::SizeF(size)).CenterPoint(),
511 color_utils::DeriveDefaultIconColor(GetTextColor()))); 511 color_utils::DeriveDefaultIconColor(GetTextColor()));
512 } 512 }
513 513
514 void DownloadItemViewMd::OnGestureEvent(ui::GestureEvent* event) { 514 void DownloadItemViewMd::OnGestureEvent(ui::GestureEvent* event) {
515 if (event->type() == ui::ET_GESTURE_TAP_DOWN) { 515 if (event->type() == ui::ET_GESTURE_TAP_DOWN) {
516 HandlePressEvent(*event, true); 516 HandlePressEvent(*event, true);
517 event->SetHandled(); 517 event->SetHandled();
518 return; 518 return;
519 } 519 }
520 520
521 if (event->type() == ui::ET_GESTURE_TAP) { 521 if (event->type() == ui::ET_GESTURE_TAP) {
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 if (last_download_item_path_ == current_download_path) 795 if (last_download_item_path_ == current_download_path)
796 return; 796 return;
797 797
798 LoadIcon(); 798 LoadIcon();
799 } 799 }
800 800
801 void DownloadItemViewMd::UpdateColorsFromTheme() { 801 void DownloadItemViewMd::UpdateColorsFromTheme() {
802 if (!GetThemeProvider()) 802 if (!GetThemeProvider())
803 return; 803 return;
804 804
805 SetBorder(base::WrapUnique(new SeparatorBorder(GetThemeProvider()->GetColor( 805 SetBorder(base::MakeUnique<SeparatorBorder>(GetThemeProvider()->GetColor(
806 ThemeProperties::COLOR_TOOLBAR_VERTICAL_SEPARATOR)))); 806 ThemeProperties::COLOR_TOOLBAR_VERTICAL_SEPARATOR)));
807 807
808 SkColor text_color = GetTextColor(); 808 SkColor text_color = GetTextColor();
809 if (dangerous_download_label_) 809 if (dangerous_download_label_)
810 dangerous_download_label_->SetEnabledColor(text_color); 810 dangerous_download_label_->SetEnabledColor(text_color);
811 if (save_button_) 811 if (save_button_)
812 save_button_->SetEnabledTextColors(text_color); 812 save_button_->SetEnabledTextColors(text_color);
813 if (discard_button_) 813 if (discard_button_)
814 discard_button_->SetEnabledTextColors(text_color); 814 discard_button_->SetEnabledTextColors(text_color);
815 } 815 }
816 816
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
1126 SchedulePaint(); 1126 SchedulePaint();
1127 } 1127 }
1128 1128
1129 SkColor DownloadItemViewMd::GetTextColor() const { 1129 SkColor DownloadItemViewMd::GetTextColor() const {
1130 return GetTextColorForThemeProvider(GetThemeProvider()); 1130 return GetTextColorForThemeProvider(GetThemeProvider());
1131 } 1131 }
1132 1132
1133 SkColor DownloadItemViewMd::GetDimmedTextColor() const { 1133 SkColor DownloadItemViewMd::GetDimmedTextColor() const {
1134 return SkColorSetA(GetTextColor(), 0xC7); 1134 return SkColorSetA(GetTextColor(), 0xC7);
1135 } 1135 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/certificate_selector_browsertest.cc ('k') | chrome/browser/ui/views/dropdown_bar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698