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/ui/webui/certificate_viewer_webui.h" | 5 #include "chrome/browser/ui/webui/certificate_viewer_webui.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/i18n/time_formatting.h" | 9 #include "base/i18n/time_formatting.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
12 #include "base/string_number_conversions.h" | 12 #include "base/string_number_conversions.h" |
13 #include "chrome/browser/certificate_viewer.h" | 13 #include "chrome/browser/certificate_viewer.h" |
14 #include "chrome/browser/ui/constrained_window.h" | 14 #include "chrome/browser/ui/constrained_window.h" |
15 #include "chrome/browser/ui/dialog_style.h" | 15 #include "chrome/browser/ui/dialog_style.h" |
16 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
17 #include "chrome/browser/ui/browser_dialogs.h" | 17 #include "chrome/browser/ui/browser_dialogs.h" |
18 #include "chrome/browser/ui/browser_list.h" | 18 #include "chrome/browser/ui/browser_list.h" |
19 #include "chrome/browser/ui/certificate_dialogs.h" | 19 #include "chrome/browser/ui/certificate_dialogs.h" |
20 #include "chrome/browser/ui/dialog_style.h" | 20 #include "chrome/browser/ui/dialog_style.h" |
21 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 21 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
22 #include "chrome/browser/ui/webui/constrained_html_ui.h" | 22 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" |
23 #include "chrome/common/net/x509_certificate_model.h" | 23 #include "chrome/common/net/x509_certificate_model.h" |
24 #include "chrome/common/url_constants.h" | 24 #include "chrome/common/url_constants.h" |
25 #include "content/public/browser/web_contents.h" | 25 #include "content/public/browser/web_contents.h" |
26 #include "ui/base/l10n/l10n_util.h" | 26 #include "ui/base/l10n/l10n_util.h" |
27 #include "grit/generated_resources.h" | 27 #include "grit/generated_resources.h" |
28 | 28 |
29 using content::WebContents; | 29 using content::WebContents; |
30 using content::WebUIMessageHandler; | 30 using content::WebUIMessageHandler; |
31 | 31 |
32 namespace { | 32 namespace { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 CertificateViewerDialog::~CertificateViewerDialog() { | 65 CertificateViewerDialog::~CertificateViewerDialog() { |
66 } | 66 } |
67 | 67 |
68 void CertificateViewerDialog::Show(gfx::NativeWindow parent) { | 68 void CertificateViewerDialog::Show(gfx::NativeWindow parent) { |
69 // TODO(oshima): Should get browser from parent. | 69 // TODO(oshima): Should get browser from parent. |
70 Browser* browser = BrowserList::GetLastActive(); | 70 Browser* browser = BrowserList::GetLastActive(); |
71 DCHECK(browser); | 71 DCHECK(browser); |
72 TabContentsWrapper* current_wrapper = | 72 TabContentsWrapper* current_wrapper = |
73 browser->GetSelectedTabContentsWrapper(); | 73 browser->GetSelectedTabContentsWrapper(); |
74 // TODO(bshe): UI tweaks needed for AURA html Dialog, such as add padding on | 74 // TODO(bshe): UI tweaks needed for AURA html Dialog, such as add padding on |
75 // title for AURA ConstrainedHtmlDialog. | 75 // title for AURA ConstrainedWebDialogUI. |
76 window_ = ConstrainedHtmlUI::CreateConstrainedHtmlDialog( | 76 window_ = ConstrainedWebDialogUI::CreateConstrainedWebDialog( |
77 current_wrapper->profile(), | 77 current_wrapper->profile(), |
78 this, | 78 this, |
79 NULL, | 79 NULL, |
80 current_wrapper)->window()->GetNativeWindow(); | 80 current_wrapper)->window()->GetNativeWindow(); |
81 } | 81 } |
82 | 82 |
83 ui::ModalType CertificateViewerDialog::GetDialogModalType() const { | 83 ui::ModalType CertificateViewerDialog::GetDialogModalType() const { |
84 return ui::MODAL_TYPE_NONE; | 84 return ui::MODAL_TYPE_NONE; |
85 } | 85 } |
86 | 86 |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 const base::ListValue* args) const { | 401 const base::ListValue* args) const { |
402 int cert_index; | 402 int cert_index; |
403 double val; | 403 double val; |
404 if (!(args->GetDouble(0, &val))) | 404 if (!(args->GetDouble(0, &val))) |
405 return -1; | 405 return -1; |
406 cert_index = static_cast<int>(val); | 406 cert_index = static_cast<int>(val); |
407 if (cert_index < 0 || cert_index >= static_cast<int>(cert_chain_.size())) | 407 if (cert_index < 0 || cert_index >= static_cast<int>(cert_chain_.size())) |
408 return -1; | 408 return -1; |
409 return cert_index; | 409 return cert_index; |
410 } | 410 } |
OLD | NEW |