| 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/page_info/page_info_bubble_view.h" | 5 #include "chrome/browser/ui/views/page_info/page_info_bubble_view.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 #include "extensions/common/constants.h" | 38 #include "extensions/common/constants.h" |
| 39 #include "ui/base/l10n/l10n_util.h" | 39 #include "ui/base/l10n/l10n_util.h" |
| 40 #include "ui/base/material_design/material_design_controller.h" | 40 #include "ui/base/material_design/material_design_controller.h" |
| 41 #include "ui/base/models/simple_menu_model.h" | 41 #include "ui/base/models/simple_menu_model.h" |
| 42 #include "ui/base/resource/resource_bundle.h" | 42 #include "ui/base/resource/resource_bundle.h" |
| 43 #include "ui/gfx/canvas.h" | 43 #include "ui/gfx/canvas.h" |
| 44 #include "ui/gfx/font_list.h" | 44 #include "ui/gfx/font_list.h" |
| 45 #include "ui/gfx/geometry/insets.h" | 45 #include "ui/gfx/geometry/insets.h" |
| 46 #include "ui/gfx/image/image.h" | 46 #include "ui/gfx/image/image.h" |
| 47 #include "ui/views/border.h" | 47 #include "ui/views/border.h" |
| 48 #include "ui/views/bubble/bubble_frame_view.h" |
| 48 #include "ui/views/controls/button/image_button.h" | 49 #include "ui/views/controls/button/image_button.h" |
| 49 #include "ui/views/controls/button/md_text_button.h" | 50 #include "ui/views/controls/button/md_text_button.h" |
| 50 #include "ui/views/controls/image_view.h" | 51 #include "ui/views/controls/image_view.h" |
| 51 #include "ui/views/controls/label.h" | 52 #include "ui/views/controls/label.h" |
| 52 #include "ui/views/controls/link.h" | 53 #include "ui/views/controls/link.h" |
| 53 #include "ui/views/controls/styled_label.h" | 54 #include "ui/views/controls/styled_label.h" |
| 54 #include "ui/views/layout/box_layout.h" | 55 #include "ui/views/layout/box_layout.h" |
| 55 #include "ui/views/layout/grid_layout.h" | 56 #include "ui/views/layout/grid_layout.h" |
| 56 #include "ui/views/layout/layout_manager.h" | 57 #include "ui/views/layout/layout_manager.h" |
| 57 #include "ui/views/view.h" | 58 #include "ui/views/view.h" |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 | 527 |
| 527 void PageInfoBubbleView::OnChosenObjectDeleted( | 528 void PageInfoBubbleView::OnChosenObjectDeleted( |
| 528 const PageInfoUI::ChosenObjectInfo& info) { | 529 const PageInfoUI::ChosenObjectInfo& info) { |
| 529 presenter_->OnSiteChosenObjectDeleted(info.ui_info, *info.object); | 530 presenter_->OnSiteChosenObjectDeleted(info.ui_info, *info.object); |
| 530 } | 531 } |
| 531 | 532 |
| 532 base::string16 PageInfoBubbleView::GetWindowTitle() const { | 533 base::string16 PageInfoBubbleView::GetWindowTitle() const { |
| 533 return summary_text_; | 534 return summary_text_; |
| 534 } | 535 } |
| 535 | 536 |
| 537 views::View* PageInfoBubbleView::CreateTitleView( |
| 538 const base::string16& title_text) { |
| 539 views::Label* title = |
| 540 views::BubbleFrameView::CreateDefaultTitleLabel(title_text); |
| 541 title->SetFontList( |
| 542 ui::ResourceBundle::GetSharedInstance().GetFontListWithDelta( |
| 543 kSummaryFontSizeDelta)); |
| 544 return title; |
| 545 } |
| 546 |
| 536 bool PageInfoBubbleView::ShouldShowCloseButton() const { | 547 bool PageInfoBubbleView::ShouldShowCloseButton() const { |
| 537 return true; | 548 return true; |
| 538 } | 549 } |
| 539 | 550 |
| 540 void PageInfoBubbleView::OnWidgetDestroying(views::Widget* widget) { | 551 void PageInfoBubbleView::OnWidgetDestroying(views::Widget* widget) { |
| 541 g_shown_bubble_type = BUBBLE_NONE; | 552 g_shown_bubble_type = BUBBLE_NONE; |
| 542 g_page_info_bubble = nullptr; | 553 g_page_info_bubble = nullptr; |
| 543 presenter_->OnUIClosing(); | 554 presenter_->OnUIClosing(); |
| 544 } | 555 } |
| 545 | 556 |
| 546 int PageInfoBubbleView::GetDialogButtons() const { | 557 int PageInfoBubbleView::GetDialogButtons() const { |
| 547 return ui::DIALOG_BUTTON_NONE; | 558 return ui::DIALOG_BUTTON_NONE; |
| 548 } | 559 } |
| 549 | 560 |
| 550 const gfx::FontList& PageInfoBubbleView::GetTitleFontList() const { | |
| 551 return ui::ResourceBundle::GetSharedInstance().GetFontListWithDelta( | |
| 552 kSummaryFontSizeDelta); | |
| 553 } | |
| 554 | |
| 555 void PageInfoBubbleView::ButtonPressed(views::Button* button, | 561 void PageInfoBubbleView::ButtonPressed(views::Button* button, |
| 556 const ui::Event& event) { | 562 const ui::Event& event) { |
| 557 DCHECK_EQ(VIEW_ID_PAGE_INFO_BUTTON_CLOSE, button->id()); | 563 DCHECK_EQ(VIEW_ID_PAGE_INFO_BUTTON_CLOSE, button->id()); |
| 558 GetWidget()->Close(); | 564 GetWidget()->Close(); |
| 559 } | 565 } |
| 560 | 566 |
| 561 void PageInfoBubbleView::LinkClicked(views::Link* source, int event_flags) { | 567 void PageInfoBubbleView::LinkClicked(views::Link* source, int event_flags) { |
| 562 // The bubble closes automatically when the collected cookies dialog or the | 568 // The bubble closes automatically when the collected cookies dialog or the |
| 563 // certificate viewer opens. So delay handling of the link clicked to avoid | 569 // certificate viewer opens. So delay handling of the link clicked to avoid |
| 564 // a crash in the base class which needs to complete the mouse event handling. | 570 // a crash in the base class which needs to complete the mouse event handling. |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 674 site_settings_view_->AddChildView(link_section); | 680 site_settings_view_->AddChildView(link_section); |
| 675 | 681 |
| 676 SizeToContents(); | 682 SizeToContents(); |
| 677 } | 683 } |
| 678 | 684 |
| 679 void PageInfoBubbleView::SetIdentityInfo(const IdentityInfo& identity_info) { | 685 void PageInfoBubbleView::SetIdentityInfo(const IdentityInfo& identity_info) { |
| 680 std::unique_ptr<PageInfoUI::SecurityDescription> security_description = | 686 std::unique_ptr<PageInfoUI::SecurityDescription> security_description = |
| 681 identity_info.GetSecurityDescription(); | 687 identity_info.GetSecurityDescription(); |
| 682 | 688 |
| 683 summary_text_ = security_description->summary; | 689 summary_text_ = security_description->summary; |
| 684 GetWidget()->UpdateWindowTitle(); | 690 SetupTitleView(); |
| 685 | 691 |
| 686 if (identity_info.certificate) { | 692 if (identity_info.certificate) { |
| 687 certificate_ = identity_info.certificate; | 693 certificate_ = identity_info.certificate; |
| 688 | 694 |
| 689 if (identity_info.show_ssl_decision_revoke_button) | 695 if (identity_info.show_ssl_decision_revoke_button) |
| 690 header_->AddResetDecisionsLabel(); | 696 header_->AddResetDecisionsLabel(); |
| 691 | 697 |
| 692 if (PageInfoUI::ShouldShowCertificateLink()) { | 698 if (PageInfoUI::ShouldShowCertificateLink()) { |
| 693 // The text of link to the Certificate Viewer varies depending on the | 699 // The text of link to the Certificate Viewer varies depending on the |
| 694 // validity of the Certificate. | 700 // validity of the Certificate. |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 PageInfo::PAGE_INFO_CONNECTION_HELP_OPENED); | 800 PageInfo::PAGE_INFO_CONNECTION_HELP_OPENED); |
| 795 break; | 801 break; |
| 796 case VIEW_ID_PAGE_INFO_LABEL_RESET_CERTIFICATE_DECISIONS: | 802 case VIEW_ID_PAGE_INFO_LABEL_RESET_CERTIFICATE_DECISIONS: |
| 797 presenter_->OnRevokeSSLErrorBypassButtonPressed(); | 803 presenter_->OnRevokeSSLErrorBypassButtonPressed(); |
| 798 GetWidget()->Close(); | 804 GetWidget()->Close(); |
| 799 break; | 805 break; |
| 800 default: | 806 default: |
| 801 NOTREACHED(); | 807 NOTREACHED(); |
| 802 } | 808 } |
| 803 } | 809 } |
| OLD | NEW |