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

Side by Side Diff: chrome/browser/ui/views/location_bar/bubble_icon_view.cc

Issue 1724963002: Color the ink drop ripple and hover effects based on theming. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sky review Created 4 years, 10 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/location_bar/bubble_icon_view.h" 5 #include "chrome/browser/ui/views/location_bar/bubble_icon_view.h"
6 6
7 #include "chrome/browser/command_updater.h" 7 #include "chrome/browser/command_updater.h"
8 #include "ui/accessibility/ax_view_state.h" 8 #include "ui/accessibility/ax_view_state.h"
9 #include "ui/base/material_design/material_design_controller.h" 9 #include "ui/base/material_design/material_design_controller.h"
10 #include "ui/events/event.h" 10 #include "ui/events/event.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 return true; 107 return true;
108 } 108 }
109 109
110 void BubbleIconView::ViewHierarchyChanged( 110 void BubbleIconView::ViewHierarchyChanged(
111 const ViewHierarchyChangedDetails& details) { 111 const ViewHierarchyChangedDetails& details) {
112 View::ViewHierarchyChanged(details); 112 View::ViewHierarchyChanged(details);
113 if (details.is_add && GetNativeTheme()) 113 if (details.is_add && GetNativeTheme())
114 UpdateIcon(); 114 UpdateIcon();
115 } 115 }
116 116
117 void BubbleIconView::OnNativeThemeChanged(const ui::NativeTheme* theme) {
118 UpdateIcon();
119 }
120
117 void BubbleIconView::AddInkDropLayer(ui::Layer* ink_drop_layer) { 121 void BubbleIconView::AddInkDropLayer(ui::Layer* ink_drop_layer) {
118 image_->SetPaintToLayer(true); 122 image_->SetPaintToLayer(true);
119 image_->SetFillsBoundsOpaquely(false); 123 image_->SetFillsBoundsOpaquely(false);
120 views::InkDropHostView::AddInkDropLayer(ink_drop_layer); 124 views::InkDropHostView::AddInkDropLayer(ink_drop_layer);
121 } 125 }
122 126
123 void BubbleIconView::RemoveInkDropLayer(ui::Layer* ink_drop_layer) { 127 void BubbleIconView::RemoveInkDropLayer(ui::Layer* ink_drop_layer) {
124 views::InkDropHostView::RemoveInkDropLayer(ink_drop_layer); 128 views::InkDropHostView::RemoveInkDropLayer(ink_drop_layer);
125 image_->SetFillsBoundsOpaquely(true);
126 image_->SetPaintToLayer(false); 129 image_->SetPaintToLayer(false);
127 } 130 }
128 131
129 scoped_ptr<views::InkDropHover> BubbleIconView::CreateInkDropHover() const { 132 scoped_ptr<views::InkDropHover> BubbleIconView::CreateInkDropHover() const {
130 // BubbleIconView views don't show hover effect. 133 // BubbleIconView views don't show hover effect.
131 return nullptr; 134 return nullptr;
132 } 135 }
133 136
134 void BubbleIconView::OnNativeThemeChanged(const ui::NativeTheme* theme) { 137 SkColor BubbleIconView::GetInkDropBaseColor() const {
135 UpdateIcon(); 138 return color_utils::DeriveDefaultIconColor(GetNativeTheme()->GetSystemColor(
139 ui::NativeTheme::kColorId_TextfieldDefaultColor));
136 } 140 }
137 141
138 void BubbleIconView::OnGestureEvent(ui::GestureEvent* event) { 142 void BubbleIconView::OnGestureEvent(ui::GestureEvent* event) {
139 if (event->type() == ui::ET_GESTURE_TAP) { 143 if (event->type() == ui::ET_GESTURE_TAP) {
140 ink_drop_delegate_->OnAction(views::InkDropState::ACTIVATED); 144 ink_drop_delegate_->OnAction(views::InkDropState::ACTIVATED);
141 ExecuteCommand(EXECUTE_SOURCE_GESTURE); 145 ExecuteCommand(EXECUTE_SOURCE_GESTURE);
142 event->SetHandled(); 146 event->SetHandled();
143 } 147 }
144 } 148 }
145 149
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 void BubbleIconView::UpdateIcon() { 181 void BubbleIconView::UpdateIcon() {
178 if (SetRasterIcon()) 182 if (SetRasterIcon())
179 return; 183 return;
180 184
181 const int icon_size = 185 const int icon_size =
182 ui::MaterialDesignController::IsModeMaterial() ? 16 : 18; 186 ui::MaterialDesignController::IsModeMaterial() ? 16 : 18;
183 const ui::NativeTheme* theme = GetNativeTheme(); 187 const ui::NativeTheme* theme = GetNativeTheme();
184 SkColor icon_color = 188 SkColor icon_color =
185 active_ 189 active_
186 ? theme->GetSystemColor(ui::NativeTheme::kColorId_CallToActionColor) 190 ? theme->GetSystemColor(ui::NativeTheme::kColorId_CallToActionColor)
187 : color_utils::DeriveDefaultIconColor(theme->GetSystemColor( 191 : GetInkDropBaseColor();
188 ui::NativeTheme::kColorId_TextfieldDefaultColor));
189 image_->SetImage( 192 image_->SetImage(
190 gfx::CreateVectorIcon(GetVectorIcon(), icon_size, icon_color)); 193 gfx::CreateVectorIcon(GetVectorIcon(), icon_size, icon_color));
191 } 194 }
192 195
193 void BubbleIconView::SetActiveInternal(bool active) { 196 void BubbleIconView::SetActiveInternal(bool active) {
194 if (active_ == active) 197 if (active_ == active)
195 return; 198 return;
196 active_ = active; 199 active_ = active;
197 UpdateIcon(); 200 UpdateIcon();
198 } 201 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698