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" |
11 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 11 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
12 #include "chrome/browser/ui/views/content_setting_bubble_contents.h" | 12 #include "chrome/browser/ui/views/content_setting_bubble_contents.h" |
13 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 13 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
14 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
15 #include "third_party/skia/include/core/SkShader.h" | 15 #include "third_party/skia/include/core/SkShader.h" |
16 #include "ui/base/animation/slide_animation.h" | 16 #include "ui/base/animation/slide_animation.h" |
17 #include "ui/base/animation/tween.h" | 17 #include "ui/base/animation/tween.h" |
18 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
19 #include "ui/base/resource/resource_bundle.h" | 19 #include "ui/base/resource/resource_bundle.h" |
20 #include "ui/gfx/canvas.h" | 20 #include "ui/gfx/canvas.h" |
21 #include "ui/gfx/skia_util.h" | 21 #include "ui/gfx/skia_util.h" |
22 #include "ui/views/border.h" | 22 #include "ui/views/border.h" |
23 #include "ui/views/events/event.h" | |
24 #include "ui/views/widget/widget.h" | 23 #include "ui/views/widget/widget.h" |
25 | 24 |
26 using content::WebContents; | 25 using content::WebContents; |
27 | 26 |
28 namespace { | 27 namespace { |
29 // Animation parameters. | 28 // Animation parameters. |
30 const int kOpenTimeMs = 150; | 29 const int kOpenTimeMs = 150; |
31 const int kFullOpenedTimeMs = 3200; | 30 const int kFullOpenedTimeMs = 3200; |
32 const int kMoveTimeMs = kFullOpenedTimeMs + 2 * kOpenTimeMs; | 31 const int kMoveTimeMs = kFullOpenedTimeMs + 2 * kOpenTimeMs; |
33 const int kFrameRateHz = 60; | 32 const int kFrameRateHz = 60; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 } | 122 } |
124 | 123 |
125 gfx::Size ContentSettingImageView::GetPreferredSize() { | 124 gfx::Size ContentSettingImageView::GetPreferredSize() { |
126 gfx::Size preferred_size(views::ImageView::GetPreferredSize()); | 125 gfx::Size preferred_size(views::ImageView::GetPreferredSize()); |
127 // When view is animated visible_text_size_ > 0, it is 0 otherwise. | 126 // When view is animated visible_text_size_ > 0, it is 0 otherwise. |
128 preferred_size.set_width(preferred_size.width() + visible_text_size_); | 127 preferred_size.set_width(preferred_size.width() + visible_text_size_); |
129 return preferred_size; | 128 return preferred_size; |
130 } | 129 } |
131 | 130 |
132 ui::GestureStatus ContentSettingImageView::OnGestureEvent( | 131 ui::GestureStatus ContentSettingImageView::OnGestureEvent( |
133 const views::GestureEvent& event) { | 132 const ui::GestureEvent& event) { |
134 if (event.type() == ui::ET_GESTURE_TAP) { | 133 if (event.type() == ui::ET_GESTURE_TAP) { |
135 OnClick(); | 134 OnClick(); |
136 return ui::GESTURE_STATUS_CONSUMED; | 135 return ui::GESTURE_STATUS_CONSUMED; |
137 } else if (event.type() == ui::ET_GESTURE_TAP_DOWN) { | 136 } else if (event.type() == ui::ET_GESTURE_TAP_DOWN) { |
138 return ui::GESTURE_STATUS_CONSUMED; | 137 return ui::GESTURE_STATUS_CONSUMED; |
139 } | 138 } |
140 | 139 |
141 return ui::GESTURE_STATUS_UNKNOWN; | 140 return ui::GESTURE_STATUS_UNKNOWN; |
142 } | 141 } |
143 | 142 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 return kBorderColor; | 293 return kBorderColor; |
295 } | 294 } |
296 | 295 |
297 SkColor ContentSettingImageView::GradientTopColor() const { | 296 SkColor ContentSettingImageView::GradientTopColor() const { |
298 return kTopBoxColor; | 297 return kTopBoxColor; |
299 } | 298 } |
300 | 299 |
301 SkColor ContentSettingImageView::GradientBottomColor() const { | 300 SkColor ContentSettingImageView::GradientBottomColor() const { |
302 return kBottomBoxColor; | 301 return kBottomBoxColor; |
303 } | 302 } |
OLD | NEW |