Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Side by Side Diff: chrome/browser/ui/views/location_bar/content_setting_image_view.cc

Issue 23531053: ui/base/animation -> ui/gfx/animation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge 2 trunk Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 color_utils::AlphaBlend(SkColorSetA(background_image_color, 255), 79 color_utils::AlphaBlend(SkColorSetA(background_image_color, 255),
80 parent_background_color, 80 parent_background_color,
81 SkColorGetA(background_image_color))); 81 SkColorGetA(background_image_color)));
82 text_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); 82 text_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
83 text_label_->SetElideBehavior(views::Label::NO_ELIDE); 83 text_label_->SetElideBehavior(views::Label::NO_ELIDE);
84 AddChildView(text_label_); 84 AddChildView(text_label_);
85 85
86 LocationBarView::InitTouchableLocationBarChildView(this); 86 LocationBarView::InitTouchableLocationBarChildView(this);
87 87
88 slide_animator_.SetSlideDuration(kAnimationDurationMS); 88 slide_animator_.SetSlideDuration(kAnimationDurationMS);
89 slide_animator_.SetTweenType(ui::Tween::LINEAR); 89 slide_animator_.SetTweenType(gfx::Tween::LINEAR);
90 } 90 }
91 91
92 ContentSettingImageView::~ContentSettingImageView() { 92 ContentSettingImageView::~ContentSettingImageView() {
93 if (bubble_widget_) 93 if (bubble_widget_)
94 bubble_widget_->RemoveObserver(this); 94 bubble_widget_->RemoveObserver(this);
95 } 95 }
96 96
97 void ContentSettingImageView::UpdatePreLayout( 97 void ContentSettingImageView::UpdatePreLayout(
98 content::WebContents* web_contents) { 98 content::WebContents* web_contents) {
99 // Note: We explicitly want to call this even if |web_contents| is NULL, so we 99 // Note: We explicitly want to call this even if |web_contents| is NULL, so we
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 content_setting_image_model_->get_content_settings_type()); 152 content_setting_image_model_->get_content_settings_type());
153 } 153 }
154 } 154 }
155 155
156 // static 156 // static
157 int ContentSettingImageView::GetBubbleOuterPadding(bool by_icon) { 157 int ContentSettingImageView::GetBubbleOuterPadding(bool by_icon) {
158 return LocationBarView::GetItemPadding() - LocationBarView::kBubblePadding + 158 return LocationBarView::GetItemPadding() - LocationBarView::kBubblePadding +
159 (by_icon ? 0 : LocationBarView::kIconInternalPadding); 159 (by_icon ? 0 : LocationBarView::kIconInternalPadding);
160 } 160 }
161 161
162 void ContentSettingImageView::AnimationEnded(const ui::Animation* animation) { 162 void ContentSettingImageView::AnimationEnded(const gfx::Animation* animation) {
163 slide_animator_.Reset(); 163 slide_animator_.Reset();
164 if (!pause_animation_) { 164 if (!pause_animation_) {
165 text_label_->SetVisible(false); 165 text_label_->SetVisible(false);
166 parent_->Layout(); 166 parent_->Layout();
167 parent_->SchedulePaint(); 167 parent_->SchedulePaint();
168 } 168 }
169 } 169 }
170 170
171 void ContentSettingImageView::AnimationProgressed( 171 void ContentSettingImageView::AnimationProgressed(
172 const ui::Animation* animation) { 172 const gfx::Animation* animation) {
173 if (!pause_animation_) { 173 if (!pause_animation_) {
174 parent_->Layout(); 174 parent_->Layout();
175 parent_->SchedulePaint(); 175 parent_->SchedulePaint();
176 } 176 }
177 } 177 }
178 178
179 void ContentSettingImageView::AnimationCanceled( 179 void ContentSettingImageView::AnimationCanceled(
180 const ui::Animation* animation) { 180 const gfx::Animation* animation) {
181 AnimationEnded(animation); 181 AnimationEnded(animation);
182 } 182 }
183 183
184 gfx::Size ContentSettingImageView::GetPreferredSize() { 184 gfx::Size ContentSettingImageView::GetPreferredSize() {
185 // Height will be ignored by the LocationBarView. 185 // Height will be ignored by the LocationBarView.
186 gfx::Size size(icon_->GetPreferredSize()); 186 gfx::Size size(icon_->GetPreferredSize());
187 if (background_showing()) { 187 if (background_showing()) {
188 double state = slide_animator_.GetCurrentValue(); 188 double state = slide_animator_.GetCurrentValue();
189 // The fraction of the animation we'll spend animating the string into view, 189 // The fraction of the animation we'll spend animating the string into view,
190 // which is also the fraction we'll spend animating it closed; total 190 // which is also the fraction we'll spend animating it closed; total
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 parent_->delegate()->CreateViewsBubble(new ContentSettingBubbleContents( 276 parent_->delegate()->CreateViewsBubble(new ContentSettingBubbleContents(
277 ContentSettingBubbleModel::CreateContentSettingBubbleModel( 277 ContentSettingBubbleModel::CreateContentSettingBubbleModel(
278 parent_->delegate()->GetContentSettingBubbleModelDelegate(), 278 parent_->delegate()->GetContentSettingBubbleModelDelegate(),
279 web_contents, parent_->profile(), 279 web_contents, parent_->profile(),
280 content_setting_image_model_->get_content_settings_type()), 280 content_setting_image_model_->get_content_settings_type()),
281 web_contents, this, views::BubbleBorder::TOP_RIGHT)); 281 web_contents, this, views::BubbleBorder::TOP_RIGHT));
282 bubble_widget_->AddObserver(this); 282 bubble_widget_->AddObserver(this);
283 bubble_widget_->Show(); 283 bubble_widget_->Show();
284 } 284 }
285 285
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698