| 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 const double kOpenFraction = | 147 const double kOpenFraction = |
| 148 static_cast<double>(kOpenTimeMS) / kAnimationDurationMS; | 148 static_cast<double>(kOpenTimeMS) / kAnimationDurationMS; |
| 149 double size_fraction = 1.0; | 149 double size_fraction = 1.0; |
| 150 if (state < kOpenFraction) | 150 if (state < kOpenFraction) |
| 151 size_fraction = state / kOpenFraction; | 151 size_fraction = state / kOpenFraction; |
| 152 if (state > (1.0 - kOpenFraction)) | 152 if (state > (1.0 - kOpenFraction)) |
| 153 size_fraction = (1.0 - state) / kOpenFraction; | 153 size_fraction = (1.0 - state) / kOpenFraction; |
| 154 size.Enlarge( | 154 size.Enlarge( |
| 155 size_fraction * (text_label_->GetPreferredSize().width() + | 155 size_fraction * (text_label_->GetPreferredSize().width() + |
| 156 GetTotalSpacingWhileAnimating()), 0); | 156 GetTotalSpacingWhileAnimating()), 0); |
| 157 size.ClampToMin(background_painter_->GetMinimumSize()); | 157 size.SetToMax(background_painter_->GetMinimumSize()); |
| 158 } | 158 } |
| 159 return size; | 159 return size; |
| 160 } | 160 } |
| 161 | 161 |
| 162 void ContentSettingImageView::Layout() { | 162 void ContentSettingImageView::Layout() { |
| 163 const int icon_width = icon_->GetPreferredSize().width(); | 163 const int icon_width = icon_->GetPreferredSize().width(); |
| 164 icon_->SetBounds( | 164 icon_->SetBounds( |
| 165 std::min((width() - icon_width) / 2, kHorizMargin), 0, | 165 std::min((width() - icon_width) / 2, kHorizMargin), 0, |
| 166 icon_width, height()); | 166 icon_width, height()); |
| 167 text_label_->SetBounds( | 167 text_label_->SetBounds( |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 parent_->delegate()->CreateViewsBubble(new ContentSettingBubbleContents( | 225 parent_->delegate()->CreateViewsBubble(new ContentSettingBubbleContents( |
| 226 ContentSettingBubbleModel::CreateContentSettingBubbleModel( | 226 ContentSettingBubbleModel::CreateContentSettingBubbleModel( |
| 227 parent_->delegate()->GetContentSettingBubbleModelDelegate(), | 227 parent_->delegate()->GetContentSettingBubbleModelDelegate(), |
| 228 web_contents, parent_->profile(), | 228 web_contents, parent_->profile(), |
| 229 content_setting_image_model_->get_content_settings_type()), | 229 content_setting_image_model_->get_content_settings_type()), |
| 230 web_contents, this, views::BubbleBorder::TOP_RIGHT)); | 230 web_contents, this, views::BubbleBorder::TOP_RIGHT)); |
| 231 bubble_widget_->AddObserver(this); | 231 bubble_widget_->AddObserver(this); |
| 232 bubble_widget_->Show(); | 232 bubble_widget_->Show(); |
| 233 } | 233 } |
| 234 } | 234 } |
| OLD | NEW |