| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 const int kHeaderPaddingTop = 12; | 72 const int kHeaderPaddingTop = 12; |
| 73 | 73 |
| 74 // Spacing between the site identity label and the site identity status text in | 74 // Spacing between the site identity label and the site identity status text in |
| 75 // the popup header. | 75 // the popup header. |
| 76 const int kHeaderRowSpacing = 4; | 76 const int kHeaderRowSpacing = 4; |
| 77 | 77 |
| 78 // To make the bubble's arrow point directly at the location icon rather than at | 78 // To make the bubble's arrow point directly at the location icon rather than at |
| 79 // the Omnibox's edge, inset the bubble's anchor rect by this amount of pixels. | 79 // the Omnibox's edge, inset the bubble's anchor rect by this amount of pixels. |
| 80 const int kLocationIconVerticalMargin = 5; | 80 const int kLocationIconVerticalMargin = 5; |
| 81 | 81 |
| 82 // The max possible width of the popup. |
| 83 const int kMaxPopupWidth = 500; |
| 84 |
| 82 // The margins between the popup border and the popup content. | 85 // The margins between the popup border and the popup content. |
| 83 const int kPopupMarginTop = 4; | 86 const int kPopupMarginTop = 4; |
| 84 const int kPopupMarginLeft = 0; | 87 const int kPopupMarginLeft = 0; |
| 85 const int kPopupMarginBottom = 10; | 88 const int kPopupMarginBottom = 10; |
| 86 const int kPopupMarginRight = 0; | 89 const int kPopupMarginRight = 0; |
| 87 | 90 |
| 88 // Padding values for sections on the permissions tab. | 91 // Padding values for sections on the permissions tab. |
| 92 const int kPermissionsSectionContentMinWidth = 300; |
| 89 const int kPermissionsSectionPaddingBottom = 6; | 93 const int kPermissionsSectionPaddingBottom = 6; |
| 90 const int kPermissionsSectionPaddingLeft = 18; | 94 const int kPermissionsSectionPaddingLeft = 18; |
| 91 const int kPermissionsSectionPaddingTop = 16; | 95 const int kPermissionsSectionPaddingTop = 16; |
| 96 |
| 92 // Space between the headline and the content of a section on the permissions | 97 // Space between the headline and the content of a section on the permissions |
| 93 // tab. | 98 // tab. |
| 94 const int kPermissionsSectionHeadlineMarginBottom = 10; | 99 const int kPermissionsSectionHeadlineMarginBottom = 10; |
| 95 // The content of the "Permissions" section and the "Cookies and Site Data" | 100 // The content of the "Permissions" section and the "Cookies and Site Data" |
| 96 // section is structured in individual rows. |kPermissionsSectionRowSpacing| | 101 // section is structured in individual rows. |kPermissionsSectionRowSpacing| |
| 97 // is the space between these rows. | 102 // is the space between these rows. |
| 98 const int kPermissionsSectionRowSpacing = 2; | 103 const int kPermissionsSectionRowSpacing = 2; |
| 99 | 104 |
| 100 // The max width of the popup. | |
| 101 const int kPopupWidth = 310; | |
| 102 | |
| 103 const int kSiteDataIconColumnWidth = 20; | 105 const int kSiteDataIconColumnWidth = 20; |
| 104 const int kSiteDataSectionRowSpacing = 11; | 106 const int kSiteDataSectionRowSpacing = 11; |
| 105 | 107 |
| 106 } // namespace | 108 } // namespace |
| 107 | 109 |
| 108 // |PopupHeaderView| is the UI element (view) that represents the header of the | 110 // |PopupHeaderView| is the UI element (view) that represents the header of the |
| 109 // |WebsiteSettingsPopupView|. The header shows the status of the site's | 111 // |WebsiteSettingsPopupView|. The header shows the status of the site's |
| 110 // identity check and the name of the site's identity. | 112 // identity check and the name of the site's identity. |
| 111 class PopupHeaderView : public views::View { | 113 class PopupHeaderView : public views::View { |
| 112 public: | 114 public: |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 | 401 |
| 400 gfx::Size WebsiteSettingsPopupView::GetPreferredSize() { | 402 gfx::Size WebsiteSettingsPopupView::GetPreferredSize() { |
| 401 if (header_ == NULL && tabbed_pane_ == NULL) | 403 if (header_ == NULL && tabbed_pane_ == NULL) |
| 402 return views::View::GetPreferredSize(); | 404 return views::View::GetPreferredSize(); |
| 403 | 405 |
| 404 int height = 0; | 406 int height = 0; |
| 405 if (header_) | 407 if (header_) |
| 406 height += header_->GetPreferredSize().height(); | 408 height += header_->GetPreferredSize().height(); |
| 407 if (tabbed_pane_) | 409 if (tabbed_pane_) |
| 408 height += tabbed_pane_->GetPreferredSize().height(); | 410 height += tabbed_pane_->GetPreferredSize().height(); |
| 409 return gfx::Size(kPopupWidth, height); | 411 |
| 412 int width = kPermissionsSectionContentMinWidth; |
| 413 if (site_data_content_) |
| 414 width = std::max(width, site_data_content_->GetPreferredSize().width()); |
| 415 if (permissions_content_) |
| 416 width = std::max(width, permissions_content_->GetPreferredSize().width()); |
| 417 width += kPermissionsSectionPaddingLeft; |
| 418 width = std::min(width, kMaxPopupWidth); |
| 419 |
| 420 return gfx::Size(width, height); |
| 410 } | 421 } |
| 411 | 422 |
| 412 void WebsiteSettingsPopupView::SetCookieInfo( | 423 void WebsiteSettingsPopupView::SetCookieInfo( |
| 413 const CookieInfoList& cookie_info_list) { | 424 const CookieInfoList& cookie_info_list) { |
| 414 site_data_content_->RemoveAllChildViews(true); | 425 site_data_content_->RemoveAllChildViews(true); |
| 415 | 426 |
| 416 views::GridLayout* layout = new views::GridLayout(site_data_content_); | 427 views::GridLayout* layout = new views::GridLayout(site_data_content_); |
| 417 site_data_content_->SetLayoutManager(layout); | 428 site_data_content_->SetLayoutManager(layout); |
| 418 | 429 |
| 419 const int site_data_content_column = 0; | 430 const int site_data_content_column = 0; |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 737 | 748 |
| 738 if (link) { | 749 if (link) { |
| 739 content_layout->StartRow(1, 0); | 750 content_layout->StartRow(1, 0); |
| 740 content_layout->AddView(link); | 751 content_layout->AddView(link); |
| 741 } | 752 } |
| 742 | 753 |
| 743 layout->AddView(content_pane, 1, 1, views::GridLayout::LEADING, | 754 layout->AddView(content_pane, 1, 1, views::GridLayout::LEADING, |
| 744 views::GridLayout::LEADING); | 755 views::GridLayout::LEADING); |
| 745 layout->AddPaddingRow(0, kConnectionSectionPaddingBottom); | 756 layout->AddPaddingRow(0, kConnectionSectionPaddingBottom); |
| 746 } | 757 } |
| OLD | NEW |