| 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/collected_cookies_views.h" | 5 #include "chrome/browser/ui/views/collected_cookies_views.h" |
| 6 | 6 |
| 7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "chrome/browser/browsing_data/browsing_data_appcache_helper.h" | 8 #include "chrome/browser/browsing_data/browsing_data_appcache_helper.h" |
| 9 #include "chrome/browser/browsing_data/browsing_data_channel_id_helper.h" | 9 #include "chrome/browser/browsing_data/browsing_data_channel_id_helper.h" |
| 10 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" | 10 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 new views::BoxLayout(views::BoxLayout::kHorizontal, | 137 new views::BoxLayout(views::BoxLayout::kHorizontal, |
| 138 kInfobarHorizontalPadding, | 138 kInfobarHorizontalPadding, |
| 139 kInfobarVerticalPadding, | 139 kInfobarVerticalPadding, |
| 140 views::kRelatedControlSmallHorizontalSpacing)); | 140 views::kRelatedControlSmallHorizontalSpacing)); |
| 141 content_->AddChildView(info_image_); | 141 content_->AddChildView(info_image_); |
| 142 content_->AddChildView(label_); | 142 content_->AddChildView(label_); |
| 143 UpdateVisibility(false, CONTENT_SETTING_BLOCK, base::string16()); | 143 UpdateVisibility(false, CONTENT_SETTING_BLOCK, base::string16()); |
| 144 } | 144 } |
| 145 | 145 |
| 146 // views::View overrides. | 146 // views::View overrides. |
| 147 virtual gfx::Size GetPreferredSize() const OVERRIDE { | 147 virtual gfx::Size GetPreferredSize() const override { |
| 148 if (!visible()) | 148 if (!visible()) |
| 149 return gfx::Size(); | 149 return gfx::Size(); |
| 150 | 150 |
| 151 // Add space around the banner. | 151 // Add space around the banner. |
| 152 gfx::Size size(content_->GetPreferredSize()); | 152 gfx::Size size(content_->GetPreferredSize()); |
| 153 size.Enlarge(0, 2 * views::kRelatedControlVerticalSpacing); | 153 size.Enlarge(0, 2 * views::kRelatedControlVerticalSpacing); |
| 154 return size; | 154 return size; |
| 155 } | 155 } |
| 156 | 156 |
| 157 virtual void Layout() OVERRIDE { | 157 virtual void Layout() override { |
| 158 content_->SetBounds( | 158 content_->SetBounds( |
| 159 0, views::kRelatedControlVerticalSpacing, | 159 0, views::kRelatedControlVerticalSpacing, |
| 160 width(), height() - views::kRelatedControlVerticalSpacing); | 160 width(), height() - views::kRelatedControlVerticalSpacing); |
| 161 } | 161 } |
| 162 | 162 |
| 163 virtual void ViewHierarchyChanged( | 163 virtual void ViewHierarchyChanged( |
| 164 const ViewHierarchyChangedDetails& details) OVERRIDE { | 164 const ViewHierarchyChangedDetails& details) override { |
| 165 if (details.is_add && details.child == this) | 165 if (details.is_add && details.child == this) |
| 166 Init(); | 166 Init(); |
| 167 } | 167 } |
| 168 | 168 |
| 169 // Holds the info icon image and text label and renders the border. | 169 // Holds the info icon image and text label and renders the border. |
| 170 views::View* content_; | 170 views::View* content_; |
| 171 // Info icon image. | 171 // Info icon image. |
| 172 views::ImageView* info_image_; | 172 views::ImageView* info_image_; |
| 173 // The label responsible for rendering the text. | 173 // The label responsible for rendering the text. |
| 174 views::Label* label_; | 174 views::Label* label_; |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 /////////////////////////////////////////////////////////////////////////////// | 532 /////////////////////////////////////////////////////////////////////////////// |
| 533 // CollectedCookiesViews, content::NotificationObserver implementation: | 533 // CollectedCookiesViews, content::NotificationObserver implementation: |
| 534 | 534 |
| 535 void CollectedCookiesViews::Observe( | 535 void CollectedCookiesViews::Observe( |
| 536 int type, | 536 int type, |
| 537 const content::NotificationSource& source, | 537 const content::NotificationSource& source, |
| 538 const content::NotificationDetails& details) { | 538 const content::NotificationDetails& details) { |
| 539 DCHECK_EQ(chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN, type); | 539 DCHECK_EQ(chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN, type); |
| 540 GetWidget()->Close(); | 540 GetWidget()->Close(); |
| 541 } | 541 } |
| OLD | NEW |