OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "chrome/browser/chromeos/attestation/platform_verification_dialog.h" | 5 #include "chrome/browser/chromeos/attestation/platform_verification_dialog.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 base::string16 headline = l10n_util::GetStringFUTF16( | 80 base::string16 headline = l10n_util::GetStringFUTF16( |
81 IDS_PLATFORM_VERIFICATION_DIALOG_HEADLINE, domain_, learn_more, &offsets); | 81 IDS_PLATFORM_VERIFICATION_DIALOG_HEADLINE, domain_, learn_more, &offsets); |
82 views::StyledLabel* headline_label = new views::StyledLabel(headline, this); | 82 views::StyledLabel* headline_label = new views::StyledLabel(headline, this); |
83 headline_label->AddStyleRange( | 83 headline_label->AddStyleRange( |
84 gfx::Range(offsets[1], offsets[1] + learn_more.size()), | 84 gfx::Range(offsets[1], offsets[1] + learn_more.size()), |
85 views::StyledLabel::RangeStyleInfo::CreateForLink()); | 85 views::StyledLabel::RangeStyleInfo::CreateForLink()); |
86 AddChildView(headline_label); | 86 AddChildView(headline_label); |
87 } | 87 } |
88 | 88 |
89 bool PlatformVerificationDialog::Cancel() { | 89 bool PlatformVerificationDialog::Cancel() { |
90 // This method is called when user clicked "Disable on <origin>" button or | 90 // This method is called when user clicked "Block" button. |
91 // when user pressed the "Esc" key. See http://crbug.com/467155 | |
92 callback_.Run(CONSENT_RESPONSE_DENY); | 91 callback_.Run(CONSENT_RESPONSE_DENY); |
93 return true; | 92 return true; |
94 } | 93 } |
95 | 94 |
96 bool PlatformVerificationDialog::Accept() { | 95 bool PlatformVerificationDialog::Accept() { |
97 // This method is called when user clicked "OK, I got it" button. | 96 // This method is called when user clicked "Allow" button. |
98 callback_.Run(CONSENT_RESPONSE_ALLOW); | 97 callback_.Run(CONSENT_RESPONSE_ALLOW); |
99 return true; | 98 return true; |
100 } | 99 } |
101 | 100 |
102 bool PlatformVerificationDialog::Close() { | 101 bool PlatformVerificationDialog::Close() { |
103 // This method is called when user clicked "x" to dismiss the dialog, the | 102 // This method is called when user clicked "x" or pressed "Esc" to dismiss the |
104 // permission request is canceled, or when the tab containing this dialog is | 103 // dialog, the permission request is canceled, or when the tab containing this |
105 // closed. | 104 // dialog is closed. |
106 callback_.Run(CONSENT_RESPONSE_NONE); | 105 callback_.Run(CONSENT_RESPONSE_NONE); |
107 return true; | 106 return true; |
108 } | 107 } |
109 | 108 |
110 base::string16 PlatformVerificationDialog::GetDialogButtonLabel( | 109 base::string16 PlatformVerificationDialog::GetDialogButtonLabel( |
111 ui::DialogButton button) const { | 110 ui::DialogButton button) const { |
112 switch (button) { | 111 switch (button) { |
113 case ui::DIALOG_BUTTON_OK: | 112 case ui::DIALOG_BUTTON_OK: |
114 return l10n_util::GetStringUTF16(IDS_PERMISSION_ALLOW); | 113 return l10n_util::GetStringUTF16(IDS_PERMISSION_ALLOW); |
115 case ui::DIALOG_BUTTON_CANCEL: | 114 case ui::DIALOG_BUTTON_CANCEL: |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 void PlatformVerificationDialog::DidStartNavigationToPendingEntry( | 152 void PlatformVerificationDialog::DidStartNavigationToPendingEntry( |
154 const GURL& url, | 153 const GURL& url, |
155 content::ReloadType reload_type) { | 154 content::ReloadType reload_type) { |
156 views::Widget* widget = GetWidget(); | 155 views::Widget* widget = GetWidget(); |
157 if (widget) | 156 if (widget) |
158 widget->Close(); | 157 widget->Close(); |
159 } | 158 } |
160 | 159 |
161 } // namespace attestation | 160 } // namespace attestation |
162 } // namespace chromeos | 161 } // namespace chromeos |
OLD | NEW |