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

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

Issue 1942843002: Fixed material design ink drop location for the MD download shelf buttons. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Added some missing includes. Created 4 years, 7 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>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
15 #include "base/i18n/break_iterator.h" 15 #include "base/i18n/break_iterator.h"
16 #include "base/i18n/rtl.h" 16 #include "base/i18n/rtl.h"
17 #include "base/location.h" 17 #include "base/location.h"
18 #include "base/macros.h" 18 #include "base/macros.h"
19 #include "base/memory/ptr_util.h" 19 #include "base/memory/ptr_util.h"
20 #include "base/memory/scoped_ptr.h"
20 #include "base/metrics/histogram.h" 21 #include "base/metrics/histogram.h"
21 #include "base/strings/string_util.h" 22 #include "base/strings/string_util.h"
22 #include "base/strings/stringprintf.h" 23 #include "base/strings/stringprintf.h"
23 #include "base/strings/sys_string_conversions.h" 24 #include "base/strings/sys_string_conversions.h"
24 #include "base/strings/utf_string_conversions.h" 25 #include "base/strings/utf_string_conversions.h"
25 #include "chrome/browser/browser_process.h" 26 #include "chrome/browser/browser_process.h"
26 #include "chrome/browser/download/chrome_download_manager_delegate.h" 27 #include "chrome/browser/download/chrome_download_manager_delegate.h"
27 #include "chrome/browser/download/download_item_model.h" 28 #include "chrome/browser/download/download_item_model.h"
28 #include "chrome/browser/download/download_stats.h" 29 #include "chrome/browser/download/download_stats.h"
29 #include "chrome/browser/download/drag_download_item.h" 30 #include "chrome/browser/download/drag_download_item.h"
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 SchedulePaint(); 467 SchedulePaint();
467 } 468 }
468 469
469 void DownloadItemViewMd::AddInkDropLayer(ui::Layer* ink_drop_layer) { 470 void DownloadItemViewMd::AddInkDropLayer(ui::Layer* ink_drop_layer) {
470 InkDropHostView::AddInkDropLayer(ink_drop_layer); 471 InkDropHostView::AddInkDropLayer(ink_drop_layer);
471 // The layer that's added to host the ink drop layer must mask to bounds 472 // The layer that's added to host the ink drop layer must mask to bounds
472 // so the hover effect is clipped while animating open. 473 // so the hover effect is clipped while animating open.
473 layer()->SetMasksToBounds(true); 474 layer()->SetMasksToBounds(true);
474 } 475 }
475 476
476 std::unique_ptr<views::InkDropAnimation> 477 scoped_ptr<views::InkDropAnimation> DownloadItemViewMd::CreateInkDropAnimation()
477 DownloadItemViewMd::CreateInkDropAnimation() const { 478 const {
478 return base::WrapUnique(new views::FloodFillInkDropAnimation( 479 return make_scoped_ptr(new views::FloodFillInkDropAnimation(
479 size(), ink_drop_delegate_.last_ink_drop_location(), 480 GetLocalBounds(), ink_drop_delegate_.last_ink_drop_location(),
480 color_utils::DeriveDefaultIconColor(GetTextColor()))); 481 color_utils::DeriveDefaultIconColor(GetTextColor())));
481 } 482 }
482 483
483 std::unique_ptr<views::InkDropHover> DownloadItemViewMd::CreateInkDropHover() 484 scoped_ptr<views::InkDropHover> DownloadItemViewMd::CreateInkDropHover() const {
484 const {
485 if (IsShowingWarningDialog()) 485 if (IsShowingWarningDialog())
486 return nullptr; 486 return nullptr;
487 487
488 gfx::Size size = GetPreferredSize(); 488 gfx::Size size = GetPreferredSize();
489 return base::WrapUnique(new views::InkDropHover( 489 return make_scoped_ptr(new views::InkDropHover(
490 size, kInkDropSmallCornerRadius, gfx::Rect(size).CenterPoint(), 490 size, kInkDropSmallCornerRadius, gfx::Rect(size).CenterPoint(),
491 color_utils::DeriveDefaultIconColor(GetTextColor()))); 491 color_utils::DeriveDefaultIconColor(GetTextColor())));
492 } 492 }
493 493
494 void DownloadItemViewMd::OnGestureEvent(ui::GestureEvent* event) { 494 void DownloadItemViewMd::OnGestureEvent(ui::GestureEvent* event) {
495 if (event->type() == ui::ET_GESTURE_TAP_DOWN) { 495 if (event->type() == ui::ET_GESTURE_TAP_DOWN) {
496 HandlePressEvent(*event, true); 496 HandlePressEvent(*event, true);
497 event->SetHandled(); 497 event->SetHandled();
498 return; 498 return;
499 } 499 }
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 void DownloadItemViewMd::HandlePressEvent(const ui::LocatedEvent& event, 828 void DownloadItemViewMd::HandlePressEvent(const ui::LocatedEvent& event,
829 bool active_event) { 829 bool active_event) {
830 // The event should not activate us in dangerous mode. 830 // The event should not activate us in dangerous mode.
831 if (mode_ == DANGEROUS_MODE) 831 if (mode_ == DANGEROUS_MODE)
832 return; 832 return;
833 833
834 // Stop any completion animation. 834 // Stop any completion animation.
835 if (complete_animation_.get() && complete_animation_->is_animating()) 835 if (complete_animation_.get() && complete_animation_->is_animating())
836 complete_animation_->End(); 836 complete_animation_->End();
837 837
838 // Don't show the ripple for right clicks.
839 if (!active_event)
840 return;
841
838 ink_drop_delegate_.set_last_ink_drop_location(event.location()); 842 ink_drop_delegate_.set_last_ink_drop_location(event.location());
839 ink_drop_delegate_.OnAction(views::InkDropState::ACTION_PENDING); 843 ink_drop_delegate_.OnAction(views::InkDropState::ACTION_PENDING);
840 } 844 }
841 845
842 void DownloadItemViewMd::HandleClickEvent(const ui::LocatedEvent& event, 846 void DownloadItemViewMd::HandleClickEvent(const ui::LocatedEvent& event,
843 bool active_event) { 847 bool active_event) {
844 // Mouse should not activate us in dangerous mode. 848 // Mouse should not activate us in dangerous mode.
845 if (mode_ == DANGEROUS_MODE) 849 if (mode_ == DANGEROUS_MODE)
846 return; 850 return;
847 851
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
1113 SchedulePaint(); 1117 SchedulePaint();
1114 } 1118 }
1115 1119
1116 SkColor DownloadItemViewMd::GetTextColor() const { 1120 SkColor DownloadItemViewMd::GetTextColor() const {
1117 return GetTextColorForThemeProvider(GetThemeProvider()); 1121 return GetTextColorForThemeProvider(GetThemeProvider());
1118 } 1122 }
1119 1123
1120 SkColor DownloadItemViewMd::GetDimmedTextColor() const { 1124 SkColor DownloadItemViewMd::GetDimmedTextColor() const {
1121 return SkColorSetA(GetTextColor(), 0xC7); 1125 return SkColorSetA(GetTextColor(), 0xC7);
1122 } 1126 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc ('k') | ui/views/animation/flood_fill_ink_drop_animation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698