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 #import <AppKit/AppKit.h> | 7 #import <AppKit/AppKit.h> |
8 | 8 |
9 #include <cmath> | 9 #include <cmath> |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... |
26 #import "chrome/browser/ui/tab_dialogs.h" | 26 #import "chrome/browser/ui/tab_dialogs.h" |
27 #include "chrome/browser/ui/website_settings/permission_menu_model.h" | 27 #include "chrome/browser/ui/website_settings/permission_menu_model.h" |
28 #include "chrome/common/pref_names.h" | 28 #include "chrome/common/pref_names.h" |
29 #include "chrome/common/url_constants.h" | 29 #include "chrome/common/url_constants.h" |
30 #include "chrome/grit/chromium_strings.h" | 30 #include "chrome/grit/chromium_strings.h" |
31 #include "chrome/grit/generated_resources.h" | 31 #include "chrome/grit/generated_resources.h" |
32 #include "chrome/grit/theme_resources.h" | 32 #include "chrome/grit/theme_resources.h" |
33 #include "components/prefs/pref_service.h" | 33 #include "components/prefs/pref_service.h" |
34 #include "components/strings/grit/components_chromium_strings.h" | 34 #include "components/strings/grit/components_chromium_strings.h" |
35 #include "components/strings/grit/components_strings.h" | 35 #include "components/strings/grit/components_strings.h" |
36 #include "content/public/browser/cert_store.h" | |
37 #include "content/public/browser/page_navigator.h" | 36 #include "content/public/browser/page_navigator.h" |
38 #include "content/public/browser/ssl_host_state_delegate.h" | 37 #include "content/public/browser/ssl_host_state_delegate.h" |
39 #include "content/public/browser/user_metrics.h" | 38 #include "content/public/browser/user_metrics.h" |
40 #include "content/public/browser/web_contents.h" | 39 #include "content/public/browser/web_contents.h" |
41 #include "content/public/common/url_constants.h" | 40 #include "content/public/common/url_constants.h" |
42 #include "extensions/common/constants.h" | 41 #include "extensions/common/constants.h" |
43 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutTw
eaker.h" | 42 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutTw
eaker.h" |
44 #include "ui/base/cocoa/cocoa_base_utils.h" | 43 #include "ui/base/cocoa/cocoa_base_utils.h" |
45 #import "ui/base/cocoa/controls/hyperlink_button_cell.h" | 44 #import "ui/base/cocoa/controls/hyperlink_button_cell.h" |
46 #import "ui/base/cocoa/flipped_view.h" | 45 #import "ui/base/cocoa/flipped_view.h" |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 if (isDevToolsDisabled_) { | 416 if (isDevToolsDisabled_) { |
418 [self showCertificateInfo:sender]; | 417 [self showCertificateInfo:sender]; |
419 } else { | 418 } else { |
420 DevToolsWindow::OpenDevToolsWindow( | 419 DevToolsWindow::OpenDevToolsWindow( |
421 webContents_, DevToolsToggleAction::ShowSecurityPanel()); | 420 webContents_, DevToolsToggleAction::ShowSecurityPanel()); |
422 } | 421 } |
423 } | 422 } |
424 | 423 |
425 // Handler for the link button to show certificate information. | 424 // Handler for the link button to show certificate information. |
426 - (void)showCertificateInfo:(id)sender { | 425 - (void)showCertificateInfo:(id)sender { |
427 DCHECK(certificateId_); | 426 DCHECK(certificate_.get()); |
428 DCHECK(presenter_); | 427 DCHECK(presenter_); |
429 presenter_->RecordWebsiteSettingsAction( | 428 presenter_->RecordWebsiteSettingsAction( |
430 WebsiteSettings::WEBSITE_SETTINGS_CERTIFICATE_DIALOG_OPENED); | 429 WebsiteSettings::WEBSITE_SETTINGS_CERTIFICATE_DIALOG_OPENED); |
431 ShowCertificateViewerByID(webContents_, [self parentWindow], certificateId_); | 430 ShowCertificateViewer(webContents_, [self parentWindow], certificate_.get()); |
432 } | 431 } |
433 | 432 |
434 // Handler for the link button to revoke user certificate decisions. | 433 // Handler for the link button to revoke user certificate decisions. |
435 - (void)resetCertificateDecisions:(id)sender { | 434 - (void)resetCertificateDecisions:(id)sender { |
436 DCHECK(resetDecisionsButton_); | 435 DCHECK(resetDecisionsButton_); |
437 presenter_->OnRevokeSSLErrorBypassButtonPressed(); | 436 presenter_->OnRevokeSSLErrorBypassButtonPressed(); |
438 [self close]; | 437 [self close]; |
439 } | 438 } |
440 | 439 |
441 // Set the Y position of |view| to the given position, and return the position | 440 // Set the Y position of |view| to the given position, and return the position |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 CGFloat yPos = 0; | 487 CGFloat yPos = 0; |
489 | 488 |
490 [self sizeTextFieldHeightToFit:identityField_]; | 489 [self sizeTextFieldHeightToFit:identityField_]; |
491 yPos = [self setYPositionOfView:identityField_ | 490 yPos = [self setYPositionOfView:identityField_ |
492 to:yPos + kSectionVerticalPadding]; | 491 to:yPos + kSectionVerticalPadding]; |
493 | 492 |
494 [self sizeTextFieldHeightToFit:securitySummaryField_]; | 493 [self sizeTextFieldHeightToFit:securitySummaryField_]; |
495 yPos = [self setYPositionOfView:securitySummaryField_ | 494 yPos = [self setYPositionOfView:securitySummaryField_ |
496 to:yPos + kSpacingBeforeSecuritySummary]; | 495 to:yPos + kSpacingBeforeSecuritySummary]; |
497 | 496 |
498 if (isDevToolsDisabled_ && certificateId_ == 0) { | 497 if (isDevToolsDisabled_ && !certificate_) { |
499 // -removeFromSuperview is idempotent. | 498 // -removeFromSuperview is idempotent. |
500 [securityDetailsButton_ removeFromSuperview]; | 499 [securityDetailsButton_ removeFromSuperview]; |
501 } else { | 500 } else { |
502 // -addSubview is idempotent. | 501 // -addSubview is idempotent. |
503 [securitySectionView_ addSubview:securityDetailsButton_]; | 502 [securitySectionView_ addSubview:securityDetailsButton_]; |
504 yPos = [self setYPositionOfView:securityDetailsButton_ to:yPos]; | 503 yPos = [self setYPositionOfView:securityDetailsButton_ to:yPos]; |
505 } | 504 } |
506 | 505 |
507 if (resetDecisionsButton_) { | 506 if (resetDecisionsButton_) { |
508 yPos = [self setYPositionOfView:resetDecisionsButton_ | 507 yPos = [self setYPositionOfView:resetDecisionsButton_ |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 return button.get(); | 675 return button.get(); |
677 } | 676 } |
678 | 677 |
679 // Set the content of the identity and identity status fields. | 678 // Set the content of the identity and identity status fields. |
680 - (void)setIdentityInfo:(const WebsiteSettingsUI::IdentityInfo&)identityInfo { | 679 - (void)setIdentityInfo:(const WebsiteSettingsUI::IdentityInfo&)identityInfo { |
681 [identityField_ | 680 [identityField_ |
682 setStringValue:base::SysUTF8ToNSString(identityInfo.site_identity)]; | 681 setStringValue:base::SysUTF8ToNSString(identityInfo.site_identity)]; |
683 [securitySummaryField_ setStringValue:base::SysUTF16ToNSString( | 682 [securitySummaryField_ setStringValue:base::SysUTF16ToNSString( |
684 identityInfo.GetSecuritySummary())]; | 683 identityInfo.GetSecuritySummary())]; |
685 | 684 |
686 certificateId_ = identityInfo.cert_id; | 685 certificate_ = identityInfo.certificate; |
687 | 686 |
688 if (certificateId_ && identityInfo.show_ssl_decision_revoke_button) { | 687 if (certificate_ && identityInfo.show_ssl_decision_revoke_button) { |
689 NSString* text = l10n_util::GetNSString( | 688 NSString* text = l10n_util::GetNSString( |
690 IDS_PAGEINFO_RESET_INVALID_CERTIFICATE_DECISIONS_BUTTON); | 689 IDS_PAGEINFO_RESET_INVALID_CERTIFICATE_DECISIONS_BUTTON); |
691 resetDecisionsButton_ = | 690 resetDecisionsButton_ = |
692 [self addButtonWithText:text toView:securitySectionView_]; | 691 [self addButtonWithText:text toView:securitySectionView_]; |
693 [resetDecisionsButton_ setTarget:self]; | 692 [resetDecisionsButton_ setTarget:self]; |
694 [resetDecisionsButton_ setAction:@selector(resetCertificateDecisions:)]; | 693 [resetDecisionsButton_ setAction:@selector(resetCertificateDecisions:)]; |
695 } | 694 } |
696 | 695 |
697 [self performLayout]; | 696 [self performLayout]; |
698 } | 697 } |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1175 webContents:web_contents | 1174 webContents:web_contents |
1176 url:virtual_url | 1175 url:virtual_url |
1177 isDevToolsDisabled:is_devtools_disabled]; | 1176 isDevToolsDisabled:is_devtools_disabled]; |
1178 | 1177 |
1179 if (!IsInternalURL(virtual_url)) { | 1178 if (!IsInternalURL(virtual_url)) { |
1180 // Initialize the presenter, which holds the model and controls the UI. | 1179 // Initialize the presenter, which holds the model and controls the UI. |
1181 // This is also owned by the bubble controller. | 1180 // This is also owned by the bubble controller. |
1182 WebsiteSettings* presenter = new WebsiteSettings( | 1181 WebsiteSettings* presenter = new WebsiteSettings( |
1183 bridge, profile, | 1182 bridge, profile, |
1184 TabSpecificContentSettings::FromWebContents(web_contents), web_contents, | 1183 TabSpecificContentSettings::FromWebContents(web_contents), web_contents, |
1185 virtual_url, security_info, content::CertStore::GetInstance()); | 1184 virtual_url, security_info); |
1186 [bubble_controller setPresenter:presenter]; | 1185 [bubble_controller setPresenter:presenter]; |
1187 } | 1186 } |
1188 | 1187 |
1189 [bubble_controller showWindow:nil]; | 1188 [bubble_controller showWindow:nil]; |
1190 } | 1189 } |
1191 | 1190 |
1192 void WebsiteSettingsUIBridge::SetIdentityInfo( | 1191 void WebsiteSettingsUIBridge::SetIdentityInfo( |
1193 const WebsiteSettingsUI::IdentityInfo& identity_info) { | 1192 const WebsiteSettingsUI::IdentityInfo& identity_info) { |
1194 [bubble_controller_ setIdentityInfo:identity_info]; | 1193 [bubble_controller_ setIdentityInfo:identity_info]; |
1195 } | 1194 } |
(...skipping 13 matching lines...) Expand all Loading... |
1209 void WebsiteSettingsUIBridge::SetPermissionInfo( | 1208 void WebsiteSettingsUIBridge::SetPermissionInfo( |
1210 const PermissionInfoList& permission_info_list, | 1209 const PermissionInfoList& permission_info_list, |
1211 const ChosenObjectInfoList& chosen_object_info_list) { | 1210 const ChosenObjectInfoList& chosen_object_info_list) { |
1212 [bubble_controller_ setPermissionInfo:permission_info_list | 1211 [bubble_controller_ setPermissionInfo:permission_info_list |
1213 andChosenObjects:chosen_object_info_list]; | 1212 andChosenObjects:chosen_object_info_list]; |
1214 } | 1213 } |
1215 | 1214 |
1216 void WebsiteSettingsUIBridge::SetSelectedTab(TabId tab_id) { | 1215 void WebsiteSettingsUIBridge::SetSelectedTab(TabId tab_id) { |
1217 // TODO(lgarron): Remove this from the interface. (crbug.com/571533) | 1216 // TODO(lgarron): Remove this from the interface. (crbug.com/571533) |
1218 } | 1217 } |
OLD | NEW |