| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 153 |
| 154 private: | 154 private: |
| 155 DISALLOW_COPY_AND_ASSIGN(InternalPageInfoPopupView); | 155 DISALLOW_COPY_AND_ASSIGN(InternalPageInfoPopupView); |
| 156 }; | 156 }; |
| 157 | 157 |
| 158 //////////////////////////////////////////////////////////////////////////////// | 158 //////////////////////////////////////////////////////////////////////////////// |
| 159 // Popup Header | 159 // Popup Header |
| 160 //////////////////////////////////////////////////////////////////////////////// | 160 //////////////////////////////////////////////////////////////////////////////// |
| 161 | 161 |
| 162 PopupHeaderView::PopupHeaderView(views::ButtonListener* close_button_listener) | 162 PopupHeaderView::PopupHeaderView(views::ButtonListener* close_button_listener) |
| 163 : name_(NULL), status_(NULL) { | 163 : name_(nullptr), status_(nullptr) { |
| 164 views::GridLayout* layout = new views::GridLayout(this); | 164 views::GridLayout* layout = new views::GridLayout(this); |
| 165 SetLayoutManager(layout); | 165 SetLayoutManager(layout); |
| 166 | 166 |
| 167 const int label_column = 0; | 167 const int label_column = 0; |
| 168 views::ColumnSet* column_set = layout->AddColumnSet(label_column); | 168 views::ColumnSet* column_set = layout->AddColumnSet(label_column); |
| 169 column_set->AddPaddingColumn(0, kHeaderPaddingLeft); | 169 column_set->AddPaddingColumn(0, kHeaderPaddingLeft); |
| 170 column_set->AddColumn(views::GridLayout::FILL, | 170 column_set->AddColumn(views::GridLayout::FILL, |
| 171 views::GridLayout::FILL, | 171 views::GridLayout::FILL, |
| 172 1, | 172 1, |
| 173 views::GridLayout::USE_PREF, | 173 views::GridLayout::USE_PREF, |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 WebsiteSettingsPopupView::WebsiteSettingsPopupView( | 294 WebsiteSettingsPopupView::WebsiteSettingsPopupView( |
| 295 views::View* anchor_view, | 295 views::View* anchor_view, |
| 296 Profile* profile, | 296 Profile* profile, |
| 297 content::WebContents* web_contents, | 297 content::WebContents* web_contents, |
| 298 const GURL& url, | 298 const GURL& url, |
| 299 const content::SSLStatus& ssl, | 299 const content::SSLStatus& ssl, |
| 300 Browser* browser) | 300 Browser* browser) |
| 301 : BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_LEFT), | 301 : BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_LEFT), |
| 302 web_contents_(web_contents), | 302 web_contents_(web_contents), |
| 303 browser_(browser), | 303 browser_(browser), |
| 304 header_(NULL), | 304 header_(nullptr), |
| 305 tabbed_pane_(NULL), | 305 tabbed_pane_(nullptr), |
| 306 site_data_content_(NULL), | 306 site_data_content_(nullptr), |
| 307 cookie_dialog_link_(NULL), | 307 cookie_dialog_link_(nullptr), |
| 308 permissions_content_(NULL), | 308 permissions_content_(nullptr), |
| 309 connection_tab_(NULL), | 309 connection_tab_(nullptr), |
| 310 identity_info_content_(NULL), | 310 identity_info_content_(nullptr), |
| 311 certificate_dialog_link_(NULL), | 311 certificate_dialog_link_(nullptr), |
| 312 signed_certificate_timestamps_link_(NULL), | 312 signed_certificate_timestamps_link_(nullptr), |
| 313 reset_decisions_button_(NULL), | 313 reset_decisions_button_(nullptr), |
| 314 cert_id_(0), | 314 cert_id_(0), |
| 315 help_center_link_(NULL), | 315 help_center_link_(nullptr), |
| 316 connection_info_content_(NULL), | 316 connection_info_content_(nullptr), |
| 317 page_info_content_(NULL), | 317 page_info_content_(nullptr), |
| 318 weak_factory_(this) { | 318 weak_factory_(this) { |
| 319 // Compensate for built-in vertical padding in the anchor view's image. | 319 // Compensate for built-in vertical padding in the anchor view's image. |
| 320 set_anchor_view_insets(gfx::Insets(kLocationIconVerticalMargin, 0, | 320 set_anchor_view_insets(gfx::Insets(kLocationIconVerticalMargin, 0, |
| 321 kLocationIconVerticalMargin, 0)); | 321 kLocationIconVerticalMargin, 0)); |
| 322 | 322 |
| 323 views::GridLayout* layout = new views::GridLayout(this); | 323 views::GridLayout* layout = new views::GridLayout(this); |
| 324 SetLayoutManager(layout); | 324 SetLayoutManager(layout); |
| 325 const int content_column = 0; | 325 const int content_column = 0; |
| 326 views::ColumnSet* column_set = layout->AddColumnSet(content_column); | 326 views::ColumnSet* column_set = layout->AddColumnSet(content_column); |
| 327 column_set->AddColumn(views::GridLayout::FILL, | 327 column_set->AddColumn(views::GridLayout::FILL, |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 void WebsiteSettingsPopupView::LinkClicked(views::Link* source, | 389 void WebsiteSettingsPopupView::LinkClicked(views::Link* source, |
| 390 int event_flags) { | 390 int event_flags) { |
| 391 if (source == cookie_dialog_link_) { | 391 if (source == cookie_dialog_link_) { |
| 392 // Count how often the Collected Cookies dialog is opened. | 392 // Count how often the Collected Cookies dialog is opened. |
| 393 presenter_->RecordWebsiteSettingsAction( | 393 presenter_->RecordWebsiteSettingsAction( |
| 394 WebsiteSettings::WEBSITE_SETTINGS_COOKIES_DIALOG_OPENED); | 394 WebsiteSettings::WEBSITE_SETTINGS_COOKIES_DIALOG_OPENED); |
| 395 | 395 |
| 396 new CollectedCookiesViews(web_contents_); | 396 new CollectedCookiesViews(web_contents_); |
| 397 } else if (source == certificate_dialog_link_) { | 397 } else if (source == certificate_dialog_link_) { |
| 398 gfx::NativeWindow parent = GetAnchorView() ? | 398 gfx::NativeWindow parent = GetAnchorView() ? |
| 399 GetAnchorView()->GetWidget()->GetNativeWindow() : NULL; | 399 GetAnchorView()->GetWidget()->GetNativeWindow() : nullptr; |
| 400 presenter_->RecordWebsiteSettingsAction( | 400 presenter_->RecordWebsiteSettingsAction( |
| 401 WebsiteSettings::WEBSITE_SETTINGS_CERTIFICATE_DIALOG_OPENED); | 401 WebsiteSettings::WEBSITE_SETTINGS_CERTIFICATE_DIALOG_OPENED); |
| 402 ShowCertificateViewerByID(web_contents_, parent, cert_id_); | 402 ShowCertificateViewerByID(web_contents_, parent, cert_id_); |
| 403 } else if (source == signed_certificate_timestamps_link_) { | 403 } else if (source == signed_certificate_timestamps_link_) { |
| 404 chrome::ShowSignedCertificateTimestampsViewer( | 404 chrome::ShowSignedCertificateTimestampsViewer( |
| 405 web_contents_, signed_certificate_timestamp_ids_); | 405 web_contents_, signed_certificate_timestamp_ids_); |
| 406 presenter_->RecordWebsiteSettingsAction( | 406 presenter_->RecordWebsiteSettingsAction( |
| 407 WebsiteSettings::WEBSITE_SETTINGS_TRANSPARENCY_VIEWER_OPENED); | 407 WebsiteSettings::WEBSITE_SETTINGS_TRANSPARENCY_VIEWER_OPENED); |
| 408 } else if (source == help_center_link_) { | 408 } else if (source == help_center_link_) { |
| 409 browser_->OpenURL( | 409 browser_->OpenURL( |
| (...skipping 23 matching lines...) Expand all Loading... |
| 433 } | 433 } |
| 434 break; | 434 break; |
| 435 default: | 435 default: |
| 436 NOTREACHED(); | 436 NOTREACHED(); |
| 437 } | 437 } |
| 438 tabbed_pane_->GetSelectedTab()->Layout(); | 438 tabbed_pane_->GetSelectedTab()->Layout(); |
| 439 SizeToContents(); | 439 SizeToContents(); |
| 440 } | 440 } |
| 441 | 441 |
| 442 gfx::Size WebsiteSettingsPopupView::GetPreferredSize() const { | 442 gfx::Size WebsiteSettingsPopupView::GetPreferredSize() const { |
| 443 if (header_ == NULL && tabbed_pane_ == NULL) | 443 if (header_ == nullptr && tabbed_pane_ == nullptr) |
| 444 return views::View::GetPreferredSize(); | 444 return views::View::GetPreferredSize(); |
| 445 | 445 |
| 446 int height = 0; | 446 int height = 0; |
| 447 if (header_) | 447 if (header_) |
| 448 height += header_->GetPreferredSize().height(); | 448 height += header_->GetPreferredSize().height(); |
| 449 if (tabbed_pane_) | 449 if (tabbed_pane_) |
| 450 height += tabbed_pane_->GetPreferredSize().height(); | 450 height += tabbed_pane_->GetPreferredSize().height(); |
| 451 | 451 |
| 452 int width = kPermissionsSectionContentMinWidth; | 452 int width = kPermissionsSectionContentMinWidth; |
| 453 if (site_data_content_) | 453 if (site_data_content_) |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 base::UTF8ToUTF16(identity_info.identity_status_description), | 612 base::UTF8ToUTF16(identity_info.identity_status_description), |
| 613 certificate_dialog_link_, | 613 certificate_dialog_link_, |
| 614 signed_certificate_timestamps_link_, | 614 signed_certificate_timestamps_link_, |
| 615 reset_decisions_button_); | 615 reset_decisions_button_); |
| 616 | 616 |
| 617 ResetConnectionSection( | 617 ResetConnectionSection( |
| 618 connection_info_content_, | 618 connection_info_content_, |
| 619 WebsiteSettingsUI::GetConnectionIcon(identity_info.connection_status), | 619 WebsiteSettingsUI::GetConnectionIcon(identity_info.connection_status), |
| 620 base::string16(), // The connection section has no headline. | 620 base::string16(), // The connection section has no headline. |
| 621 base::UTF8ToUTF16(identity_info.connection_status_description), | 621 base::UTF8ToUTF16(identity_info.connection_status_description), |
| 622 NULL, | 622 nullptr, |
| 623 NULL, | 623 nullptr, |
| 624 NULL); | 624 nullptr); |
| 625 | 625 |
| 626 connection_tab_->InvalidateLayout(); | 626 connection_tab_->InvalidateLayout(); |
| 627 Layout(); | 627 Layout(); |
| 628 SizeToContents(); | 628 SizeToContents(); |
| 629 } | 629 } |
| 630 | 630 |
| 631 void WebsiteSettingsPopupView::SetFirstVisit( | 631 void WebsiteSettingsPopupView::SetFirstVisit( |
| 632 const base::string16& first_visit) { | 632 const base::string16& first_visit) { |
| 633 ResetConnectionSection( | 633 ResetConnectionSection( |
| 634 page_info_content_, | 634 page_info_content_, |
| 635 WebsiteSettingsUI::GetFirstVisitIcon(first_visit), | 635 WebsiteSettingsUI::GetFirstVisitIcon(first_visit), |
| 636 l10n_util::GetStringUTF16(IDS_PAGE_INFO_SITE_INFO_TITLE), | 636 l10n_util::GetStringUTF16(IDS_PAGE_INFO_SITE_INFO_TITLE), |
| 637 first_visit, | 637 first_visit, |
| 638 NULL, | 638 nullptr, |
| 639 NULL, | 639 nullptr, |
| 640 NULL); | 640 nullptr); |
| 641 connection_tab_->InvalidateLayout(); | 641 connection_tab_->InvalidateLayout(); |
| 642 Layout(); | 642 Layout(); |
| 643 SizeToContents(); | 643 SizeToContents(); |
| 644 } | 644 } |
| 645 | 645 |
| 646 void WebsiteSettingsPopupView::SetSelectedTab(TabId tab_id) { | 646 void WebsiteSettingsPopupView::SetSelectedTab(TabId tab_id) { |
| 647 tabbed_pane_->SelectTabAt(tab_id); | 647 tabbed_pane_->SelectTabAt(tab_id); |
| 648 } | 648 } |
| 649 | 649 |
| 650 views::View* WebsiteSettingsPopupView::CreatePermissionsTab() { | 650 views::View* WebsiteSettingsPopupView::CreatePermissionsTab() { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 661 IDS_WEBSITE_SETTINGS_TITLE_SITE_DATA), | 661 IDS_WEBSITE_SETTINGS_TITLE_SITE_DATA), |
| 662 site_data_content_, | 662 site_data_content_, |
| 663 cookie_dialog_link_); | 663 cookie_dialog_link_); |
| 664 pane->AddChildView(site_data_section); | 664 pane->AddChildView(site_data_section); |
| 665 // Add permissions section. | 665 // Add permissions section. |
| 666 permissions_content_ = new views::View(); | 666 permissions_content_ = new views::View(); |
| 667 views::View* permissions_section = | 667 views::View* permissions_section = |
| 668 CreateSection(l10n_util::GetStringUTF16( | 668 CreateSection(l10n_util::GetStringUTF16( |
| 669 IDS_WEBSITE_SETTINGS_TITLE_SITE_PERMISSIONS), | 669 IDS_WEBSITE_SETTINGS_TITLE_SITE_PERMISSIONS), |
| 670 permissions_content_, | 670 permissions_content_, |
| 671 NULL); | 671 nullptr); |
| 672 pane->AddChildView(permissions_section); | 672 pane->AddChildView(permissions_section); |
| 673 return pane; | 673 return pane; |
| 674 } | 674 } |
| 675 | 675 |
| 676 views::View* WebsiteSettingsPopupView::CreateConnectionTab() { | 676 views::View* WebsiteSettingsPopupView::CreateConnectionTab() { |
| 677 views::View* pane = new views::View(); | 677 views::View* pane = new views::View(); |
| 678 pane->SetLayoutManager( | 678 pane->SetLayoutManager( |
| 679 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 1)); | 679 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 1)); |
| 680 // Add site identity section. | 680 // Add site identity section. |
| 681 identity_info_content_ = new views::View(); | 681 identity_info_content_ = new views::View(); |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 | 831 |
| 832 if (reset_decisions_button) { | 832 if (reset_decisions_button) { |
| 833 content_layout->StartRow(1, 0); | 833 content_layout->StartRow(1, 0); |
| 834 content_layout->AddView(reset_decisions_button); | 834 content_layout->AddView(reset_decisions_button); |
| 835 } | 835 } |
| 836 | 836 |
| 837 layout->AddView(content_pane, 1, 1, views::GridLayout::LEADING, | 837 layout->AddView(content_pane, 1, 1, views::GridLayout::LEADING, |
| 838 views::GridLayout::LEADING); | 838 views::GridLayout::LEADING); |
| 839 layout->AddPaddingRow(0, kConnectionSectionPaddingBottom); | 839 layout->AddPaddingRow(0, kConnectionSectionPaddingBottom); |
| 840 } | 840 } |
| OLD | NEW |