Index: chrome/browser/ui/views/page_info/page_info_popup_view.cc |
diff --git a/chrome/browser/ui/views/page_info/website_settings_popup_view.cc b/chrome/browser/ui/views/page_info/page_info_popup_view.cc |
similarity index 89% |
rename from chrome/browser/ui/views/page_info/website_settings_popup_view.cc |
rename to chrome/browser/ui/views/page_info/page_info_popup_view.cc |
index a218e27a602391b43f49dd18b0909af9b2cc39b8..86b29932ee4b5e4179cc956c098ca85288e8dd78 100644 |
--- a/chrome/browser/ui/views/page_info/website_settings_popup_view.cc |
+++ b/chrome/browser/ui/views/page_info/page_info_popup_view.cc |
@@ -2,7 +2,7 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "chrome/browser/ui/views/page_info/website_settings_popup_view.h" |
+#include "chrome/browser/ui/views/page_info/page_info_popup_view.h" |
#include <stddef.h> |
@@ -21,7 +21,7 @@ |
#include "chrome/browser/ui/browser.h" |
#include "chrome/browser/ui/browser_dialogs.h" |
#include "chrome/browser/ui/layout_constants.h" |
-#include "chrome/browser/ui/page_info/website_settings.h" |
+#include "chrome/browser/ui/page_info/page_info.h" |
#include "chrome/browser/ui/views/collected_cookies_views.h" |
#include "chrome/browser/ui/views/harmony/layout_delegate.h" |
#include "chrome/browser/ui/views/page_info/chosen_object_row.h" |
@@ -68,8 +68,7 @@ namespace { |
// to return a weak pointer from ShowPopup so callers can associate it with the |
// current window (or other context) and check if the popup they care about is |
// showing. |
-WebsiteSettingsPopupView::PopupType g_shown_popup_type = |
- WebsiteSettingsPopupView::POPUP_NONE; |
+PageInfoPopupView::PopupType g_shown_popup_type = PageInfoPopupView::POPUP_NONE; |
// General constants ----------------------------------------------------------- |
@@ -124,7 +123,7 @@ void AddColumnWithSideMargin(views::GridLayout* layout, int margin, int id) { |
} // namespace |
// |PopupHeaderView| is the UI element (view) that represents the header of the |
-// |WebsiteSettingsPopupView|. The header shows the status of the site's |
+// |PageInfoPopupView|. The header shows the status of the site's |
// identity check and the name of the site's identity. |
class PopupHeaderView : public views::View { |
public: |
@@ -160,7 +159,7 @@ class PopupHeaderView : public views::View { |
}; |
// Website Settings are not supported for internal Chrome pages and extension |
-// pages. Instead of the |WebsiteSettingsPopupView|, the |
+// pages. Instead of the |PageInfoPopupView|, the |
// |InternalPageInfoPopupView| is displayed. |
class InternalPageInfoPopupView : public views::BubbleDialogDelegateView { |
public: |
@@ -176,7 +175,7 @@ class InternalPageInfoPopupView : public views::BubbleDialogDelegateView { |
int GetDialogButtons() const override; |
private: |
- friend class WebsiteSettingsPopupView; |
+ friend class PageInfoPopupView; |
// Used around icon and inside bubble border. |
static constexpr int kSpacing = 12; |
@@ -285,7 +284,7 @@ InternalPageInfoPopupView::InternalPageInfoPopupView( |
gfx::NativeView parent_window, |
const GURL& url) |
: BubbleDialogDelegateView(anchor_view, views::BubbleBorder::TOP_LEFT) { |
- g_shown_popup_type = WebsiteSettingsPopupView::POPUP_INTERNAL_PAGE; |
+ g_shown_popup_type = PageInfoPopupView::POPUP_INTERNAL_PAGE; |
set_parent_window(parent_window); |
int text = IDS_PAGE_INFO_INTERNAL_PAGE; |
@@ -326,7 +325,7 @@ InternalPageInfoPopupView::InternalPageInfoPopupView( |
InternalPageInfoPopupView::~InternalPageInfoPopupView() {} |
void InternalPageInfoPopupView::OnWidgetDestroying(views::Widget* widget) { |
- g_shown_popup_type = WebsiteSettingsPopupView::POPUP_NONE; |
+ g_shown_popup_type = PageInfoPopupView::POPUP_NONE; |
} |
int InternalPageInfoPopupView::GetDialogButtons() const { |
@@ -334,13 +333,13 @@ int InternalPageInfoPopupView::GetDialogButtons() const { |
} |
//////////////////////////////////////////////////////////////////////////////// |
-// WebsiteSettingsPopupView |
+// PageInfoPopupView |
//////////////////////////////////////////////////////////////////////////////// |
-WebsiteSettingsPopupView::~WebsiteSettingsPopupView() {} |
+PageInfoPopupView::~PageInfoPopupView() {} |
// static |
-void WebsiteSettingsPopupView::ShowPopup( |
+void PageInfoPopupView::ShowPopup( |
views::View* anchor_view, |
const gfx::Rect& anchor_rect, |
Profile* profile, |
@@ -361,7 +360,7 @@ void WebsiteSettingsPopupView::ShowPopup( |
popup->GetWidget()->Show(); |
return; |
} |
- WebsiteSettingsPopupView* popup = new WebsiteSettingsPopupView( |
+ PageInfoPopupView* popup = new PageInfoPopupView( |
anchor_view, parent_window, profile, web_contents, url, security_info); |
if (!anchor_view) |
popup->SetAnchorRect(anchor_rect); |
@@ -369,12 +368,11 @@ void WebsiteSettingsPopupView::ShowPopup( |
} |
// static |
-WebsiteSettingsPopupView::PopupType |
-WebsiteSettingsPopupView::GetShownPopupType() { |
+PageInfoPopupView::PopupType PageInfoPopupView::GetShownPopupType() { |
return g_shown_popup_type; |
} |
-WebsiteSettingsPopupView::WebsiteSettingsPopupView( |
+PageInfoPopupView::PageInfoPopupView( |
views::View* anchor_view, |
gfx::NativeView parent_window, |
Profile* profile, |
@@ -442,23 +440,23 @@ WebsiteSettingsPopupView::WebsiteSettingsPopupView( |
} |
views::BubbleDialogDelegateView::CreateBubble(this); |
- presenter_.reset(new WebsiteSettings( |
+ presenter_.reset(new PageInfo( |
this, profile, TabSpecificContentSettings::FromWebContents(web_contents), |
web_contents, url, security_info)); |
} |
-void WebsiteSettingsPopupView::RenderFrameDeleted( |
+void PageInfoPopupView::RenderFrameDeleted( |
content::RenderFrameHost* render_frame_host) { |
if (render_frame_host == web_contents()->GetMainFrame()) |
GetWidget()->Close(); |
} |
-void WebsiteSettingsPopupView::WebContentsDestroyed() { |
+void PageInfoPopupView::WebContentsDestroyed() { |
weak_factory_.InvalidateWeakPtrs(); |
} |
-void WebsiteSettingsPopupView::OnPermissionChanged( |
- const WebsiteSettingsUI::PermissionInfo& permission) { |
+void PageInfoPopupView::OnPermissionChanged( |
+ const PageInfoUI::PermissionInfo& permission) { |
presenter_->OnSitePermissionChanged(permission.type, permission.setting); |
// The menu buttons for the permissions might have longer strings now, so we |
// need to layout and size the whole bubble. |
@@ -466,51 +464,50 @@ void WebsiteSettingsPopupView::OnPermissionChanged( |
SizeToContents(); |
} |
-void WebsiteSettingsPopupView::OnChosenObjectDeleted( |
- const WebsiteSettingsUI::ChosenObjectInfo& info) { |
+void PageInfoPopupView::OnChosenObjectDeleted( |
+ const PageInfoUI::ChosenObjectInfo& info) { |
presenter_->OnSiteChosenObjectDeleted(info.ui_info, *info.object); |
} |
-base::string16 WebsiteSettingsPopupView::GetWindowTitle() const { |
+base::string16 PageInfoPopupView::GetWindowTitle() const { |
return summary_text_; |
} |
-bool WebsiteSettingsPopupView::ShouldShowCloseButton() const { |
+bool PageInfoPopupView::ShouldShowCloseButton() const { |
return true; |
} |
-void WebsiteSettingsPopupView::OnWidgetDestroying(views::Widget* widget) { |
+void PageInfoPopupView::OnWidgetDestroying(views::Widget* widget) { |
g_shown_popup_type = POPUP_NONE; |
presenter_->OnUIClosing(); |
} |
-int WebsiteSettingsPopupView::GetDialogButtons() const { |
+int PageInfoPopupView::GetDialogButtons() const { |
return ui::DIALOG_BUTTON_NONE; |
} |
-const gfx::FontList& WebsiteSettingsPopupView::GetTitleFontList() const { |
+const gfx::FontList& PageInfoPopupView::GetTitleFontList() const { |
return ui::ResourceBundle::GetSharedInstance().GetFontListWithDelta( |
kSummaryFontSizeDelta); |
} |
-void WebsiteSettingsPopupView::ButtonPressed(views::Button* button, |
- const ui::Event& event) { |
+void PageInfoPopupView::ButtonPressed(views::Button* button, |
+ const ui::Event& event) { |
DCHECK_EQ(BUTTON_CLOSE, button->id()); |
GetWidget()->Close(); |
} |
-void WebsiteSettingsPopupView::LinkClicked(views::Link* source, |
- int event_flags) { |
+void PageInfoPopupView::LinkClicked(views::Link* source, int event_flags) { |
// 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, |
+ base::Bind(&PageInfoPopupView::HandleLinkClickedAsync, |
weak_factory_.GetWeakPtr(), source)); |
} |
-gfx::Size WebsiteSettingsPopupView::GetPreferredSize() const { |
+gfx::Size PageInfoPopupView::GetPreferredSize() const { |
if (header_ == nullptr && site_settings_view_ == nullptr) |
return views::View::GetPreferredSize(); |
@@ -530,8 +527,7 @@ gfx::Size WebsiteSettingsPopupView::GetPreferredSize() const { |
return gfx::Size(width, height); |
} |
-void WebsiteSettingsPopupView::SetCookieInfo( |
- const CookieInfoList& cookie_info_list) { |
+void PageInfoPopupView::SetCookieInfo(const CookieInfoList& cookie_info_list) { |
// |cookie_info_list| should only ever have 2 items: first- and third-party |
// cookies. |
DCHECK_EQ(cookie_info_list.size(), 2u); |
@@ -567,14 +563,14 @@ void WebsiteSettingsPopupView::SetCookieInfo( |
layout->AddPaddingRow(0, kCookiesViewVerticalPadding); |
layout->StartRow(1, cookies_view_column); |
- WebsiteSettingsUI::PermissionInfo info; |
+ PageInfoUI::PermissionInfo info; |
info.type = CONTENT_SETTINGS_TYPE_COOKIES; |
info.setting = CONTENT_SETTING_ALLOW; |
info.is_incognito = |
Profile::FromBrowserContext(web_contents()->GetBrowserContext()) |
->IsOffTheRecord(); |
views::ImageView* icon = new NonAccessibleImageView(); |
- const gfx::Image& image = WebsiteSettingsUI::GetPermissionIcon(info); |
+ const gfx::Image& image = PageInfoUI::GetPermissionIcon(info); |
icon->SetImage(image.ToImageSkia()); |
layout->AddView( |
icon, 1, 2, views::GridLayout::FILL, |
@@ -600,13 +596,13 @@ void WebsiteSettingsPopupView::SetCookieInfo( |
SizeToContents(); |
} |
-void WebsiteSettingsPopupView::SetPermissionInfo( |
+void PageInfoPopupView::SetPermissionInfo( |
const PermissionInfoList& permission_info_list, |
ChosenObjectInfoList chosen_object_info_list) { |
- // When a permission is changed, WebsiteSettings::OnSitePermissionChanged() |
+ // When a permission is changed, PageInfo::OnSitePermissionChanged() |
// calls this method with updated permissions. However, PermissionSelectorRow |
// will have already updated its state, so it's already reflected in the UI. |
- // In addition, if a permission is set to the default setting, WebsiteSettings |
+ // In addition, if a permission is set to the default setting, PageInfo |
// removes it from |permission_info_list|, but the button should remain. |
if (permissions_view_) |
return; |
@@ -673,9 +669,8 @@ void WebsiteSettingsPopupView::SetPermissionInfo( |
SizeToContents(); |
} |
-void WebsiteSettingsPopupView::SetIdentityInfo( |
- const IdentityInfo& identity_info) { |
- std::unique_ptr<WebsiteSettingsUI::SecurityDescription> security_description = |
+void PageInfoPopupView::SetIdentityInfo(const IdentityInfo& identity_info) { |
+ std::unique_ptr<PageInfoUI::SecurityDescription> security_description = |
identity_info.GetSecurityDescription(); |
summary_text_ = security_description->summary; |
@@ -694,7 +689,7 @@ void WebsiteSettingsPopupView::SetIdentityInfo( |
SizeToContents(); |
} |
-views::View* WebsiteSettingsPopupView::CreateSiteSettingsView(int side_margin) { |
+views::View* PageInfoPopupView::CreateSiteSettingsView(int side_margin) { |
views::View* site_settings_view = new views::View(); |
views::BoxLayout* box_layout = |
new views::BoxLayout(views::BoxLayout::kVertical, side_margin, 0, 0); |
@@ -709,7 +704,7 @@ views::View* WebsiteSettingsPopupView::CreateSiteSettingsView(int side_margin) { |
return site_settings_view; |
} |
-void WebsiteSettingsPopupView::HandleLinkClickedAsync(views::Link* source) { |
+void PageInfoPopupView::HandleLinkClickedAsync(views::Link* source) { |
// Both switch cases require accessing web_contents(), so we check it here. |
if (web_contents() == nullptr || web_contents()->IsBeingDestroyed()) |
return; |
@@ -723,13 +718,13 @@ void WebsiteSettingsPopupView::HandleLinkClickedAsync(views::Link* source) { |
GURL(chrome::kChromeUIContentSettingsURL), content::Referrer(), |
WindowOpenDisposition::NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK, |
false)); |
- presenter_->RecordWebsiteSettingsAction( |
- WebsiteSettings::WEBSITE_SETTINGS_SITE_SETTINGS_OPENED); |
+ presenter_->RecordPageInfoAction( |
+ PageInfo::WEBSITE_SETTINGS_SITE_SETTINGS_OPENED); |
break; |
case LINK_COOKIE_DIALOG: |
// Count how often the Collected Cookies dialog is opened. |
- presenter_->RecordWebsiteSettingsAction( |
- WebsiteSettings::WEBSITE_SETTINGS_COOKIES_DIALOG_OPENED); |
+ presenter_->RecordPageInfoAction( |
+ PageInfo::WEBSITE_SETTINGS_COOKIES_DIALOG_OPENED); |
new CollectedCookiesViews(web_contents()); |
break; |
default: |
@@ -737,17 +732,17 @@ void WebsiteSettingsPopupView::HandleLinkClickedAsync(views::Link* source) { |
} |
} |
-void WebsiteSettingsPopupView::StyledLabelLinkClicked(views::StyledLabel* label, |
- const gfx::Range& range, |
- int event_flags) { |
+void PageInfoPopupView::StyledLabelLinkClicked(views::StyledLabel* label, |
+ const gfx::Range& range, |
+ int event_flags) { |
switch (label->id()) { |
case STYLED_LABEL_SECURITY_DETAILS: |
web_contents()->OpenURL(content::OpenURLParams( |
GURL(chrome::kPageInfoHelpCenterURL), content::Referrer(), |
WindowOpenDisposition::NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK, |
false)); |
- presenter_->RecordWebsiteSettingsAction( |
- WebsiteSettings::WEBSITE_SETTINGS_CONNECTION_HELP_OPENED); |
+ presenter_->RecordPageInfoAction( |
+ PageInfo::WEBSITE_SETTINGS_CONNECTION_HELP_OPENED); |
break; |
case STYLED_LABEL_RESET_CERTIFICATE_DECISIONS: |
presenter_->OnRevokeSSLErrorBypassButtonPressed(); |