| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/content_setting_bubble_model.h" | 9 #include "chrome/browser/content_setting_bubble_model.h" |
| 10 #include "chrome/browser/content_setting_image_model.h" | 10 #include "chrome/browser/content_setting_image_model.h" |
| 11 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 11 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 preferred_size.set_width(preferred_size.width() + visible_text_size_); | 117 preferred_size.set_width(preferred_size.width() + visible_text_size_); |
| 118 return preferred_size; | 118 return preferred_size; |
| 119 } | 119 } |
| 120 | 120 |
| 121 bool ContentSettingImageView::OnMousePressed(const views::MouseEvent& event) { | 121 bool ContentSettingImageView::OnMousePressed(const views::MouseEvent& event) { |
| 122 // We want to show the bubble on mouse release; that is the standard behavior | 122 // We want to show the bubble on mouse release; that is the standard behavior |
| 123 // for buttons. | 123 // for buttons. |
| 124 return true; | 124 return true; |
| 125 } | 125 } |
| 126 | 126 |
| 127 void ContentSettingImageView::OnMouseReleased(const views::MouseEvent& event, | 127 void ContentSettingImageView::OnMouseReleased(const views::MouseEvent& event) { |
| 128 bool canceled) { | 128 if (!HitTest(event.location())) |
| 129 if (canceled || !HitTest(event.location())) | |
| 130 return; | 129 return; |
| 131 | 130 |
| 132 TabContents* tab_contents = parent_->GetTabContentsWrapper()->tab_contents(); | 131 TabContents* tab_contents = parent_->GetTabContentsWrapper()->tab_contents(); |
| 133 if (!tab_contents) | 132 if (!tab_contents) |
| 134 return; | 133 return; |
| 135 | 134 |
| 136 // Prerender does not have a bubble. | 135 // Prerender does not have a bubble. |
| 137 ContentSettingsType content_settings_type = | 136 ContentSettingsType content_settings_type = |
| 138 content_setting_image_model_->get_content_settings_type(); | 137 content_setting_image_model_->get_content_settings_type(); |
| 139 if (content_settings_type == CONTENT_SETTINGS_TYPE_PRERENDER) | 138 if (content_settings_type == CONTENT_SETTINGS_TYPE_PRERENDER) |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 } else if (state > (1.0 - kAnimatingFraction)) { | 241 } else if (state > (1.0 - kAnimatingFraction)) { |
| 243 visible_text_size_ = static_cast<int>(text_size_ * (1.0 - state) / | 242 visible_text_size_ = static_cast<int>(text_size_ * (1.0 - state) / |
| 244 kAnimatingFraction); | 243 kAnimatingFraction); |
| 245 } else { | 244 } else { |
| 246 visible_text_size_ = text_size_; | 245 visible_text_size_ = text_size_; |
| 247 } | 246 } |
| 248 parent_->Layout(); | 247 parent_->Layout(); |
| 249 parent_->SchedulePaint(); | 248 parent_->SchedulePaint(); |
| 250 } | 249 } |
| 251 | 250 |
| OLD | NEW |