Index: chrome/browser/ui/cocoa/page_info/page_info_bubble_controller.mm |
diff --git a/chrome/browser/ui/cocoa/page_info/website_settings_bubble_controller.mm b/chrome/browser/ui/cocoa/page_info/page_info_bubble_controller.mm |
similarity index 91% |
rename from chrome/browser/ui/cocoa/page_info/website_settings_bubble_controller.mm |
rename to chrome/browser/ui/cocoa/page_info/page_info_bubble_controller.mm |
index d16b1e47574bd36123817ea93160cbfa9e28c06c..a86a1934953eee48a40d820913670921ea481193 100644 |
--- a/chrome/browser/ui/cocoa/page_info/website_settings_bubble_controller.mm |
+++ b/chrome/browser/ui/cocoa/page_info/page_info_bubble_controller.mm |
@@ -2,7 +2,7 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#import "chrome/browser/ui/cocoa/page_info/website_settings_bubble_controller.h" |
+#import "chrome/browser/ui/cocoa/page_info/page_info_bubble_controller.h" |
#import <AppKit/AppKit.h> |
@@ -49,10 +49,9 @@ |
#include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" |
#include "ui/resources/grit/ui_resources.h" |
-using ChosenObjectInfoPtr = |
- std::unique_ptr<WebsiteSettingsUI::ChosenObjectInfo>; |
+using ChosenObjectInfoPtr = std::unique_ptr<PageInfoUI::ChosenObjectInfo>; |
using ChosenObjectDeleteCallback = |
- base::Callback<void(const WebsiteSettingsUI::ChosenObjectInfo&)>; |
+ base::Callback<void(const PageInfoUI::ChosenObjectInfo&)>; |
namespace { |
@@ -113,9 +112,9 @@ const CGFloat kInternalPageImageSpacing = 10; |
// ----------------------------------------------------------------------------- |
-// NOTE: This assumes that there will never be more than one website settings |
+// NOTE: This assumes that there will never be more than one page info |
// popup shown, and that the one that is shown is associated with the current |
-// window. This matches the behaviour in views: see WebsiteSettingsPopupView. |
+// window. This matches the behaviour in views: see PageInfoPopupView. |
bool g_is_popup_showing = false; |
// Takes in the parent window, which should be a BrowserWindow, and gets the |
@@ -181,7 +180,7 @@ NSPoint AnchorPointForWindow(NSWindow* parent) { |
@end |
-@implementation WebsiteSettingsBubbleController |
+@implementation PageInfoBubbleController |
- (CGFloat)defaultWindowWidth { |
return kDefaultWindowWidth; |
@@ -195,9 +194,9 @@ bool IsInternalURL(const GURL& url) { |
} |
- (id)initWithParentWindow:(NSWindow*)parentWindow |
- websiteSettingsUIBridge:(WebsiteSettingsUIBridge*)bridge |
- webContents:(content::WebContents*)webContents |
- url:(const GURL&)url { |
+ pageInfoUIBridge:(PageInfoUIBridge*)bridge |
+ webContents:(content::WebContents*)webContents |
+ url:(const GURL&)url { |
DCHECK(parentWindow); |
webContents_ = webContents; |
@@ -255,7 +254,7 @@ bool IsInternalURL(const GURL& url) { |
[super windowWillClose:notification]; |
} |
-- (void)setPresenter:(WebsiteSettings*)presenter { |
+- (void)setPresenter:(PageInfo*)presenter { |
presenter_.reset(presenter); |
} |
@@ -311,7 +310,7 @@ bool IsInternalURL(const GURL& url) { |
[self sizeAndPositionWindow]; |
} |
-// Create the subviews for the website settings bubble. |
+// Create the subviews for the page info bubble. |
- (void)initializeContents { |
securitySectionView_ = [self addSecuritySectionToView:contentView_]; |
separatorAfterSecuritySection_ = [self addSeparatorToView:contentView_]; |
@@ -393,8 +392,7 @@ bool IsInternalURL(const GURL& url) { |
- (void)showCookiesAndSiteData:(id)sender { |
DCHECK(webContents_); |
DCHECK(presenter_); |
- presenter_->RecordWebsiteSettingsAction( |
- WebsiteSettings::WEBSITE_SETTINGS_COOKIES_DIALOG_OPENED); |
+ presenter_->RecordPageInfoAction(PageInfo::PAGE_INFO_COOKIES_DIALOG_OPENED); |
TabDialogs::FromWebContents(webContents_)->ShowCollectedCookies(); |
} |
@@ -402,8 +400,7 @@ bool IsInternalURL(const GURL& url) { |
- (void)showSiteSettingsData:(id)sender { |
DCHECK(webContents_); |
DCHECK(presenter_); |
- presenter_->RecordWebsiteSettingsAction( |
- WebsiteSettings::WEBSITE_SETTINGS_SITE_SETTINGS_OPENED); |
+ presenter_->RecordPageInfoAction(PageInfo::PAGE_INFO_SITE_SETTINGS_OPENED); |
webContents_->OpenURL(content::OpenURLParams( |
GURL(chrome::kChromeUIContentSettingsURL), content::Referrer(), |
WindowOpenDisposition::NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK, |
@@ -415,8 +412,7 @@ bool IsInternalURL(const GURL& url) { |
- (void)openConnectionHelp:(id)sender { |
DCHECK(webContents_); |
DCHECK(presenter_); |
- presenter_->RecordWebsiteSettingsAction( |
- WebsiteSettings::WEBSITE_SETTINGS_CONNECTION_HELP_OPENED); |
+ presenter_->RecordPageInfoAction(PageInfo::PAGE_INFO_CONNECTION_HELP_OPENED); |
webContents_->OpenURL(content::OpenURLParams( |
GURL(chrome::kPageInfoHelpCenterURL), content::Referrer(), |
WindowOpenDisposition::NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK, |
@@ -427,8 +423,8 @@ bool IsInternalURL(const GURL& url) { |
- (void)showCertificateInfo:(id)sender { |
DCHECK(certificate_.get()); |
DCHECK(presenter_); |
- presenter_->RecordWebsiteSettingsAction( |
- WebsiteSettings::WEBSITE_SETTINGS_CERTIFICATE_DIALOG_OPENED); |
+ presenter_->RecordPageInfoAction( |
+ PageInfo::PAGE_INFO_CERTIFICATE_DIALOG_OPENED); |
ShowCertificateViewer(webContents_, [self parentWindow], certificate_.get()); |
} |
@@ -687,8 +683,8 @@ bool IsInternalURL(const GURL& url) { |
} |
// Set the content of the identity and identity status fields. |
-- (void)setIdentityInfo:(const WebsiteSettingsUI::IdentityInfo&)identityInfo { |
- std::unique_ptr<WebsiteSettingsUI::SecurityDescription> security_description = |
+- (void)setIdentityInfo:(const PageInfoUI::IdentityInfo&)identityInfo { |
+ std::unique_ptr<PageInfoUI::SecurityDescription> security_description = |
identityInfo.GetSecurityDescription(); |
[securitySummaryField_ |
setStringValue:base::SysUTF16ToNSString(security_description->summary)]; |
@@ -724,13 +720,13 @@ bool IsInternalURL(const GURL& url) { |
// Add a pop-up button for |permissionInfo| to the given view. |
- (NSPopUpButton*)addPopUpButtonForPermission: |
- (const WebsiteSettingsUI::PermissionInfo&)permissionInfo |
+ (const PageInfoUI::PermissionInfo&)permissionInfo |
toView:(NSView*)view |
atPoint:(NSPoint)point { |
GURL url = webContents_ ? webContents_->GetURL() : GURL(); |
- __block WebsiteSettingsBubbleController* weakSelf = self; |
+ __block PageInfoBubbleController* weakSelf = self; |
PermissionMenuModel::ChangeCallback callback = |
- base::BindBlock(^(const WebsiteSettingsUI::PermissionInfo& permission) { |
+ base::BindBlock(^(const PageInfoUI::PermissionInfo& permission) { |
[weakSelf onPermissionChanged:permission.type to:permission.setting]; |
}); |
base::scoped_nsobject<PermissionSelectorButton> button( |
@@ -760,9 +756,9 @@ bool IsInternalURL(const GURL& url) { |
- (NSButton*)addDeleteButtonForChosenObject:(ChosenObjectInfoPtr)objectInfo |
toView:(NSView*)view |
atPoint:(NSPoint)point { |
- __block WebsiteSettingsBubbleController* weakSelf = self; |
+ __block PageInfoBubbleController* weakSelf = self; |
auto callback = |
- base::BindBlock(^(const WebsiteSettingsUI::ChosenObjectInfo& objectInfo) { |
+ base::BindBlock(^(const PageInfoUI::ChosenObjectInfo& objectInfo) { |
[weakSelf onChosenObjectDeleted:objectInfo]; |
}); |
base::scoped_nsobject<ChosenObjectDeleteButton> button( |
@@ -789,7 +785,7 @@ bool IsInternalURL(const GURL& url) { |
} |
// Called when the user revokes permission for a previously chosen object. |
-- (void)onChosenObjectDeleted:(const WebsiteSettingsUI::ChosenObjectInfo&)info { |
+- (void)onChosenObjectDeleted:(const PageInfoUI::ChosenObjectInfo&)info { |
if (presenter_) |
presenter_->OnSiteChosenObjectDeleted(info.ui_info, *info.object); |
} |
@@ -797,16 +793,14 @@ bool IsInternalURL(const GURL& url) { |
// Adds a new row to the UI listing the permissions. Returns the NSPoint of the |
// last UI element added (either the permission button, in LTR, or the text |
// label, in RTL). |
-- (NSPoint)addPermission: |
- (const WebsiteSettingsUI::PermissionInfo&)permissionInfo |
+- (NSPoint)addPermission:(const PageInfoUI::PermissionInfo&)permissionInfo |
toView:(NSView*)view |
atPoint:(NSPoint)point { |
base::string16 labelText = |
- WebsiteSettingsUI::PermissionTypeToUIString(permissionInfo.type); |
+ PageInfoUI::PermissionTypeToUIString(permissionInfo.type); |
bool isRTL = base::i18n::IsRTL(); |
base::scoped_nsobject<NSImage> image( |
- [WebsiteSettingsUI::GetPermissionIcon(permissionInfo) |
- .ToNSImage() retain]); |
+ [PageInfoUI::GetPermissionIcon(permissionInfo).ToNSImage() retain]); |
NSPoint position; |
NSImageView* imageView; |
@@ -918,11 +912,10 @@ bool IsInternalURL(const GURL& url) { |
atPoint:(NSPoint)point { |
base::string16 labelText = l10n_util::GetStringFUTF16( |
objectInfo->ui_info.label_string_id, |
- WebsiteSettingsUI::ChosenObjectToUIString(*objectInfo)); |
+ PageInfoUI::ChosenObjectToUIString(*objectInfo)); |
bool isRTL = base::i18n::IsRTL(); |
base::scoped_nsobject<NSImage> image( |
- [WebsiteSettingsUI::GetChosenObjectIcon(*objectInfo, false) |
- .ToNSImage() retain]); |
+ [PageInfoUI::GetChosenObjectIcon(*objectInfo, false).ToNSImage() retain]); |
NSPoint position; |
NSImageView* imageView; |
@@ -1010,11 +1003,11 @@ bool IsInternalURL(const GURL& url) { |
for (const auto& i : cookieInfoList) { |
totalAllowed += i.allowed; |
} |
- base::string16 label_text = l10n_util::GetPluralStringFUTF16( |
- IDS_WEBSITE_SETTINGS_NUM_COOKIES, totalAllowed); |
+ base::string16 label_text = |
+ l10n_util::GetPluralStringFUTF16(IDS_PAGE_INFO_NUM_COOKIES, totalAllowed); |
base::string16 sectionTitle = |
- l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_TITLE_SITE_DATA); |
+ l10n_util::GetStringUTF16(IDS_PAGE_INFO_TITLE_SITE_DATA); |
bool isRTL = base::i18n::IsRTL(); |
[cookiesView_ setSubviews:[NSArray array]]; |
@@ -1028,12 +1021,12 @@ bool IsInternalURL(const GURL& url) { |
kPermissionImageSpacing - kSectionHorizontalPadding; |
} |
- WebsiteSettingsUI::PermissionInfo info; |
+ PageInfoUI::PermissionInfo info; |
info.type = CONTENT_SETTINGS_TYPE_COOKIES; |
info.setting = CONTENT_SETTING_ALLOW; |
// info.default_setting, info.source, and info.is_incognito have not been set, |
// but GetPermissionIcon doesn't use any of those. |
- NSImage* image = WebsiteSettingsUI::GetPermissionIcon(info).ToNSImage(); |
+ NSImage* image = PageInfoUI::GetPermissionIcon(info).ToNSImage(); |
NSImageView* imageView = [self addImageWithSize:[image size] |
toView:cookiesView_ |
atPoint:controlOrigin]; |
@@ -1099,7 +1092,7 @@ bool IsInternalURL(const GURL& url) { |
if (permissionInfoList.size() > 0 || chosenObjectInfoList.size() > 0) { |
base::string16 sectionTitle = |
- l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_TITLE_SITE_PERMISSIONS); |
+ l10n_util::GetStringUTF16(IDS_PAGE_INFO_TITLE_SITE_PERMISSIONS); |
for (const auto& permission : permissionInfoList) { |
controlOrigin.y += kPermissionsVerticalSpacing; |
@@ -1127,8 +1120,7 @@ bool IsInternalURL(const GURL& url) { |
@end |
-WebsiteSettingsUIBridge::WebsiteSettingsUIBridge( |
- content::WebContents* web_contents) |
+PageInfoUIBridge::PageInfoUIBridge(content::WebContents* web_contents) |
: content::WebContentsObserver(web_contents), |
web_contents_(web_contents), |
bubble_controller_(nil) { |
@@ -1136,24 +1128,23 @@ WebsiteSettingsUIBridge::WebsiteSettingsUIBridge( |
g_is_popup_showing = true; |
} |
-WebsiteSettingsUIBridge::~WebsiteSettingsUIBridge() { |
+PageInfoUIBridge::~PageInfoUIBridge() { |
DCHECK(g_is_popup_showing); |
g_is_popup_showing = false; |
} |
-void WebsiteSettingsUIBridge::set_bubble_controller( |
- WebsiteSettingsBubbleController* controller) { |
+void PageInfoUIBridge::set_bubble_controller( |
+ PageInfoBubbleController* controller) { |
bubble_controller_ = controller; |
} |
-void WebsiteSettingsUIBridge::Show( |
- gfx::NativeWindow parent, |
- Profile* profile, |
- content::WebContents* web_contents, |
- const GURL& virtual_url, |
- const security_state::SecurityInfo& security_info) { |
+void PageInfoUIBridge::Show(gfx::NativeWindow parent, |
+ Profile* profile, |
+ content::WebContents* web_contents, |
+ const GURL& virtual_url, |
+ const security_state::SecurityInfo& security_info) { |
if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { |
- chrome::ShowWebsiteSettingsBubbleViewsAtPoint( |
+ chrome::ShowPageInfoBubbleViewsAtPoint( |
gfx::ScreenPointFromNSPoint(AnchorPointForWindow(parent)), profile, |
web_contents, virtual_url, security_info); |
return; |
@@ -1166,47 +1157,46 @@ void WebsiteSettingsUIBridge::Show( |
return; |
// Create the bridge. This will be owned by the bubble controller. |
- WebsiteSettingsUIBridge* bridge = new WebsiteSettingsUIBridge(web_contents); |
+ PageInfoUIBridge* bridge = new PageInfoUIBridge(web_contents); |
// Create the bubble controller. It will dealloc itself when it closes, |
// resetting |g_is_popup_showing|. |
- WebsiteSettingsBubbleController* bubble_controller = [ |
- [WebsiteSettingsBubbleController alloc] initWithParentWindow:parent |
- websiteSettingsUIBridge:bridge |
- webContents:web_contents |
- url:virtual_url]; |
+ PageInfoBubbleController* bubble_controller = |
+ [[PageInfoBubbleController alloc] initWithParentWindow:parent |
+ pageInfoUIBridge:bridge |
+ webContents:web_contents |
+ url:virtual_url]; |
if (!IsInternalURL(virtual_url)) { |
// Initialize the presenter, which holds the model and controls the UI. |
// This is also owned by the bubble controller. |
- WebsiteSettings* presenter = new WebsiteSettings( |
- bridge, profile, |
- TabSpecificContentSettings::FromWebContents(web_contents), web_contents, |
- virtual_url, security_info); |
+ PageInfo* presenter = |
+ new PageInfo(bridge, profile, |
+ TabSpecificContentSettings::FromWebContents(web_contents), |
+ web_contents, virtual_url, security_info); |
[bubble_controller setPresenter:presenter]; |
} |
[bubble_controller showWindow:nil]; |
} |
-void WebsiteSettingsUIBridge::SetIdentityInfo( |
- const WebsiteSettingsUI::IdentityInfo& identity_info) { |
+void PageInfoUIBridge::SetIdentityInfo( |
+ const PageInfoUI::IdentityInfo& identity_info) { |
[bubble_controller_ setIdentityInfo:identity_info]; |
} |
-void WebsiteSettingsUIBridge::RenderFrameDeleted( |
+void PageInfoUIBridge::RenderFrameDeleted( |
content::RenderFrameHost* render_frame_host) { |
if (render_frame_host == web_contents_->GetMainFrame()) { |
[bubble_controller_ close]; |
} |
} |
-void WebsiteSettingsUIBridge::SetCookieInfo( |
- const CookieInfoList& cookie_info_list) { |
+void PageInfoUIBridge::SetCookieInfo(const CookieInfoList& cookie_info_list) { |
[bubble_controller_ setCookieInfo:cookie_info_list]; |
} |
-void WebsiteSettingsUIBridge::SetPermissionInfo( |
+void PageInfoUIBridge::SetPermissionInfo( |
const PermissionInfoList& permission_info_list, |
ChosenObjectInfoList chosen_object_info_list) { |
[bubble_controller_ setPermissionInfo:permission_info_list |