| 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" |
| 11 #include "chrome/browser/ui/browser_dialogs.h" |
| 11 #include "chrome/browser/ui/browser_finder.h" | 12 #include "chrome/browser/ui/browser_finder.h" |
| 12 #include "chrome/browser/ui/browser_navigator.h" | 13 #include "chrome/browser/ui/browser_navigator.h" |
| 13 #include "chrome/browser/ui/browser_window.h" | 14 #include "chrome/browser/ui/browser_window.h" |
| 14 #include "chrome/browser/ui/singleton_tabs.h" | 15 #include "chrome/browser/ui/singleton_tabs.h" |
| 15 #include "chrome/common/url_constants.h" | 16 #include "chrome/common/url_constants.h" |
| 16 #include "chrome/grit/generated_resources.h" | 17 #include "chrome/grit/generated_resources.h" |
| 17 #include "components/constrained_window/constrained_window_views.h" | 18 #include "components/constrained_window/constrained_window_views.h" |
| 18 #include "components/strings/grit/components_strings.h" | 19 #include "components/strings/grit/components_strings.h" |
| 19 #include "content/public/browser/navigation_handle.h" | 20 #include "content/public/browser/navigation_handle.h" |
| 20 #include "content/public/browser/web_contents.h" | 21 #include "content/public/browser/web_contents.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 views::kButtonHEdgeMarginNew)); | 79 views::kButtonHEdgeMarginNew)); |
| 79 const base::string16 learn_more = l10n_util::GetStringUTF16(IDS_LEARN_MORE); | 80 const base::string16 learn_more = l10n_util::GetStringUTF16(IDS_LEARN_MORE); |
| 80 std::vector<size_t> offsets; | 81 std::vector<size_t> offsets; |
| 81 base::string16 headline = l10n_util::GetStringFUTF16( | 82 base::string16 headline = l10n_util::GetStringFUTF16( |
| 82 IDS_PLATFORM_VERIFICATION_DIALOG_HEADLINE, domain_, learn_more, &offsets); | 83 IDS_PLATFORM_VERIFICATION_DIALOG_HEADLINE, domain_, learn_more, &offsets); |
| 83 views::StyledLabel* headline_label = new views::StyledLabel(headline, this); | 84 views::StyledLabel* headline_label = new views::StyledLabel(headline, this); |
| 84 headline_label->AddStyleRange( | 85 headline_label->AddStyleRange( |
| 85 gfx::Range(offsets[1], offsets[1] + learn_more.size()), | 86 gfx::Range(offsets[1], offsets[1] + learn_more.size()), |
| 86 views::StyledLabel::RangeStyleInfo::CreateForLink()); | 87 views::StyledLabel::RangeStyleInfo::CreateForLink()); |
| 87 AddChildView(headline_label); | 88 AddChildView(headline_label); |
| 89 chrome::RecordDialogCreation(chrome::DialogIdentifier::PLATFORM_VERIFICATION); |
| 88 } | 90 } |
| 89 | 91 |
| 90 bool PlatformVerificationDialog::Cancel() { | 92 bool PlatformVerificationDialog::Cancel() { |
| 91 // This method is called when user clicked "Block" button. | 93 // This method is called when user clicked "Block" button. |
| 92 callback_.Run(CONSENT_RESPONSE_DENY); | 94 callback_.Run(CONSENT_RESPONSE_DENY); |
| 93 return true; | 95 return true; |
| 94 } | 96 } |
| 95 | 97 |
| 96 bool PlatformVerificationDialog::Accept() { | 98 bool PlatformVerificationDialog::Accept() { |
| 97 // This method is called when user clicked "Allow" button. | 99 // This method is called when user clicked "Allow" button. |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 navigation_handle->IsSameDocument()) | 158 navigation_handle->IsSameDocument()) |
| 157 return; | 159 return; |
| 158 | 160 |
| 159 views::Widget* widget = GetWidget(); | 161 views::Widget* widget = GetWidget(); |
| 160 if (widget) | 162 if (widget) |
| 161 widget->Close(); | 163 widget->Close(); |
| 162 } | 164 } |
| 163 | 165 |
| 164 } // namespace attestation | 166 } // namespace attestation |
| 165 } // namespace chromeos | 167 } // namespace chromeos |
| OLD | NEW |