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/themes/theme_properties.h" | 8 #include "chrome/browser/themes/theme_properties.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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 static const int kBackgroundImages[] = | 54 static const int kBackgroundImages[] = |
55 IMAGE_GRID(IDR_OMNIBOX_CONTENT_SETTING_BUBBLE); | 55 IMAGE_GRID(IDR_OMNIBOX_CONTENT_SETTING_BUBBLE); |
56 SetBackgroundImageGrid(kBackgroundImages); | 56 SetBackgroundImageGrid(kBackgroundImages); |
57 } | 57 } |
58 | 58 |
59 image()->SetHorizontalAlignment(base::i18n::IsRTL() | 59 image()->SetHorizontalAlignment(base::i18n::IsRTL() |
60 ? views::ImageView::TRAILING | 60 ? views::ImageView::TRAILING |
61 : views::ImageView::LEADING); | 61 : views::ImageView::LEADING); |
62 image()->set_interactive(true); | 62 image()->set_interactive(true); |
63 image()->EnableCanvasFlippingForRTLUI(true); | 63 image()->EnableCanvasFlippingForRTLUI(true); |
64 image()->SetAccessibilityFocusable(true); | 64 image()->SetFocusBehavior(views::View::FocusBehavior::ACCESSIBLE_ONLY); |
65 label()->SetElideBehavior(gfx::NO_ELIDE); | 65 label()->SetElideBehavior(gfx::NO_ELIDE); |
66 label()->SetVisible(false); | 66 label()->SetVisible(false); |
67 | 67 |
68 slide_animator_.SetSlideDuration(kAnimationDurationMS); | 68 slide_animator_.SetSlideDuration(kAnimationDurationMS); |
69 slide_animator_.SetTweenType(gfx::Tween::LINEAR); | 69 slide_animator_.SetTweenType(gfx::Tween::LINEAR); |
70 } | 70 } |
71 | 71 |
72 ContentSettingImageView::~ContentSettingImageView() { | 72 ContentSettingImageView::~ContentSettingImageView() { |
73 if (bubble_view_ && bubble_view_->GetWidget()) | 73 if (bubble_view_ && bubble_view_->GetWidget()) |
74 bubble_view_->GetWidget()->RemoveObserver(this); | 74 bubble_view_->GetWidget()->RemoveObserver(this); |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 bubble_view_->SetArrowPaintType(views::BubbleBorder::PAINT_TRANSPARENT); | 285 bubble_view_->SetArrowPaintType(views::BubbleBorder::PAINT_TRANSPARENT); |
286 } | 286 } |
287 bubble_widget->Show(); | 287 bubble_widget->Show(); |
288 } | 288 } |
289 } | 289 } |
290 | 290 |
291 void ContentSettingImageView::UpdateImage() { | 291 void ContentSettingImageView::UpdateImage() { |
292 SetImage(content_setting_image_model_->GetIcon(GetTextColor()).AsImageSkia()); | 292 SetImage(content_setting_image_model_->GetIcon(GetTextColor()).AsImageSkia()); |
293 image()->SetTooltipText(content_setting_image_model_->get_tooltip()); | 293 image()->SetTooltipText(content_setting_image_model_->get_tooltip()); |
294 } | 294 } |
OLD | NEW |