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_cookie_helper.h" | 9 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" |
10 #include "chrome/browser/browsing_data/browsing_data_database_helper.h" | 10 #include "chrome/browser/browsing_data/browsing_data_database_helper.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 new views::BoxLayout(views::BoxLayout::kHorizontal, | 148 new views::BoxLayout(views::BoxLayout::kHorizontal, |
149 kInfobarHorizontalPadding, | 149 kInfobarHorizontalPadding, |
150 kInfobarVerticalPadding, | 150 kInfobarVerticalPadding, |
151 views::kRelatedControlSmallHorizontalSpacing)); | 151 views::kRelatedControlSmallHorizontalSpacing)); |
152 content_->AddChildView(info_image_); | 152 content_->AddChildView(info_image_); |
153 content_->AddChildView(label_); | 153 content_->AddChildView(label_); |
154 UpdateVisibility(false, CONTENT_SETTING_BLOCK, base::string16()); | 154 UpdateVisibility(false, CONTENT_SETTING_BLOCK, base::string16()); |
155 } | 155 } |
156 | 156 |
157 // views::View overrides. | 157 // views::View overrides. |
158 virtual gfx::Size GetPreferredSize() OVERRIDE { | 158 virtual gfx::Size GetPreferredSize() const OVERRIDE { |
159 if (!visible()) | 159 if (!visible()) |
160 return gfx::Size(); | 160 return gfx::Size(); |
161 | 161 |
162 // Add space around the banner. | 162 // Add space around the banner. |
163 gfx::Size size(content_->GetPreferredSize()); | 163 gfx::Size size(content_->GetPreferredSize()); |
164 size.Enlarge(0, 2 * views::kRelatedControlVerticalSpacing); | 164 size.Enlarge(0, 2 * views::kRelatedControlVerticalSpacing); |
165 return size; | 165 return size; |
166 } | 166 } |
167 | 167 |
168 virtual void Layout() OVERRIDE { | 168 virtual void Layout() OVERRIDE { |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 | 285 |
286 void CollectedCookiesViews::OnTreeViewSelectionChanged( | 286 void CollectedCookiesViews::OnTreeViewSelectionChanged( |
287 views::TreeView* tree_view) { | 287 views::TreeView* tree_view) { |
288 EnableControls(); | 288 EnableControls(); |
289 ShowCookieInfo(); | 289 ShowCookieInfo(); |
290 } | 290 } |
291 | 291 |
292 /////////////////////////////////////////////////////////////////////////////// | 292 /////////////////////////////////////////////////////////////////////////////// |
293 // CollectedCookiesViews, views::View overrides: | 293 // CollectedCookiesViews, views::View overrides: |
294 | 294 |
295 gfx::Size CollectedCookiesViews::GetMinimumSize() { | 295 gfx::Size CollectedCookiesViews::GetMinimumSize() const { |
296 // Allow UpdateWebContentsModalDialogPosition to clamp the dialog width. | 296 // Allow UpdateWebContentsModalDialogPosition to clamp the dialog width. |
297 return gfx::Size(0, View::GetMinimumSize().height()); | 297 return gfx::Size(0, View::GetMinimumSize().height()); |
298 } | 298 } |
299 | 299 |
300 void CollectedCookiesViews::ViewHierarchyChanged( | 300 void CollectedCookiesViews::ViewHierarchyChanged( |
301 const ViewHierarchyChangedDetails& details) { | 301 const ViewHierarchyChangedDetails& details) { |
302 if (details.is_add && details.child == this) | 302 if (details.is_add && details.child == this) |
303 Init(); | 303 Init(); |
304 } | 304 } |
305 | 305 |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 /////////////////////////////////////////////////////////////////////////////// | 562 /////////////////////////////////////////////////////////////////////////////// |
563 // CollectedCookiesViews, content::NotificationObserver implementation: | 563 // CollectedCookiesViews, content::NotificationObserver implementation: |
564 | 564 |
565 void CollectedCookiesViews::Observe( | 565 void CollectedCookiesViews::Observe( |
566 int type, | 566 int type, |
567 const content::NotificationSource& source, | 567 const content::NotificationSource& source, |
568 const content::NotificationDetails& details) { | 568 const content::NotificationDetails& details) { |
569 DCHECK_EQ(chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN, type); | 569 DCHECK_EQ(chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN, type); |
570 window_->Close(); | 570 window_->Close(); |
571 } | 571 } |
OLD | NEW |