| 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/content_settings/tab_specific_content_settings.h" | 8 #include "chrome/browser/content_settings/tab_specific_content_settings.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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 height()); | 187 height()); |
| 188 } | 188 } |
| 189 | 189 |
| 190 bool ContentSettingImageView::OnMousePressed(const ui::MouseEvent& event) { | 190 bool ContentSettingImageView::OnMousePressed(const ui::MouseEvent& event) { |
| 191 // We want to show the bubble on mouse release; that is the standard behavior | 191 // We want to show the bubble on mouse release; that is the standard behavior |
| 192 // for buttons. | 192 // for buttons. |
| 193 return true; | 193 return true; |
| 194 } | 194 } |
| 195 | 195 |
| 196 void ContentSettingImageView::OnMouseReleased(const ui::MouseEvent& event) { | 196 void ContentSettingImageView::OnMouseReleased(const ui::MouseEvent& event) { |
| 197 if (HitTestPoint(event.location())) | 197 if (HitTestPoint(gfx::ToFlooredPoint(event.location()))) |
| 198 OnClick(); | 198 OnClick(); |
| 199 } | 199 } |
| 200 | 200 |
| 201 void ContentSettingImageView::OnGestureEvent(ui::GestureEvent* event) { | 201 void ContentSettingImageView::OnGestureEvent(ui::GestureEvent* event) { |
| 202 if (event->type() == ui::ET_GESTURE_TAP) | 202 if (event->type() == ui::ET_GESTURE_TAP) |
| 203 OnClick(); | 203 OnClick(); |
| 204 if ((event->type() == ui::ET_GESTURE_TAP) || | 204 if ((event->type() == ui::ET_GESTURE_TAP) || |
| 205 (event->type() == ui::ET_GESTURE_TAP_DOWN)) | 205 (event->type() == ui::ET_GESTURE_TAP_DOWN)) |
| 206 event->SetHandled(); | 206 event->SetHandled(); |
| 207 } | 207 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 parent_->delegate()->CreateViewsBubble(new ContentSettingBubbleContents( | 243 parent_->delegate()->CreateViewsBubble(new ContentSettingBubbleContents( |
| 244 ContentSettingBubbleModel::CreateContentSettingBubbleModel( | 244 ContentSettingBubbleModel::CreateContentSettingBubbleModel( |
| 245 parent_->delegate()->GetContentSettingBubbleModelDelegate(), | 245 parent_->delegate()->GetContentSettingBubbleModelDelegate(), |
| 246 web_contents, parent_->profile(), | 246 web_contents, parent_->profile(), |
| 247 content_setting_image_model_->get_content_settings_type()), | 247 content_setting_image_model_->get_content_settings_type()), |
| 248 this, views::BubbleBorder::TOP_RIGHT)); | 248 this, views::BubbleBorder::TOP_RIGHT)); |
| 249 bubble_widget_->AddObserver(this); | 249 bubble_widget_->AddObserver(this); |
| 250 bubble_widget_->Show(); | 250 bubble_widget_->Show(); |
| 251 } | 251 } |
| 252 } | 252 } |
| OLD | NEW |