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

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

Issue 12224020: Use gfx::NativeView rather than gfx::NativeWindow to identify web contents modal dialogs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
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/string_number_conversions.h" 11 #include "base/string_number_conversions.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/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/ui/browser_dialogs.h" 15 #include "chrome/browser/ui/browser_dialogs.h"
15 #include "chrome/browser/ui/certificate_dialogs.h" 16 #include "chrome/browser/ui/certificate_dialogs.h"
16 #include "chrome/browser/ui/web_contents_modal_dialog.h" 17 #include "chrome/browser/ui/web_contents_modal_dialog.h"
17 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" 18 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h"
18 #include "chrome/common/net/x509_certificate_model.h" 19 #include "chrome/common/net/x509_certificate_model.h"
19 #include "chrome/common/url_constants.h" 20 #include "chrome/common/url_constants.h"
20 #include "content/public/browser/web_contents.h" 21 #include "content/public/browser/web_contents.h"
21 #include "grit/generated_resources.h" 22 #include "grit/generated_resources.h"
22 #include "ui/base/l10n/l10n_util.h" 23 #include "ui/base/l10n/l10n_util.h"
23 #include "ui/gfx/size.h" 24 #include "ui/gfx/size.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 UTF8ToUTF16(x509_certificate_model::GetTitle(cert_chain.front()))); 65 UTF8ToUTF16(x509_certificate_model::GetTitle(cert_chain.front())));
65 } 66 }
66 67
67 CertificateViewerDialog::~CertificateViewerDialog() { 68 CertificateViewerDialog::~CertificateViewerDialog() {
68 } 69 }
69 70
70 void CertificateViewerDialog::Show(WebContents* web_contents, 71 void CertificateViewerDialog::Show(WebContents* web_contents,
71 gfx::NativeWindow parent) { 72 gfx::NativeWindow parent) {
72 // TODO(bshe): UI tweaks needed for Aura HTML Dialog, such as adding padding 73 // TODO(bshe): UI tweaks needed for Aura HTML Dialog, such as adding padding
73 // on the title for Aura ConstrainedWebDialogUI. 74 // on the title for Aura ConstrainedWebDialogUI.
74 window_ = CreateConstrainedWebDialog( 75 gfx::NativeView view = CreateConstrainedWebDialog(
75 web_contents->GetBrowserContext(), 76 web_contents->GetBrowserContext(),
76 this, 77 this,
77 NULL, 78 NULL,
78 web_contents)->GetWindow()->GetNativeWindow(); 79 web_contents)->GetWindow()->GetNativeView();
80 window_ = platform_util::GetTopLevel(view);
79 } 81 }
80 82
81 ui::ModalType CertificateViewerDialog::GetDialogModalType() const { 83 ui::ModalType CertificateViewerDialog::GetDialogModalType() const {
82 return ui::MODAL_TYPE_NONE; 84 return ui::MODAL_TYPE_NONE;
83 } 85 }
84 86
85 string16 CertificateViewerDialog::GetDialogTitle() const { 87 string16 CertificateViewerDialog::GetDialogTitle() const {
86 return title_; 88 return title_;
87 } 89 }
88 90
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 const base::ListValue* args) const { 405 const base::ListValue* args) const {
404 int cert_index; 406 int cert_index;
405 double val; 407 double val;
406 if (!(args->GetDouble(0, &val))) 408 if (!(args->GetDouble(0, &val)))
407 return -1; 409 return -1;
408 cert_index = static_cast<int>(val); 410 cert_index = static_cast<int>(val);
409 if (cert_index < 0 || cert_index >= static_cast<int>(cert_chain_.size())) 411 if (cert_index < 0 || cert_index >= static_cast<int>(cert_chain_.size()))
410 return -1; 412 return -1;
411 return cert_index; 413 return cert_index;
412 } 414 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698