OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #import "chrome/browser/ui/cocoa/website_settings/website_settings_bubble_contro
ller.h" | 5 #import "chrome/browser/ui/cocoa/website_settings/website_settings_bubble_contro
ller.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #import <AppKit/AppKit.h> | 9 #import <AppKit/AppKit.h> |
10 | 10 |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 toView:contentView]; | 515 toView:contentView]; |
516 [cookiesButton_ setTarget:self]; | 516 [cookiesButton_ setTarget:self]; |
517 [cookiesButton_ setAction:@selector(showCookiesAndSiteData:)]; | 517 [cookiesButton_ setAction:@selector(showCookiesAndSiteData:)]; |
518 | 518 |
519 return contentView.get(); | 519 return contentView.get(); |
520 } | 520 } |
521 | 521 |
522 // Handler for the link button below the list of cookies. | 522 // Handler for the link button below the list of cookies. |
523 - (void)showCookiesAndSiteData:(id)sender { | 523 - (void)showCookiesAndSiteData:(id)sender { |
524 DCHECK(webContents_); | 524 DCHECK(webContents_); |
525 content::RecordAction( | 525 presenter_->RecordWebsiteSettingsAction( |
526 base::UserMetricsAction("WebsiteSettings_CookiesDialogOpened")); | 526 WebsiteSettings::WEBSITE_SETTINGS_COOKIES_DIALOG_OPENED); |
527 chrome::ShowCollectedCookiesDialog(webContents_); | 527 chrome::ShowCollectedCookiesDialog(webContents_); |
528 } | 528 } |
529 | 529 |
530 // Handler for the link button to show certificate information. | 530 // Handler for the link button to show certificate information. |
531 - (void)showCertificateInfo:(id)sender { | 531 - (void)showCertificateInfo:(id)sender { |
532 DCHECK(certificateId_); | 532 DCHECK(certificateId_); |
| 533 presenter_->RecordWebsiteSettingsAction( |
| 534 WebsiteSettings::WEBSITE_SETTINGS_CERTIFICATE_DIALOG_OPENED); |
533 ShowCertificateViewerByID(webContents_, [self parentWindow], certificateId_); | 535 ShowCertificateViewerByID(webContents_, [self parentWindow], certificateId_); |
534 } | 536 } |
535 | 537 |
536 // Handler for the link button to revoke user certificate decisions. | 538 // Handler for the link button to revoke user certificate decisions. |
537 - (void)resetCertificateDecisions:(id)sender { | 539 - (void)resetCertificateDecisions:(id)sender { |
538 DCHECK(resetDecisionsButton_); | 540 DCHECK(resetDecisionsButton_); |
539 presenter_->OnRevokeSSLErrorBypassButtonPressed(); | 541 presenter_->OnRevokeSSLErrorBypassButtonPressed(); |
540 [self close]; | 542 [self close]; |
541 } | 543 } |
542 | 544 |
543 // Handler for the link to show help information about the connection tab. | 545 // Handler for the link to show help information about the connection tab. |
544 - (void)showHelpPage:(id)sender { | 546 - (void)showHelpPage:(id)sender { |
| 547 presenter_->RecordWebsiteSettingsAction( |
| 548 WebsiteSettings::WEBSITE_SETTINGS_CONNECTION_HELP_OPENED); |
545 webContents_->OpenURL(content::OpenURLParams( | 549 webContents_->OpenURL(content::OpenURLParams( |
546 GURL(chrome::kPageInfoHelpCenterURL), content::Referrer(), | 550 GURL(chrome::kPageInfoHelpCenterURL), content::Referrer(), |
547 NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK, false)); | 551 NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK, false)); |
548 } | 552 } |
549 | 553 |
550 // Create the contents of the Connection tab and add it to the given tab view. | 554 // Create the contents of the Connection tab and add it to the given tab view. |
551 // Returns a weak reference to the tab view item's view. | 555 // Returns a weak reference to the tab view item's view. |
552 - (NSView*)addConnectionTabToTabView:(NSTabView*)tabView { | 556 - (NSView*)addConnectionTabToTabView:(NSTabView*)tabView { |
553 base::scoped_nsobject<NSTabViewItem> item([[NSTabViewItem alloc] init]); | 557 base::scoped_nsobject<NSTabViewItem> item([[NSTabViewItem alloc] init]); |
554 base::scoped_nsobject<NSView> contentView( | 558 base::scoped_nsobject<NSView> contentView( |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
932 | 936 |
933 // Called when the user changes the setting of a permission. | 937 // Called when the user changes the setting of a permission. |
934 - (void)onPermissionChanged:(ContentSettingsType)permissionType | 938 - (void)onPermissionChanged:(ContentSettingsType)permissionType |
935 to:(ContentSetting)newSetting { | 939 to:(ContentSetting)newSetting { |
936 if (presenter_) | 940 if (presenter_) |
937 presenter_->OnSitePermissionChanged(permissionType, newSetting); | 941 presenter_->OnSitePermissionChanged(permissionType, newSetting); |
938 } | 942 } |
939 | 943 |
940 // Called when the user changes the selected segment in the segmented control. | 944 // Called when the user changes the selected segment in the segmented control. |
941 - (void)tabSelected:(id)sender { | 945 - (void)tabSelected:(id)sender { |
942 [tabView_ selectTabViewItemAtIndex:[segmentedControl_ selectedSegment]]; | 946 NSInteger index = [segmentedControl_ selectedSegment]; |
| 947 switch (index) { |
| 948 case WebsiteSettingsUI::TAB_ID_PERMISSIONS: |
| 949 presenter_->RecordWebsiteSettingsAction( |
| 950 WebsiteSettings::WEBSITE_SETTINGS_PERMISSIONS_TAB_SELECTED); |
| 951 break; |
| 952 case WebsiteSettingsUI::TAB_ID_CONNECTION: |
| 953 presenter_->RecordWebsiteSettingsAction( |
| 954 WebsiteSettings::WEBSITE_SETTINGS_CONNECTION_TAB_SELECTED); |
| 955 break; |
| 956 default: |
| 957 NOTREACHED(); |
| 958 } |
| 959 [tabView_ selectTabViewItemAtIndex:index]; |
943 } | 960 } |
944 | 961 |
945 // Adds a new row to the UI listing the permissions. Returns the amount of | 962 // Adds a new row to the UI listing the permissions. Returns the amount of |
946 // vertical space that was taken up by the row. | 963 // vertical space that was taken up by the row. |
947 - (NSPoint)addPermission: | 964 - (NSPoint)addPermission: |
948 (const WebsiteSettingsUI::PermissionInfo&)permissionInfo | 965 (const WebsiteSettingsUI::PermissionInfo&)permissionInfo |
949 toView:(NSView*)view | 966 toView:(NSView*)view |
950 atPoint:(NSPoint)point { | 967 atPoint:(NSPoint)point { |
951 base::scoped_nsobject<NSImage> image( | 968 base::scoped_nsobject<NSImage> image( |
952 [WebsiteSettingsUI::GetPermissionIcon(permissionInfo).ToNSImage() | 969 [WebsiteSettingsUI::GetPermissionIcon(permissionInfo).ToNSImage() |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1237 [bubble_controller_ setPermissionInfo:permission_info_list]; | 1254 [bubble_controller_ setPermissionInfo:permission_info_list]; |
1238 } | 1255 } |
1239 | 1256 |
1240 void WebsiteSettingsUIBridge::SetFirstVisit(const base::string16& first_visit) { | 1257 void WebsiteSettingsUIBridge::SetFirstVisit(const base::string16& first_visit) { |
1241 [bubble_controller_ setFirstVisit:first_visit]; | 1258 [bubble_controller_ setFirstVisit:first_visit]; |
1242 } | 1259 } |
1243 | 1260 |
1244 void WebsiteSettingsUIBridge::SetSelectedTab(TabId tab_id) { | 1261 void WebsiteSettingsUIBridge::SetSelectedTab(TabId tab_id) { |
1245 [bubble_controller_ setSelectedTab:tab_id]; | 1262 [bubble_controller_ setSelectedTab:tab_id]; |
1246 } | 1263 } |
OLD | NEW |