OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ssl/ssl_add_certificate.h" | 5 #include "chrome/browser/ssl/ssl_add_certificate.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/certificate_viewer.h" | 10 #include "chrome/browser/certificate_viewer.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 scoped_ptr<ConfirmInfoBarDelegate>( | 39 scoped_ptr<ConfirmInfoBarDelegate>( |
40 new SSLAddCertificateInfoBarDelegate(cert)))); | 40 new SSLAddCertificateInfoBarDelegate(cert)))); |
41 } | 41 } |
42 | 42 |
43 private: | 43 private: |
44 explicit SSLAddCertificateInfoBarDelegate(net::X509Certificate* cert) | 44 explicit SSLAddCertificateInfoBarDelegate(net::X509Certificate* cert) |
45 : cert_(cert) {} | 45 : cert_(cert) {} |
46 virtual ~SSLAddCertificateInfoBarDelegate() {} | 46 virtual ~SSLAddCertificateInfoBarDelegate() {} |
47 | 47 |
48 // ConfirmInfoBarDelegate implementation: | 48 // ConfirmInfoBarDelegate implementation: |
49 virtual int GetIconID() const OVERRIDE { | 49 virtual int GetIconID() const override { |
50 // TODO(davidben): Use a more appropriate icon. | 50 // TODO(davidben): Use a more appropriate icon. |
51 return IDR_INFOBAR_SAVE_PASSWORD; | 51 return IDR_INFOBAR_SAVE_PASSWORD; |
52 } | 52 } |
53 | 53 |
54 virtual Type GetInfoBarType() const OVERRIDE { | 54 virtual Type GetInfoBarType() const override { |
55 return PAGE_ACTION_TYPE; | 55 return PAGE_ACTION_TYPE; |
56 } | 56 } |
57 | 57 |
58 virtual base::string16 GetMessageText() const OVERRIDE { | 58 virtual base::string16 GetMessageText() const override { |
59 // TODO(evanm): GetDisplayName should return UTF-16. | 59 // TODO(evanm): GetDisplayName should return UTF-16. |
60 return l10n_util::GetStringFUTF16(IDS_ADD_CERT_SUCCESS_INFOBAR_LABEL, | 60 return l10n_util::GetStringFUTF16(IDS_ADD_CERT_SUCCESS_INFOBAR_LABEL, |
61 base::UTF8ToUTF16( | 61 base::UTF8ToUTF16( |
62 cert_->issuer().GetDisplayName())); | 62 cert_->issuer().GetDisplayName())); |
63 } | 63 } |
64 | 64 |
65 virtual int GetButtons() const OVERRIDE { | 65 virtual int GetButtons() const override { |
66 return BUTTON_OK; | 66 return BUTTON_OK; |
67 } | 67 } |
68 | 68 |
69 virtual base::string16 GetButtonLabel(InfoBarButton button) const OVERRIDE { | 69 virtual base::string16 GetButtonLabel(InfoBarButton button) const override { |
70 DCHECK_EQ(BUTTON_OK, button); | 70 DCHECK_EQ(BUTTON_OK, button); |
71 return l10n_util::GetStringUTF16(IDS_ADD_CERT_SUCCESS_INFOBAR_BUTTON); | 71 return l10n_util::GetStringUTF16(IDS_ADD_CERT_SUCCESS_INFOBAR_BUTTON); |
72 } | 72 } |
73 | 73 |
74 virtual bool Accept() OVERRIDE { | 74 virtual bool Accept() override { |
75 WebContents* web_contents = | 75 WebContents* web_contents = |
76 InfoBarService::WebContentsFromInfoBar(infobar()); | 76 InfoBarService::WebContentsFromInfoBar(infobar()); |
77 ShowCertificateViewer(web_contents, | 77 ShowCertificateViewer(web_contents, |
78 web_contents->GetTopLevelNativeWindow(), | 78 web_contents->GetTopLevelNativeWindow(), |
79 cert_.get()); | 79 cert_.get()); |
80 // It looks weird to hide the infobar just as the dialog opens. | 80 // It looks weird to hide the infobar just as the dialog opens. |
81 return false; | 81 return false; |
82 } | 82 } |
83 | 83 |
84 // The certificate that was added. | 84 // The certificate that was added. |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 render_process_id, render_frame_id, cert_error)); | 167 render_process_id, render_frame_id, cert_error)); |
168 } else { | 168 } else { |
169 BrowserThread::PostTask( | 169 BrowserThread::PostTask( |
170 BrowserThread::UI, FROM_HERE, | 170 BrowserThread::UI, FROM_HERE, |
171 base::Bind(&ShowSuccessInfoBar, | 171 base::Bind(&ShowSuccessInfoBar, |
172 render_process_id, render_frame_id, cert)); | 172 render_process_id, render_frame_id, cert)); |
173 } | 173 } |
174 } | 174 } |
175 | 175 |
176 } // namespace chrome | 176 } // namespace chrome |
OLD | NEW |