| 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 if (event->type() == ui::ET_GESTURE_TAP) { | 204 if (event->type() == ui::ET_GESTURE_TAP) { |
| 205 if (!label()->visible()) | 205 if (!label()->visible()) |
| 206 ink_drop_delegate_->OnAction(views::InkDropState::ACTIVATED); | 206 ink_drop_delegate_->OnAction(views::InkDropState::ACTIVATED); |
| 207 OnClick(); | 207 OnClick(); |
| 208 } | 208 } |
| 209 if ((event->type() == ui::ET_GESTURE_TAP) || | 209 if ((event->type() == ui::ET_GESTURE_TAP) || |
| 210 (event->type() == ui::ET_GESTURE_TAP_DOWN)) | 210 (event->type() == ui::ET_GESTURE_TAP_DOWN)) |
| 211 event->SetHandled(); | 211 event->SetHandled(); |
| 212 } | 212 } |
| 213 | 213 |
| 214 void ContentSettingImageView::AddInkDropLayer(ui::Layer* ink_drop_layer) { | |
| 215 image()->SetPaintToLayer(true); | |
| 216 image()->SetFillsBoundsOpaquely(false); | |
| 217 IconLabelBubbleView::AddInkDropLayer(ink_drop_layer); | |
| 218 } | |
| 219 | |
| 220 void ContentSettingImageView::RemoveInkDropLayer(ui::Layer* ink_drop_layer) { | |
| 221 IconLabelBubbleView::RemoveInkDropLayer(ink_drop_layer); | |
| 222 image()->SetFillsBoundsOpaquely(true); | |
| 223 image()->SetPaintToLayer(false); | |
| 224 } | |
| 225 | |
| 226 scoped_ptr<views::InkDropHover> ContentSettingImageView::CreateInkDropHover() | |
| 227 const { | |
| 228 // Location bar views don't show hover effect. | |
| 229 return nullptr; | |
| 230 } | |
| 231 | |
| 232 void ContentSettingImageView::OnNativeThemeChanged( | 214 void ContentSettingImageView::OnNativeThemeChanged( |
| 233 const ui::NativeTheme* native_theme) { | 215 const ui::NativeTheme* native_theme) { |
| 234 if (ui::MaterialDesignController::IsModeMaterial()) | 216 if (ui::MaterialDesignController::IsModeMaterial()) |
| 235 UpdateImage(); | 217 UpdateImage(); |
| 236 | 218 |
| 237 IconLabelBubbleView::OnNativeThemeChanged(native_theme); | 219 IconLabelBubbleView::OnNativeThemeChanged(native_theme); |
| 238 } | 220 } |
| 239 | 221 |
| 240 void ContentSettingImageView::OnWidgetDestroying(views::Widget* widget) { | 222 void ContentSettingImageView::OnWidgetDestroying(views::Widget* widget) { |
| 241 DCHECK(bubble_view_); | 223 DCHECK(bubble_view_); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 } | 263 } |
| 282 | 264 |
| 283 void ContentSettingImageView::UpdateImage() { | 265 void ContentSettingImageView::UpdateImage() { |
| 284 SetImage(content_setting_image_model_->GetIcon(GetTextColor()).AsImageSkia()); | 266 SetImage(content_setting_image_model_->GetIcon(GetTextColor()).AsImageSkia()); |
| 285 image()->SetTooltipText(content_setting_image_model_->get_tooltip()); | 267 image()->SetTooltipText(content_setting_image_model_->get_tooltip()); |
| 286 } | 268 } |
| 287 | 269 |
| 288 bool ContentSettingImageView::IsBubbleShowing() const { | 270 bool ContentSettingImageView::IsBubbleShowing() const { |
| 289 return bubble_view_ != nullptr; | 271 return bubble_view_ != nullptr; |
| 290 } | 272 } |
| OLD | NEW |