| 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/macros.h" | 7 #include "base/macros.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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 kInfobarHorizontalPadding, | 143 kInfobarHorizontalPadding, |
| 144 kInfobarVerticalPadding, | 144 kInfobarVerticalPadding, |
| 145 views::kRelatedControlSmallHorizontalSpacing)); | 145 views::kRelatedControlSmallHorizontalSpacing)); |
| 146 content_->AddChildView(info_image_); | 146 content_->AddChildView(info_image_); |
| 147 content_->AddChildView(label_); | 147 content_->AddChildView(label_); |
| 148 UpdateVisibility(false, CONTENT_SETTING_BLOCK, base::string16()); | 148 UpdateVisibility(false, CONTENT_SETTING_BLOCK, base::string16()); |
| 149 } | 149 } |
| 150 | 150 |
| 151 // views::View overrides. | 151 // views::View overrides. |
| 152 gfx::Size GetPreferredSize() const override { | 152 gfx::Size GetPreferredSize() const override { |
| 153 if (!visible()) | 153 // Always return the preferred size, even if not currently visible. This |
| 154 return gfx::Size(); | 154 // ensures that the layout manager always reserves space within the view |
| 155 // so it can be made visible when necessary. Otherwise, changing the |
| 156 // visibility of this view would require the entire dialog to be resized, |
| 157 // which is undesirable from both a UX and technical perspective. |
| 155 | 158 |
| 156 // Add space around the banner. | 159 // Add space around the banner. |
| 157 gfx::Size size(content_->GetPreferredSize()); | 160 gfx::Size size(content_->GetPreferredSize()); |
| 158 size.Enlarge(0, 2 * views::kRelatedControlVerticalSpacing); | 161 size.Enlarge(0, 2 * views::kRelatedControlVerticalSpacing); |
| 159 return size; | 162 return size; |
| 160 } | 163 } |
| 161 | 164 |
| 162 void Layout() override { | 165 void Layout() override { |
| 163 content_->SetBounds( | 166 content_->SetBounds( |
| 164 0, views::kRelatedControlVerticalSpacing, | 167 0, views::kRelatedControlVerticalSpacing, |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 /////////////////////////////////////////////////////////////////////////////// | 564 /////////////////////////////////////////////////////////////////////////////// |
| 562 // CollectedCookiesViews, content::NotificationObserver implementation: | 565 // CollectedCookiesViews, content::NotificationObserver implementation: |
| 563 | 566 |
| 564 void CollectedCookiesViews::Observe( | 567 void CollectedCookiesViews::Observe( |
| 565 int type, | 568 int type, |
| 566 const content::NotificationSource& source, | 569 const content::NotificationSource& source, |
| 567 const content::NotificationDetails& details) { | 570 const content::NotificationDetails& details) { |
| 568 DCHECK_EQ(chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN, type); | 571 DCHECK_EQ(chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN, type); |
| 569 GetWidget()->Close(); | 572 GetWidget()->Close(); |
| 570 } | 573 } |
| OLD | NEW |