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

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

Issue 2447523002: [ash-md] Added different highlighting modes to the InkDropImpl. (Closed)
Patch Set: Fixed InkDropHostView::GetInkDrop() to use CreateInkDrop(). Created 4 years, 1 month 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/location_bar/content_setting_image_view.h" 5 #include "chrome/browser/ui/views/location_bar/content_setting_image_view.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/themes/theme_properties.h" 8 #include "chrome/browser/themes/theme_properties.h"
9 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" 9 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h"
10 #include "chrome/browser/ui/content_settings/content_setting_image_model.h" 10 #include "chrome/browser/ui/content_settings/content_setting_image_model.h"
11 #include "chrome/browser/ui/layout_constants.h" 11 #include "chrome/browser/ui/layout_constants.h"
12 #include "chrome/browser/ui/views/content_setting_bubble_contents.h" 12 #include "chrome/browser/ui/views/content_setting_bubble_contents.h"
13 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" 13 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
14 #include "chrome/grit/theme_resources.h" 14 #include "chrome/grit/theme_resources.h"
15 #include "ui/base/l10n/l10n_util.h" 15 #include "ui/base/l10n/l10n_util.h"
16 #include "ui/base/material_design/material_design_controller.h" 16 #include "ui/base/material_design/material_design_controller.h"
17 #include "ui/base/theme_provider.h" 17 #include "ui/base/theme_provider.h"
18 #include "ui/events/event_utils.h" 18 #include "ui/events/event_utils.h"
19 #include "ui/gfx/color_palette.h" 19 #include "ui/gfx/color_palette.h"
20 #include "ui/gfx/color_utils.h" 20 #include "ui/gfx/color_utils.h"
21 #include "ui/views/animation/ink_drop_impl.h"
21 #include "ui/views/controls/image_view.h" 22 #include "ui/views/controls/image_view.h"
22 #include "ui/views/controls/label.h" 23 #include "ui/views/controls/label.h"
23 #include "ui/views/widget/widget.h" 24 #include "ui/views/widget/widget.h"
24 25
25 namespace { 26 namespace {
26 // Time spent with animation fully open. 27 // Time spent with animation fully open.
27 const int kStayOpenTimeMS = 3200; 28 const int kStayOpenTimeMS = 3200;
28 } 29 }
29 30
30 // static 31 // static
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 *tooltip = content_setting_image_model_->get_tooltip(); 143 *tooltip = content_setting_image_model_->get_tooltip();
143 return !tooltip->empty(); 144 return !tooltip->empty();
144 } 145 }
145 146
146 void ContentSettingImageView::OnNativeThemeChanged( 147 void ContentSettingImageView::OnNativeThemeChanged(
147 const ui::NativeTheme* native_theme) { 148 const ui::NativeTheme* native_theme) {
148 UpdateImage(); 149 UpdateImage();
149 IconLabelBubbleView::OnNativeThemeChanged(native_theme); 150 IconLabelBubbleView::OnNativeThemeChanged(native_theme);
150 } 151 }
151 152
152 bool ContentSettingImageView::ShouldShowInkDropForFocus() const { 153 std::unique_ptr<views::InkDrop> ContentSettingImageView::CreateInkDrop() {
153 return true; 154 std::unique_ptr<views::InkDropImpl> ink_drop = CreateDefaultInkDropImpl();
155 ink_drop->SetShowHighlightOnFocus(true);
156 return std::move(ink_drop);
154 } 157 }
155 158
156 SkColor ContentSettingImageView::GetTextColor() const { 159 SkColor ContentSettingImageView::GetTextColor() const {
157 return GetNativeTheme()->GetSystemColor( 160 return GetNativeTheme()->GetSystemColor(
158 ui::NativeTheme::kColorId_TextfieldDefaultColor); 161 ui::NativeTheme::kColorId_TextfieldDefaultColor);
159 } 162 }
160 163
161 bool ContentSettingImageView::ShouldShowLabel() const { 164 bool ContentSettingImageView::ShouldShowLabel() const {
162 return (!IsShrinking() || 165 return (!IsShrinking() ||
163 (width() > 166 (width() >
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 void ContentSettingImageView::OnWidgetVisibilityChanged(views::Widget* widget, 277 void ContentSettingImageView::OnWidgetVisibilityChanged(views::Widget* widget,
275 bool visible) { 278 bool visible) {
276 // |widget| is a bubble that has just got shown / hidden. 279 // |widget| is a bubble that has just got shown / hidden.
277 if (!visible && !label()->visible()) 280 if (!visible && !label()->visible())
278 AnimateInkDrop(views::InkDropState::DEACTIVATED, nullptr /* event */); 281 AnimateInkDrop(views::InkDropState::DEACTIVATED, nullptr /* event */);
279 } 282 }
280 283
281 void ContentSettingImageView::UpdateImage() { 284 void ContentSettingImageView::UpdateImage() {
282 SetImage(content_setting_image_model_->GetIcon(GetTextColor()).AsImageSkia()); 285 SetImage(content_setting_image_model_->GetIcon(GetTextColor()).AsImageSkia());
283 } 286 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698