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

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

Issue 11358027: Move constrained web dialog code back to chrome/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cros fix2 Created 8 years, 1 month 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/profiles/profile.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/constrained_window.h" 17 #include "chrome/browser/ui/constrained_window.h"
17 #include "chrome/browser/ui/tab_contents/tab_contents.h" 18 #include "chrome/browser/ui/tab_contents/tab_contents.h"
19 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h"
18 #include "chrome/common/net/x509_certificate_model.h" 20 #include "chrome/common/net/x509_certificate_model.h"
19 #include "chrome/common/url_constants.h" 21 #include "chrome/common/url_constants.h"
20 #include "content/public/browser/web_contents.h" 22 #include "content/public/browser/web_contents.h"
21 #include "grit/generated_resources.h" 23 #include "grit/generated_resources.h"
22 #include "ui/base/l10n/l10n_util.h" 24 #include "ui/base/l10n/l10n_util.h"
23 #include "ui/gfx/size.h" 25 #include "ui/gfx/size.h"
24 #include "ui/web_dialogs/constrained_web_dialog_ui.h"
25 #include "ui/web_dialogs/web_dialog_observer.h" 26 #include "ui/web_dialogs/web_dialog_observer.h"
26 27
27 using content::WebContents; 28 using content::WebContents;
28 using content::WebUIMessageHandler; 29 using content::WebUIMessageHandler;
29 using ui::WebDialogObserver; 30 using ui::WebDialogObserver;
30 31
31 namespace { 32 namespace {
32 33
33 // Default width/height of the dialog. 34 // Default width/height of the dialog.
34 const int kDefaultWidth = 580; 35 const int kDefaultWidth = 580;
(...skipping 28 matching lines...) Expand all
63 &cert_chain); 64 &cert_chain);
64 title_ = l10n_util::GetStringFUTF16(IDS_CERT_INFO_DIALOG_TITLE, 65 title_ = l10n_util::GetStringFUTF16(IDS_CERT_INFO_DIALOG_TITLE,
65 UTF8ToUTF16(x509_certificate_model::GetTitle(cert_chain.front()))); 66 UTF8ToUTF16(x509_certificate_model::GetTitle(cert_chain.front())));
66 } 67 }
67 68
68 CertificateViewerDialog::~CertificateViewerDialog() { 69 CertificateViewerDialog::~CertificateViewerDialog() {
69 } 70 }
70 71
71 void CertificateViewerDialog::Show(WebContents* web_contents, 72 void CertificateViewerDialog::Show(WebContents* web_contents,
72 gfx::NativeWindow parent) { 73 gfx::NativeWindow parent) {
73 // 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 adding padding
74 // title for AURA ConstrainedWebDialogUI. 75 // on the title for Aura ConstrainedWebDialogUI.
75 TabContents* tab = TabContents::FromWebContents(web_contents); 76 Profile* profile =
76 window_ = ui::CreateConstrainedWebDialog( 77 Profile::FromBrowserContext(web_contents->GetBrowserContext());
77 tab->profile(), 78 window_ = CreateConstrainedWebDialog(
79 profile,
78 this, 80 this,
79 NULL, 81 NULL,
80 tab)->window()->GetNativeWindow(); 82 web_contents)->window()->GetNativeWindow();
81 } 83 }
82 84
83 ui::ModalType CertificateViewerDialog::GetDialogModalType() const { 85 ui::ModalType CertificateViewerDialog::GetDialogModalType() const {
84 return ui::MODAL_TYPE_NONE; 86 return ui::MODAL_TYPE_NONE;
85 } 87 }
86 88
87 string16 CertificateViewerDialog::GetDialogTitle() const { 89 string16 CertificateViewerDialog::GetDialogTitle() const {
88 return title_; 90 return title_;
89 } 91 }
90 92
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 const base::ListValue* args) const { 407 const base::ListValue* args) const {
406 int cert_index; 408 int cert_index;
407 double val; 409 double val;
408 if (!(args->GetDouble(0, &val))) 410 if (!(args->GetDouble(0, &val)))
409 return -1; 411 return -1;
410 cert_index = static_cast<int>(val); 412 cert_index = static_cast<int>(val);
411 if (cert_index < 0 || cert_index >= static_cast<int>(cert_chain_.size())) 413 if (cert_index < 0 || cert_index >= static_cast<int>(cert_chain_.size()))
412 return -1; 414 return -1;
413 return cert_index; 415 return cert_index;
414 } 416 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/certificate_viewer_ui.cc ('k') | chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698