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

Unified Diff: chrome/browser/ui/views/page_info/page_info_popup_view.cc

Issue 2754383004: Rename WebsiteSettings code to PageInfo. (Closed)
Patch Set: Upload missing comment fix for WebSettingsUI -> PageInfoUI. Created 3 years, 9 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/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 87%
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 0e85723a58a4dca7df7f46bf44698b9b0330480c..bea7900080fc990d5b0610f2413a1c7ed0004061 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/chrome_typography.h"
#include "chrome/browser/ui/views/harmony/layout_delegate.h"
@@ -64,13 +64,12 @@
namespace {
// NOTE(jdonnelly): This use of this process-wide variable assumes that there's
-// never more than one website settings popup shown and that it's associated
+// never more than one page info popup shown and that it's associated
// with the current window. If this assumption fails in the future, we'll need
// 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 -----------------------------------------------------------
@@ -108,7 +107,7 @@ const int STYLED_LABEL_RESET_CERTIFICATE_DECISIONS = 1339;
const int LINK_COOKIE_DIALOG = 1340;
const int LINK_SITE_SETTINGS = 1341;
-// The default, ui::kTitleFontSizeDelta, is too large for the website settings
+// The default, ui::kTitleFontSizeDelta, is too large for the page info
// bubble (e.g. +3). Use +1 to obtain a smaller font.
constexpr int kSummaryFontSizeDelta = 1;
@@ -125,7 +124,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,8 +159,8 @@ class PopupHeaderView : public views::View {
DISALLOW_COPY_AND_ASSIGN(PopupHeaderView);
};
-// Website Settings are not supported for internal Chrome pages and extension
-// pages. Instead of the |WebsiteSettingsPopupView|, the
+// The regular PageInfoPopupView is not supported for internal Chrome pages and
+// extension pages. Instead of the |PageInfoPopupView|, the
// |InternalPageInfoPopupView| is displayed.
class InternalPageInfoPopupView : public views::BubbleDialogDelegateView {
public:
@@ -177,7 +176,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;
@@ -286,7 +285,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;
@@ -329,7 +328,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 {
@@ -337,13 +336,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,
@@ -364,7 +363,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);
@@ -372,12 +371,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,
@@ -394,7 +392,7 @@ WebsiteSettingsPopupView::WebsiteSettingsPopupView(
cookie_dialog_link_(nullptr),
permissions_view_(nullptr),
weak_factory_(this) {
- g_shown_popup_type = POPUP_WEBSITE_SETTINGS;
+ g_shown_popup_type = POPUP_PAGE_INFO;
set_parent_window(parent_window);
// Compensate for built-in vertical padding in the anchor view's image.
@@ -445,23 +443,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.
@@ -469,51 +467,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();
@@ -533,8 +530,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);
@@ -542,7 +538,7 @@ void WebsiteSettingsPopupView::SetCookieInfo(
for (const auto& i : cookie_info_list)
total_allowed += i.allowed;
base::string16 label_text = l10n_util::GetPluralStringFUTF16(
- IDS_WEBSITE_SETTINGS_NUM_COOKIES, total_allowed);
+ IDS_PAGE_INFO_NUM_COOKIES, total_allowed);
if (!cookie_dialog_link_) {
cookie_dialog_link_ = new views::Link(label_text);
@@ -570,14 +566,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,
@@ -586,7 +582,7 @@ void WebsiteSettingsPopupView::SetCookieInfo(
views::GridLayout::LEADING);
views::Label* cookies_label = new views::Label(
- l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_TITLE_SITE_DATA),
+ l10n_util::GetStringUTF16(IDS_PAGE_INFO_TITLE_SITE_DATA),
CONTEXT_BODY_TEXT_LARGE);
layout->AddView(cookies_label);
layout->StartRow(1, cookies_view_column);
@@ -601,13 +597,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;
@@ -674,9 +670,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;
@@ -695,7 +690,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);
@@ -710,7 +705,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;
@@ -724,13 +719,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::PAGE_INFO_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::PAGE_INFO_COOKIES_DIALOG_OPENED);
new CollectedCookiesViews(web_contents());
break;
default:
@@ -738,17 +733,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::PAGE_INFO_CONNECTION_HELP_OPENED);
break;
case STYLED_LABEL_RESET_CERTIFICATE_DECISIONS:
presenter_->OnRevokeSSLErrorBypassButtonPressed();

Powered by Google App Engine
This is Rietveld 408576698