| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 bitmap.getColor(bitmap.width() / 2, bitmap.height() / 2); | 68 bitmap.getColor(bitmap.width() / 2, bitmap.height() / 2); |
| 69 // Tricky bit: We alpha blend an opaque version of |background_image_color| | 69 // Tricky bit: We alpha blend an opaque version of |background_image_color| |
| 70 // against |parent_background_color| using the original image grid color's | 70 // against |parent_background_color| using the original image grid color's |
| 71 // alpha. This is because AlphaBlend(a, b, 255) always returns |a| unchanged | 71 // alpha. This is because AlphaBlend(a, b, 255) always returns |a| unchanged |
| 72 // even if |a| is a color with non-255 alpha. | 72 // even if |a| is a color with non-255 alpha. |
| 73 text_label_->SetBackgroundColor( | 73 text_label_->SetBackgroundColor( |
| 74 color_utils::AlphaBlend(SkColorSetA(background_image_color, 255), | 74 color_utils::AlphaBlend(SkColorSetA(background_image_color, 255), |
| 75 parent_background_color, | 75 parent_background_color, |
| 76 SkColorGetA(background_image_color))); | 76 SkColorGetA(background_image_color))); |
| 77 text_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 77 text_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 78 text_label_->SetElideBehavior(views::Label::NO_ELIDE); | 78 text_label_->SetElideBehavior(gfx::TRUNCATE); |
| 79 AddChildView(text_label_); | 79 AddChildView(text_label_); |
| 80 | 80 |
| 81 slide_animator_.SetSlideDuration(kAnimationDurationMS); | 81 slide_animator_.SetSlideDuration(kAnimationDurationMS); |
| 82 slide_animator_.SetTweenType(gfx::Tween::LINEAR); | 82 slide_animator_.SetTweenType(gfx::Tween::LINEAR); |
| 83 } | 83 } |
| 84 | 84 |
| 85 ContentSettingImageView::~ContentSettingImageView() { | 85 ContentSettingImageView::~ContentSettingImageView() { |
| 86 if (bubble_widget_) | 86 if (bubble_widget_) |
| 87 bubble_widget_->RemoveObserver(this); | 87 bubble_widget_->RemoveObserver(this); |
| 88 } | 88 } |
| (...skipping 154 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 web_contents, this, views::BubbleBorder::TOP_RIGHT)); | 248 web_contents, 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 |