OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/views/options/managed_prefs_banner_view.h" | 5 #include "chrome/browser/views/options/managed_prefs_banner_view.h" |
6 | 6 |
7 #include "app/resource_bundle.h" | 7 #include "app/resource_bundle.h" |
8 #include "gfx/color_utils.h" | 8 #include "gfx/color_utils.h" |
9 #include "grit/generated_resources.h" | 9 #include "grit/generated_resources.h" |
10 #include "grit/theme_resources.h" | 10 #include "grit/theme_resources.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 warning_image_ = new views::ImageView(); | 31 warning_image_ = new views::ImageView(); |
32 warning_image_->SetImage(rb.GetBitmapNamed(IDR_WARNING)); | 32 warning_image_->SetImage(rb.GetBitmapNamed(IDR_WARNING)); |
33 label_ = new views::Label(rb.GetLocalizedString(IDS_OPTIONS_MANAGED_PREFS)); | 33 label_ = new views::Label(rb.GetLocalizedString(IDS_OPTIONS_MANAGED_PREFS)); |
34 } | 34 } |
35 | 35 |
36 void ManagedPrefsBannerView::Init() { | 36 void ManagedPrefsBannerView::Init() { |
37 AddChildView(content_); | 37 AddChildView(content_); |
38 content_->SetLayoutManager( | 38 content_->SetLayoutManager( |
39 new views::BoxLayout(views::BoxLayout::kHorizontal, | 39 new views::BoxLayout(views::BoxLayout::kHorizontal, |
40 kPrefsBannerPadding, | 40 kPrefsBannerPadding, |
| 41 kPrefsBannerPadding, |
41 kRelatedControlSmallHorizontalSpacing)); | 42 kRelatedControlSmallHorizontalSpacing)); |
42 content_->AddChildView(warning_image_); | 43 content_->AddChildView(warning_image_); |
43 content_->AddChildView(label_); | 44 content_->AddChildView(label_); |
44 OnUpdateVisibility(); | 45 OnUpdateVisibility(); |
45 } | 46 } |
46 | 47 |
47 gfx::Size ManagedPrefsBannerView::GetPreferredSize() { | 48 gfx::Size ManagedPrefsBannerView::GetPreferredSize() { |
48 if (!IsVisible()) | 49 if (!IsVisible()) |
49 return gfx::Size(); | 50 return gfx::Size(); |
50 | 51 |
(...skipping 10 matching lines...) Expand all Loading... |
61 void ManagedPrefsBannerView::ViewHierarchyChanged(bool is_add, | 62 void ManagedPrefsBannerView::ViewHierarchyChanged(bool is_add, |
62 views::View* parent, | 63 views::View* parent, |
63 views::View* child) { | 64 views::View* child) { |
64 if (is_add && child == this) | 65 if (is_add && child == this) |
65 Init(); | 66 Init(); |
66 } | 67 } |
67 | 68 |
68 void ManagedPrefsBannerView::OnUpdateVisibility() { | 69 void ManagedPrefsBannerView::OnUpdateVisibility() { |
69 SetVisible(DetermineVisibility()); | 70 SetVisible(DetermineVisibility()); |
70 } | 71 } |
OLD | NEW |