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

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

Issue 2323973002: Fix tooltip text for ContentSettingImageView. (Closed)
Patch Set: operator= 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
« no previous file with comments | « chrome/browser/ui/views/location_bar/content_setting_image_view.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 } 140 }
141 141
142 void ContentSettingImageView::OnGestureEvent(ui::GestureEvent* event) { 142 void ContentSettingImageView::OnGestureEvent(ui::GestureEvent* event) {
143 if (event->type() == ui::ET_GESTURE_TAP) 143 if (event->type() == ui::ET_GESTURE_TAP)
144 OnActivate(*event); 144 OnActivate(*event);
145 if ((event->type() == ui::ET_GESTURE_TAP) || 145 if ((event->type() == ui::ET_GESTURE_TAP) ||
146 (event->type() == ui::ET_GESTURE_TAP_DOWN)) 146 (event->type() == ui::ET_GESTURE_TAP_DOWN))
147 event->SetHandled(); 147 event->SetHandled();
148 } 148 }
149 149
150 bool ContentSettingImageView::GetTooltipText(const gfx::Point& p,
151 base::string16* tooltip) const {
152 *tooltip = content_setting_image_model_->get_tooltip();
153 return !tooltip->empty();
154 }
155
150 void ContentSettingImageView::OnNativeThemeChanged( 156 void ContentSettingImageView::OnNativeThemeChanged(
151 const ui::NativeTheme* native_theme) { 157 const ui::NativeTheme* native_theme) {
152 if (ui::MaterialDesignController::IsModeMaterial()) 158 if (ui::MaterialDesignController::IsModeMaterial())
153 UpdateImage(); 159 UpdateImage();
154 160
155 IconLabelBubbleView::OnNativeThemeChanged(native_theme); 161 IconLabelBubbleView::OnNativeThemeChanged(native_theme);
156 } 162 }
157 163
158 bool ContentSettingImageView::ShouldShowInkDropForFocus() const { 164 bool ContentSettingImageView::ShouldShowInkDropForFocus() const {
159 return true; 165 return true;
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 285
280 void ContentSettingImageView::OnWidgetVisibilityChanged(views::Widget* widget, 286 void ContentSettingImageView::OnWidgetVisibilityChanged(views::Widget* widget,
281 bool visible) { 287 bool visible) {
282 // |widget| is a bubble that has just got shown / hidden. 288 // |widget| is a bubble that has just got shown / hidden.
283 if (!visible && !label()->visible()) 289 if (!visible && !label()->visible())
284 AnimateInkDrop(views::InkDropState::DEACTIVATED, nullptr /* event */); 290 AnimateInkDrop(views::InkDropState::DEACTIVATED, nullptr /* event */);
285 } 291 }
286 292
287 void ContentSettingImageView::UpdateImage() { 293 void ContentSettingImageView::UpdateImage() {
288 SetImage(content_setting_image_model_->GetIcon(GetTextColor()).AsImageSkia()); 294 SetImage(content_setting_image_model_->GetIcon(GetTextColor()).AsImageSkia());
289 image()->SetTooltipText(content_setting_image_model_->get_tooltip());
290 } 295 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/location_bar/content_setting_image_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698