Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7513)

Unified Diff: chrome/browser/ui/views/website_settings/website_settings_popup_view.cc

Issue 469003004: Revert "Add button to page info to revoke user certificate decisions." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/website_settings/website_settings_popup_view.cc
diff --git a/chrome/browser/ui/views/website_settings/website_settings_popup_view.cc b/chrome/browser/ui/views/website_settings/website_settings_popup_view.cc
index 361bceb09ff616385ead91eb512ad2e6d0a33d99..3d2a10dada4d4418708d6028aee98cb63a31f82a 100644
--- a/chrome/browser/ui/views/website_settings/website_settings_popup_view.cc
+++ b/chrome/browser/ui/views/website_settings/website_settings_popup_view.cc
@@ -11,7 +11,6 @@
#include "chrome/browser/certificate_viewer.h"
#include "chrome/browser/infobars/infobar_service.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/browser/ui/views/collected_cookies_views.h"
@@ -311,7 +310,6 @@ WebsiteSettingsPopupView::WebsiteSettingsPopupView(
identity_info_content_(NULL),
certificate_dialog_link_(NULL),
signed_certificate_timestamps_link_(NULL),
- reset_decisions_button_(NULL),
cert_id_(0),
help_center_link_(NULL),
connection_info_content_(NULL),
@@ -380,39 +378,21 @@ void WebsiteSettingsPopupView::OnWidgetDestroying(views::Widget* widget) {
presenter_->OnUIClosing();
}
-void WebsiteSettingsPopupView::ButtonPressed(views::Button* button,
- const ui::Event& event) {
- if (button == reset_decisions_button_) {
- ChromeSSLHostStateDelegate* delegate =
- presenter_->chrome_ssl_host_state_delegate();
- DCHECK(delegate);
- delegate->RevokeUserDecisionsHard(presenter_->site_url().host());
- GetWidget()->Close();
- }
+void WebsiteSettingsPopupView::ButtonPressed(
+ views::Button* button,
+ const ui::Event& event) {
+ GetWidget()->Close();
}
void WebsiteSettingsPopupView::LinkClicked(views::Link* source,
int event_flags) {
- if (source == cookie_dialog_link_) {
- // Count how often the Collected Cookies dialog is opened.
- content::RecordAction(
- base::UserMetricsAction("WebsiteSettings_CookiesDialogOpened"));
- new CollectedCookiesViews(web_contents_);
- } else if (source == certificate_dialog_link_) {
- gfx::NativeWindow parent = GetAnchorView() ?
- GetAnchorView()->GetWidget()->GetNativeWindow() : NULL;
- ShowCertificateViewerByID(web_contents_, parent, cert_id_);
- } else if (source == signed_certificate_timestamps_link_) {
- chrome::ShowSignedCertificateTimestampsViewer(
- web_contents_, signed_certificate_timestamp_ids_);
- } else if (source == help_center_link_) {
- browser_->OpenURL(
- content::OpenURLParams(GURL(chrome::kPageInfoHelpCenterURL),
- content::Referrer(),
- NEW_FOREGROUND_TAB,
- content::PAGE_TRANSITION_LINK,
- false));
- }
+ // The popup closes automatically when the collected cookies dialog or the
+ // certificate viewer opens. So delay handling of the link clicked to avoid
+ // a crash in the base class which needs to complete the mouse event handling.
+ content::BrowserThread::PostTask(
+ content::BrowserThread::UI, FROM_HERE,
+ base::Bind(&WebsiteSettingsPopupView::HandleLinkClickedAsync,
+ weak_factory_.GetWeakPtr(), source));
}
void WebsiteSettingsPopupView::TabSelectedAt(int index) {
@@ -576,14 +556,6 @@ void WebsiteSettingsPopupView::SetIdentityInfo(
signed_certificate_timestamps_link_->set_listener(this);
}
- if (identity_info.show_ssl_decision_revoke_button) {
- reset_decisions_button_ = new views::LabelButton(
- this,
- l10n_util::GetStringUTF16(
- IDS_PAGEINFO_RESET_INVALID_CERTIFICATE_DECISIONS_BUTTON));
- reset_decisions_button_->SetStyle(views::Button::STYLE_BUTTON);
- }
-
headline = base::UTF8ToUTF16(identity_info.site_identity);
}
ResetConnectionSection(
@@ -592,8 +564,7 @@ void WebsiteSettingsPopupView::SetIdentityInfo(
base::string16(), // The identity section has no headline.
base::UTF8ToUTF16(identity_info.identity_status_description),
certificate_dialog_link_,
- signed_certificate_timestamps_link_,
- reset_decisions_button_);
+ signed_certificate_timestamps_link_);
ResetConnectionSection(
connection_info_content_,
@@ -601,7 +572,6 @@ void WebsiteSettingsPopupView::SetIdentityInfo(
base::string16(), // The connection section has no headline.
base::UTF8ToUTF16(identity_info.connection_status_description),
NULL,
- NULL,
NULL);
connection_tab_->InvalidateLayout();
@@ -617,7 +587,6 @@ void WebsiteSettingsPopupView::SetFirstVisit(
l10n_util::GetStringUTF16(IDS_PAGE_INFO_SITE_INFO_TITLE),
first_visit,
NULL,
- NULL,
NULL);
connection_tab_->InvalidateLayout();
Layout();
@@ -736,8 +705,7 @@ void WebsiteSettingsPopupView::ResetConnectionSection(
const base::string16& headline,
const base::string16& text,
views::Link* link,
- views::Link* secondary_link,
- views::LabelButton* reset_decisions_button) {
+ views::Link* secondary_link) {
section_container->RemoveAllChildViews(true);
views::GridLayout* layout = new views::GridLayout(section_container);
@@ -810,12 +778,34 @@ void WebsiteSettingsPopupView::ResetConnectionSection(
content_layout->AddView(secondary_link);
}
- if (reset_decisions_button) {
- content_layout->StartRow(1, 0);
- content_layout->AddView(reset_decisions_button);
- }
-
layout->AddView(content_pane, 1, 1, views::GridLayout::LEADING,
views::GridLayout::LEADING);
layout->AddPaddingRow(0, kConnectionSectionPaddingBottom);
}
+
+// Used to asynchronously handle clicks since these calls may cause the
+// destruction of the settings view and the base class window still
+// needs to be alive to finish handling the mouse click.
+void WebsiteSettingsPopupView::HandleLinkClickedAsync(views::Link* source) {
+ if (source == cookie_dialog_link_) {
+ // Count how often the Collected Cookies dialog is opened.
+ content::RecordAction(
+ base::UserMetricsAction("WebsiteSettings_CookiesDialogOpened"));
+ new CollectedCookiesViews(web_contents_);
+ } else if (source == certificate_dialog_link_) {
+ gfx::NativeWindow parent =
+ GetAnchorView() ? GetAnchorView()->GetWidget()->GetNativeWindow() :
+ NULL;
+ ShowCertificateViewerByID(web_contents_, parent, cert_id_);
+ } else if (source == signed_certificate_timestamps_link_) {
+ chrome::ShowSignedCertificateTimestampsViewer(
+ web_contents_, signed_certificate_timestamp_ids_);
+ } else if (source == help_center_link_) {
+ browser_->OpenURL(content::OpenURLParams(
+ GURL(chrome::kPageInfoHelpCenterURL),
+ content::Referrer(),
+ NEW_FOREGROUND_TAB,
+ content::PAGE_TRANSITION_LINK,
+ false));
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698