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

Unified Diff: chrome/browser/ui/webui/certificate_viewer_webui.cc

Issue 10554010: Remove BrowserList::GetLastActive usage from WebUI pages. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: review comments Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/webui/certificate_viewer_webui.h ('k') | chrome/browser/ui/webui/feedback_ui.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/certificate_viewer_webui.cc
===================================================================
--- chrome/browser/ui/webui/certificate_viewer_webui.cc (revision 142088)
+++ chrome/browser/ui/webui/certificate_viewer_webui.cc (working copy)
@@ -11,9 +11,7 @@
#include "base/string_number_conversions.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/certificate_viewer.h"
-#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_dialogs.h"
-#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/certificate_dialogs.h"
#include "chrome/browser/ui/constrained_window.h"
#include "chrome/browser/ui/tab_contents/tab_contents.h"
@@ -22,6 +20,7 @@
#include "content/public/browser/web_contents.h"
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
+#include "ui/gfx/size.h"
#include "ui/web_dialogs/constrained_web_dialog_ui.h"
#include "ui/web_dialogs/web_dialog_observer.h"
@@ -38,10 +37,11 @@
} // namespace
// Shows a certificate using the WebUI certificate viewer.
-void ShowCertificateViewer(gfx::NativeWindow parent,
+void ShowCertificateViewer(WebContents* web_contents,
+ gfx::NativeWindow parent,
net::X509Certificate* cert) {
CertificateViewerDialog* dialog = new CertificateViewerDialog(cert);
- dialog->Show(parent);
+ dialog->Show(web_contents, parent);
}
////////////////////////////////////////////////////////////////////////////////
@@ -68,18 +68,16 @@
CertificateViewerDialog::~CertificateViewerDialog() {
}
-void CertificateViewerDialog::Show(gfx::NativeWindow parent) {
- // TODO(oshima): Should get browser from parent.
- Browser* browser = BrowserList::GetLastActive();
- DCHECK(browser);
- TabContents* current_tab_contents = browser->GetActiveTabContents();
+void CertificateViewerDialog::Show(WebContents* web_contents,
+ gfx::NativeWindow parent) {
// TODO(bshe): UI tweaks needed for AURA html Dialog, such as add padding on
// title for AURA ConstrainedWebDialogUI.
+ TabContents* tab = TabContents::FromWebContents(web_contents);
window_ = ui::CreateConstrainedWebDialog(
- current_tab_contents->profile(),
+ tab->profile(),
this,
NULL,
- current_tab_contents)->window()->GetNativeWindow();
+ tab)->window()->GetNativeWindow();
}
ui::ModalType CertificateViewerDialog::GetDialogModalType() const {
« no previous file with comments | « chrome/browser/ui/webui/certificate_viewer_webui.h ('k') | chrome/browser/ui/webui/feedback_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698