Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(213)

Side by Side Diff: chrome/browser/ui/webui/certificate_viewer_webui.cc

Issue 985133002: Remove NativeWebContentsModalDialog and NativePopup typedefs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@extension-popup
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "chrome/browser/certificate_viewer.h" 13 #include "chrome/browser/certificate_viewer.h"
14 #include "chrome/browser/platform_util.h" 14 #include "chrome/browser/platform_util.h"
15 #include "chrome/browser/ui/browser_dialogs.h" 15 #include "chrome/browser/ui/browser_dialogs.h"
16 #include "chrome/browser/ui/certificate_dialogs.h" 16 #include "chrome/browser/ui/certificate_dialogs.h"
17 #include "chrome/browser/ui/webui/certificate_viewer_ui.h" 17 #include "chrome/browser/ui/webui/certificate_viewer_ui.h"
18 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" 18 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h"
19 #include "chrome/common/net/x509_certificate_model.h" 19 #include "chrome/common/net/x509_certificate_model.h"
20 #include "chrome/common/url_constants.h" 20 #include "chrome/common/url_constants.h"
21 #include "chrome/grit/generated_resources.h" 21 #include "chrome/grit/generated_resources.h"
22 #include "content/public/browser/web_contents.h" 22 #include "content/public/browser/web_contents.h"
23 #include "ui/base/l10n/l10n_util.h" 23 #include "ui/base/l10n/l10n_util.h"
24 #include "ui/gfx/geometry/size.h" 24 #include "ui/gfx/geometry/size.h"
25 25
26 using content::WebContents; 26 using content::WebContents;
27 using content::WebUIMessageHandler; 27 using content::WebUIMessageHandler;
28 using web_modal::NativeWebContentsModalDialog;
29 28
30 // Shows a certificate using the WebUI certificate viewer. 29 // Shows a certificate using the WebUI certificate viewer.
31 void ShowCertificateViewer(WebContents* web_contents, 30 void ShowCertificateViewer(WebContents* web_contents,
32 gfx::NativeWindow parent, 31 gfx::NativeWindow parent,
33 net::X509Certificate* cert) { 32 net::X509Certificate* cert) {
34 CertificateViewerDialog* dialog = new CertificateViewerDialog(cert); 33 CertificateViewerDialog* dialog = new CertificateViewerDialog(cert);
35 dialog->Show(web_contents, parent); 34 dialog->Show(web_contents, parent);
36 } 35 }
37 36
38 //////////////////////////////////////////////////////////////////////////////// 37 ////////////////////////////////////////////////////////////////////////////////
(...skipping 12 matching lines...) Expand all
51 CertificateViewerModalDialog::~CertificateViewerModalDialog() { 50 CertificateViewerModalDialog::~CertificateViewerModalDialog() {
52 } 51 }
53 52
54 void CertificateViewerModalDialog::Show(content::WebContents* web_contents, 53 void CertificateViewerModalDialog::Show(content::WebContents* web_contents,
55 gfx::NativeWindow parent) { 54 gfx::NativeWindow parent) {
56 window_ = chrome::ShowWebDialog(parent, 55 window_ = chrome::ShowWebDialog(parent,
57 web_contents->GetBrowserContext(), 56 web_contents->GetBrowserContext(),
58 this); 57 this);
59 } 58 }
60 59
61 NativeWebContentsModalDialog 60 gfx::NativeWindow
62 CertificateViewerModalDialog::GetNativeWebContentsModalDialog() { 61 CertificateViewerModalDialog::GetNativeWebContentsModalDialog() {
63 #if defined(USE_AURA) 62 #if defined(USE_AURA)
64 return window_; 63 return window_;
65 #else 64 #else
66 NOTREACHED(); 65 NOTREACHED();
67 return NULL; 66 return NULL;
68 #endif 67 #endif
69 } 68 }
70 69
71 ui::ModalType CertificateViewerModalDialog::GetDialogModalType() const { 70 ui::ModalType CertificateViewerModalDialog::GetDialogModalType() const {
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 } 224 }
226 225
227 void CertificateViewerDialog::Show(WebContents* web_contents, 226 void CertificateViewerDialog::Show(WebContents* web_contents,
228 gfx::NativeWindow parent) { 227 gfx::NativeWindow parent) {
229 // TODO(bshe): UI tweaks needed for Aura HTML Dialog, such as adding padding 228 // TODO(bshe): UI tweaks needed for Aura HTML Dialog, such as adding padding
230 // on the title for Aura ConstrainedWebDialogUI. 229 // on the title for Aura ConstrainedWebDialogUI.
231 dialog_ = ShowConstrainedWebDialog(web_contents->GetBrowserContext(), this, 230 dialog_ = ShowConstrainedWebDialog(web_contents->GetBrowserContext(), this,
232 web_contents); 231 web_contents);
233 } 232 }
234 233
235 NativeWebContentsModalDialog 234 gfx::NativeWindow CertificateViewerDialog::GetNativeWebContentsModalDialog() {
236 CertificateViewerDialog::GetNativeWebContentsModalDialog() {
237 return dialog_->GetNativeDialog(); 235 return dialog_->GetNativeDialog();
238 } 236 }
239 237
240 GURL CertificateViewerDialog::GetDialogContentURL() const { 238 GURL CertificateViewerDialog::GetDialogContentURL() const {
241 return GURL(chrome::kChromeUICertificateViewerURL); 239 return GURL(chrome::kChromeUICertificateViewerURL);
242 } 240 }
243 241
244 ui::ModalType CertificateViewerDialog::GetDialogModalType() const { 242 ui::ModalType CertificateViewerDialog::GetDialogModalType() const {
245 return ui::MODAL_TYPE_NONE; 243 return ui::MODAL_TYPE_NONE;
246 } 244 }
(...skipping 22 matching lines...) Expand all
269 base::Bind(&CertificateViewerDialogHandler::RequestCertificateFields, 267 base::Bind(&CertificateViewerDialogHandler::RequestCertificateFields,
270 base::Unretained(this))); 268 base::Unretained(this)));
271 } 269 }
272 270
273 void CertificateViewerDialogHandler::ExportCertificate( 271 void CertificateViewerDialogHandler::ExportCertificate(
274 const base::ListValue* args) { 272 const base::ListValue* args) {
275 int cert_index = GetCertificateIndex(args); 273 int cert_index = GetCertificateIndex(args);
276 if (cert_index < 0) 274 if (cert_index < 0)
277 return; 275 return;
278 276
279 NativeWebContentsModalDialog window = 277 gfx::NativeWindow window =
280 platform_util::GetTopLevel(dialog_->GetNativeWebContentsModalDialog()); 278 platform_util::GetTopLevel(dialog_->GetNativeWebContentsModalDialog());
281 ShowCertExportDialog(web_ui()->GetWebContents(), 279 ShowCertExportDialog(web_ui()->GetWebContents(),
282 window, 280 window,
283 cert_chain_.begin() + cert_index, 281 cert_chain_.begin() + cert_index,
284 cert_chain_.end()); 282 cert_chain_.end());
285 } 283 }
286 284
287 void CertificateViewerDialogHandler::RequestCertificateFields( 285 void CertificateViewerDialogHandler::RequestCertificateFields(
288 const base::ListValue* args) { 286 const base::ListValue* args) {
289 int cert_index = GetCertificateIndex(args); 287 int cert_index = GetCertificateIndex(args);
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 const base::ListValue* args) const { 439 const base::ListValue* args) const {
442 int cert_index; 440 int cert_index;
443 double val; 441 double val;
444 if (!(args->GetDouble(0, &val))) 442 if (!(args->GetDouble(0, &val)))
445 return -1; 443 return -1;
446 cert_index = static_cast<int>(val); 444 cert_index = static_cast<int>(val);
447 if (cert_index < 0 || cert_index >= static_cast<int>(cert_chain_.size())) 445 if (cert_index < 0 || cert_index >= static_cast<int>(cert_chain_.size()))
448 return -1; 446 return -1;
449 return cert_index; 447 return cert_index;
450 } 448 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/certificate_viewer_webui.h ('k') | chrome/browser/ui/webui/constrained_web_dialog_delegate_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698