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/website_settings/website_settings_popup_view.h " | 5 #include "chrome/browser/ui/views/website_settings/website_settings_popup_view.h " |
6 | 6 |
7 #include "base/string_number_conversions.h" | 7 #include "base/string_number_conversions.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/certificate_viewer.h" | 9 #include "chrome/browser/certificate_viewer.h" |
10 #include "chrome/browser/infobars/infobar_tab_helper.h" | 10 #include "chrome/browser/infobars/infobar_tab_helper.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
90 const int kPermissionsSectionPaddingLeft = 18; | 90 const int kPermissionsSectionPaddingLeft = 18; |
91 const int kPermissionsSectionPaddingTop = 16; | 91 const int kPermissionsSectionPaddingTop = 16; |
92 // Space between the headline and the content of a section on the permissions | 92 // Space between the headline and the content of a section on the permissions |
93 // tab. | 93 // tab. |
94 const int kPermissionsSectionHeadlineMarginBottom = 10; | 94 const int kPermissionsSectionHeadlineMarginBottom = 10; |
95 // The content of the "Permissions" section and the "Cookies and Site Data" | 95 // The content of the "Permissions" section and the "Cookies and Site Data" |
96 // section is structured in individual rows. |kPermissionsSectionRowSpacing| | 96 // section is structured in individual rows. |kPermissionsSectionRowSpacing| |
97 // is the space between these rows. | 97 // is the space between these rows. |
98 const int kPermissionsSectionRowSpacing = 2; | 98 const int kPermissionsSectionRowSpacing = 2; |
99 | 99 |
100 // The max width of the popup. | 100 // The min width of the popup. |
101 const int kPopupWidth = 310; | 101 const int kMinPopupWidth = 310; |
102 | 102 |
103 const int kSiteDataIconColumnWidth = 20; | 103 const int kSiteDataIconColumnWidth = 20; |
104 const int kSiteDataSectionRowSpacing = 11; | 104 const int kSiteDataSectionRowSpacing = 11; |
105 | 105 |
106 } // namespace | 106 } // namespace |
107 | 107 |
108 // |PopupHeaderView| is the UI element (view) that represents the header of the | 108 // |PopupHeaderView| is the UI element (view) that represents the header of the |
109 // |WebsiteSettingsPopupView|. The header shows the status of the site's | 109 // |WebsiteSettingsPopupView|. The header shows the status of the site's |
110 // identity check and the name of the site's identity. | 110 // identity check and the name of the site's identity. |
111 class PopupHeaderView : public views::View { | 111 class PopupHeaderView : public views::View { |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
399 | 399 |
400 gfx::Size WebsiteSettingsPopupView::GetPreferredSize() { | 400 gfx::Size WebsiteSettingsPopupView::GetPreferredSize() { |
401 if (header_ == NULL && tabbed_pane_ == NULL) | 401 if (header_ == NULL && tabbed_pane_ == NULL) |
402 return views::View::GetPreferredSize(); | 402 return views::View::GetPreferredSize(); |
403 | 403 |
404 int height = 0; | 404 int height = 0; |
405 if (header_) | 405 if (header_) |
406 height += header_->GetPreferredSize().height(); | 406 height += header_->GetPreferredSize().height(); |
407 if (tabbed_pane_) | 407 if (tabbed_pane_) |
408 height += tabbed_pane_->GetPreferredSize().height(); | 408 height += tabbed_pane_->GetPreferredSize().height(); |
409 return gfx::Size(kPopupWidth, height); | 409 |
410 int width = kMinPopupWidth - kPermissionsSectionPaddingLeft; | |
msw
2012/11/07 22:43:08
nit: replace kMinPopupWidth with a kMinContentWidt
markusheintz_
2012/11/08 16:38:47
Done.
| |
411 if (site_data_content_ && | |
412 width < site_data_content_->GetPreferredSize().width()) { | |
413 width = site_data_content_->GetPreferredSize().width(); | |
msw
2012/11/07 22:43:08
nit: nix the width comparison and do std::max here
markusheintz_
2012/11/08 16:38:47
Done.
| |
414 } | |
415 if (permissions_content_ && | |
416 width < permissions_content_->GetPreferredSize().width()) { | |
417 width = permissions_content_->GetPreferredSize().width(); | |
418 } | |
419 width += kPermissionsSectionPaddingLeft; | |
420 | |
421 return gfx::Size(width, height); | |
410 } | 422 } |
411 | 423 |
412 void WebsiteSettingsPopupView::SetCookieInfo( | 424 void WebsiteSettingsPopupView::SetCookieInfo( |
413 const CookieInfoList& cookie_info_list) { | 425 const CookieInfoList& cookie_info_list) { |
414 site_data_content_->RemoveAllChildViews(true); | 426 site_data_content_->RemoveAllChildViews(true); |
415 | 427 |
416 views::GridLayout* layout = new views::GridLayout(site_data_content_); | 428 views::GridLayout* layout = new views::GridLayout(site_data_content_); |
417 site_data_content_->SetLayoutManager(layout); | 429 site_data_content_->SetLayoutManager(layout); |
418 | 430 |
419 const int site_data_content_column = 0; | 431 const int site_data_content_column = 0; |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
737 | 749 |
738 if (link) { | 750 if (link) { |
739 content_layout->StartRow(1, 0); | 751 content_layout->StartRow(1, 0); |
740 content_layout->AddView(link); | 752 content_layout->AddView(link); |
741 } | 753 } |
742 | 754 |
743 layout->AddView(content_pane, 1, 1, views::GridLayout::LEADING, | 755 layout->AddView(content_pane, 1, 1, views::GridLayout::LEADING, |
744 views::GridLayout::LEADING); | 756 views::GridLayout::LEADING); |
745 layout->AddPaddingRow(0, kConnectionSectionPaddingBottom); | 757 layout->AddPaddingRow(0, kConnectionSectionPaddingBottom); |
746 } | 758 } |
OLD | NEW |