Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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->assign(content_setting_image_model_->get_tooltip()); | |
|
Peter Kasting
2016/09/08 21:51:50
Nit: Or just
*tooltip = content_setting_image_m
Evan Stade
2016/09/09 18:48:01
Done.
| |
| 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 Loading... | |
| 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 } |
| OLD | NEW |