OLD | NEW |
1 // Copyright (c) 2011 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/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/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" | 10 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" |
11 #include "chrome/browser/ui/content_settings/content_setting_image_model.h" | 11 #include "chrome/browser/ui/content_settings/content_setting_image_model.h" |
12 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 12 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
13 #include "chrome/browser/ui/views/content_setting_bubble_contents.h" | 13 #include "chrome/browser/ui/views/content_setting_bubble_contents.h" |
14 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 14 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 15 #include "chrome/browser/ui/views/window.h" |
15 #include "content/browser/tab_contents/tab_contents.h" | 16 #include "content/browser/tab_contents/tab_contents.h" |
16 #include "third_party/skia/include/core/SkShader.h" | 17 #include "third_party/skia/include/core/SkShader.h" |
17 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
18 #include "ui/base/resource/resource_bundle.h" | 19 #include "ui/base/resource/resource_bundle.h" |
19 #include "ui/gfx/canvas.h" | 20 #include "ui/gfx/canvas.h" |
20 #include "ui/gfx/canvas_skia.h" | 21 #include "ui/gfx/canvas_skia.h" |
21 #include "ui/gfx/skia_util.h" | 22 #include "ui/gfx/skia_util.h" |
22 #include "views/border.h" | 23 #include "views/border.h" |
23 | 24 |
24 namespace { | 25 namespace { |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 ContentSettingBubbleContents* bubble = new ContentSettingBubbleContents( | 133 ContentSettingBubbleContents* bubble = new ContentSettingBubbleContents( |
133 ContentSettingBubbleModel::CreateContentSettingBubbleModel( | 134 ContentSettingBubbleModel::CreateContentSettingBubbleModel( |
134 parent_->browser(), | 135 parent_->browser(), |
135 tab_contents, | 136 tab_contents, |
136 profile, | 137 profile, |
137 content_setting_image_model_->get_content_settings_type()), | 138 content_setting_image_model_->get_content_settings_type()), |
138 profile, | 139 profile, |
139 tab_contents->tab_contents(), | 140 tab_contents->tab_contents(), |
140 this, | 141 this, |
141 views::BubbleBorder::TOP_RIGHT); | 142 views::BubbleBorder::TOP_RIGHT); |
142 views::BubbleDelegateView::CreateBubble(bubble); | 143 browser::CreateViewsBubble(bubble); |
143 bubble->Show(); | 144 bubble->Show(); |
144 } | 145 } |
145 | 146 |
146 void ContentSettingImageView::OnPaint(gfx::Canvas* canvas) { | 147 void ContentSettingImageView::OnPaint(gfx::Canvas* canvas) { |
147 gfx::Insets current_insets; | 148 gfx::Insets current_insets; |
148 if (border()) | 149 if (border()) |
149 border()->GetInsets(¤t_insets); | 150 border()->GetInsets(¤t_insets); |
150 // During the animation we draw a border, an icon and the text. The text area | 151 // During the animation we draw a border, an icon and the text. The text area |
151 // is changing in size during the animation, giving the appearance of the text | 152 // is changing in size during the animation, giving the appearance of the text |
152 // sliding out and then back in. When the text completely slid out the yellow | 153 // sliding out and then back in. When the text completely slid out the yellow |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 kAnimatingFraction); | 213 kAnimatingFraction); |
213 } else if (state > (1.0 - kAnimatingFraction)) { | 214 } else if (state > (1.0 - kAnimatingFraction)) { |
214 visible_text_size_ = static_cast<int>(text_size_ * (1.0 - state) / | 215 visible_text_size_ = static_cast<int>(text_size_ * (1.0 - state) / |
215 kAnimatingFraction); | 216 kAnimatingFraction); |
216 } else { | 217 } else { |
217 visible_text_size_ = text_size_; | 218 visible_text_size_ = text_size_; |
218 } | 219 } |
219 parent_->Layout(); | 220 parent_->Layout(); |
220 parent_->SchedulePaint(); | 221 parent_->SchedulePaint(); |
221 } | 222 } |
OLD | NEW |