| 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/utf_string_conversions.h" | 7 #include "base/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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 | 117 |
| 118 gfx::Size ContentSettingImageView::GetPreferredSize() { | 118 gfx::Size ContentSettingImageView::GetPreferredSize() { |
| 119 gfx::Size preferred_size(views::ImageView::GetPreferredSize()); | 119 gfx::Size preferred_size(views::ImageView::GetPreferredSize()); |
| 120 preferred_size.set_height(std::max(preferred_size.height(), | 120 preferred_size.set_height(std::max(preferred_size.height(), |
| 121 background_painter_.height())); | 121 background_painter_.height())); |
| 122 // When view is animated visible_text_size_ > 0, it is 0 otherwise. | 122 // When view is animated visible_text_size_ > 0, it is 0 otherwise. |
| 123 preferred_size.set_width(preferred_size.width() + visible_text_size_); | 123 preferred_size.set_width(preferred_size.width() + visible_text_size_); |
| 124 return preferred_size; | 124 return preferred_size; |
| 125 } | 125 } |
| 126 | 126 |
| 127 ui::GestureStatus ContentSettingImageView::OnGestureEvent( | 127 ui::EventResult ContentSettingImageView::OnGestureEvent( |
| 128 const ui::GestureEvent& event) { | 128 const ui::GestureEvent& event) { |
| 129 if (event.type() == ui::ET_GESTURE_TAP) { | 129 if (event.type() == ui::ET_GESTURE_TAP) { |
| 130 OnClick(); | 130 OnClick(); |
| 131 return ui::GESTURE_STATUS_CONSUMED; | 131 return ui::ER_CONSUMED; |
| 132 } else if (event.type() == ui::ET_GESTURE_TAP_DOWN) { | 132 } else if (event.type() == ui::ET_GESTURE_TAP_DOWN) { |
| 133 return ui::GESTURE_STATUS_CONSUMED; | 133 return ui::ER_CONSUMED; |
| 134 } | 134 } |
| 135 | 135 |
| 136 return ui::GESTURE_STATUS_UNKNOWN; | 136 return ui::ER_UNHANDLED; |
| 137 } | 137 } |
| 138 | 138 |
| 139 | 139 |
| 140 void ContentSettingImageView::AnimationEnded(const ui::Animation* animation) { | 140 void ContentSettingImageView::AnimationEnded(const ui::Animation* animation) { |
| 141 if (pause_animation_) | 141 if (pause_animation_) |
| 142 pause_animation_ = false; | 142 pause_animation_ = false; |
| 143 slide_animator_->Reset(); | 143 slide_animator_->Reset(); |
| 144 } | 144 } |
| 145 | 145 |
| 146 void ContentSettingImageView::AnimationProgressed( | 146 void ContentSettingImageView::AnimationProgressed( |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 slide_animator_->Reset( | 254 slide_animator_->Reset( |
| 255 1.0 - (visible_text_size_ * kAnimatingFraction) / text_size_); | 255 1.0 - (visible_text_size_ * kAnimatingFraction) / text_size_); |
| 256 pause_animation_ = false; | 256 pause_animation_ = false; |
| 257 slide_animator_->Show(); | 257 slide_animator_->Show(); |
| 258 } | 258 } |
| 259 } | 259 } |
| 260 | 260 |
| 261 int ContentSettingImageView::GetBuiltInHorizontalPadding() const { | 261 int ContentSettingImageView::GetBuiltInHorizontalPadding() const { |
| 262 return GetBuiltInHorizontalPaddingImpl(); | 262 return GetBuiltInHorizontalPaddingImpl(); |
| 263 } | 263 } |
| OLD | NEW |