OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include "chrome/browser/views/options/cookies_view.h" | 7 #include "chrome/browser/views/options/cookies_view.h" |
8 | 8 |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/time_format.h" | 10 #include "base/time_format.h" |
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 | 634 |
635 ChromeViews::View* CookiesView::GetContentsView() { | 635 ChromeViews::View* CookiesView::GetContentsView() { |
636 return this; | 636 return this; |
637 } | 637 } |
638 | 638 |
639 /////////////////////////////////////////////////////////////////////////////// | 639 /////////////////////////////////////////////////////////////////////////////// |
640 // CookiesView, ChromeViews::View overrides: | 640 // CookiesView, ChromeViews::View overrides: |
641 | 641 |
642 void CookiesView::Layout() { | 642 void CookiesView::Layout() { |
643 // Lay out the Remove/Remove All buttons in the parent view. | 643 // Lay out the Remove/Remove All buttons in the parent view. |
644 CSize ps; | 644 gfx::Size ps = remove_button_->GetPreferredSize(); |
645 remove_button_->GetPreferredSize(&ps); | |
646 CRect parent_bounds; | 645 CRect parent_bounds; |
647 GetParent()->GetLocalBounds(&parent_bounds, false); | 646 GetParent()->GetLocalBounds(&parent_bounds, false); |
648 int y_buttons = parent_bounds.bottom - ps.cy - kButtonVEdgeMargin; | 647 int y_buttons = parent_bounds.bottom - ps.height() - kButtonVEdgeMargin; |
649 | 648 |
650 remove_button_->SetBounds(kPanelHorizMargin, y_buttons, ps.cx, ps.cy); | 649 remove_button_->SetBounds(kPanelHorizMargin, y_buttons, ps.width(), |
| 650 ps.height()); |
651 | 651 |
652 remove_all_button_->GetPreferredSize(&ps); | 652 ps = remove_all_button_->GetPreferredSize(); |
653 int remove_all_x = remove_button_->x() + remove_button_->width() + | 653 int remove_all_x = remove_button_->x() + remove_button_->width() + |
654 kRelatedControlHorizontalSpacing; | 654 kRelatedControlHorizontalSpacing; |
655 remove_all_button_->SetBounds(remove_all_x, y_buttons, ps.cx, ps.cy); | 655 remove_all_button_->SetBounds(remove_all_x, y_buttons, ps.width(), |
| 656 ps.height()); |
656 | 657 |
657 // Lay out this View | 658 // Lay out this View |
658 View::Layout(); | 659 View::Layout(); |
659 } | 660 } |
660 | 661 |
661 void CookiesView::GetPreferredSize(CSize* out) { | 662 gfx::Size CookiesView::GetPreferredSize() { |
662 DCHECK(out); | 663 return gfx::Size(ChromeViews::Window::GetLocalizedContentsSize( |
663 *out = ChromeViews::Window::GetLocalizedContentsSize( | |
664 IDS_COOKIES_DIALOG_WIDTH_CHARS, | 664 IDS_COOKIES_DIALOG_WIDTH_CHARS, |
665 IDS_COOKIES_DIALOG_HEIGHT_LINES).ToSIZE(); | 665 IDS_COOKIES_DIALOG_HEIGHT_LINES)); |
666 } | 666 } |
667 | 667 |
668 void CookiesView::ViewHierarchyChanged(bool is_add, | 668 void CookiesView::ViewHierarchyChanged(bool is_add, |
669 ChromeViews::View* parent, | 669 ChromeViews::View* parent, |
670 ChromeViews::View* child) { | 670 ChromeViews::View* child) { |
671 if (is_add && child == this) | 671 if (is_add && child == this) |
672 Init(); | 672 Init(); |
673 } | 673 } |
674 | 674 |
675 /////////////////////////////////////////////////////////////////////////////// | 675 /////////////////////////////////////////////////////////////////////////////// |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
777 void CookiesView::ResetSearchQuery() { | 777 void CookiesView::ResetSearchQuery() { |
778 search_field_->SetText(EmptyWString()); | 778 search_field_->SetText(EmptyWString()); |
779 UpdateSearchResults(); | 779 UpdateSearchResults(); |
780 } | 780 } |
781 | 781 |
782 void CookiesView::UpdateForEmptyState() { | 782 void CookiesView::UpdateForEmptyState() { |
783 info_view_->ClearCookieDisplay(); | 783 info_view_->ClearCookieDisplay(); |
784 remove_button_->SetEnabled(false); | 784 remove_button_->SetEnabled(false); |
785 remove_all_button_->SetEnabled(false); | 785 remove_all_button_->SetEnabled(false); |
786 } | 786 } |
OLD | NEW |