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

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

Issue 9224002: Make WebUI objects not derive from WebUI. WebUI objects own the controller. This is the ownership... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync to head to clear linux_chromeos browsertest failures Created 8 years, 11 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_ui.h" 5 #include "chrome/browser/ui/webui/certificate_viewer_ui.h"
6 6
7 #include "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 8 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
9 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" 9 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h"
10 #include "chrome/common/url_constants.h" 10 #include "chrome/common/url_constants.h"
11 #include "content/browser/webui/web_ui.h"
11 #include "content/public/browser/web_contents.h" 12 #include "content/public/browser/web_contents.h"
12 #include "grit/browser_resources.h" 13 #include "grit/browser_resources.h"
13 #include "grit/generated_resources.h" 14 #include "grit/generated_resources.h"
14 15
15 using content::WebContents; 16 CertificateViewerUI::CertificateViewerUI(WebUI* web_ui)
16
17 CertificateViewerUI::CertificateViewerUI(WebContents* contents)
18 #if defined(USE_AURA) 17 #if defined(USE_AURA)
19 : ConstrainedHtmlUI(contents) { 18 : ConstrainedHtmlUI(web_ui) {
20 #else 19 #else
21 : HtmlDialogUI(contents) { 20 : HtmlDialogUI(web_ui) {
22 #endif 21 #endif
23 22
24 // Set up the chrome://view-cert source. 23 // Set up the chrome://view-cert source.
25 ChromeWebUIDataSource* html_source = 24 ChromeWebUIDataSource* html_source =
26 new ChromeWebUIDataSource(chrome::kChromeUICertificateViewerHost); 25 new ChromeWebUIDataSource(chrome::kChromeUICertificateViewerHost);
27 26
28 // Localized strings. 27 // Localized strings.
29 html_source->AddLocalizedString("general", IDS_CERT_INFO_GENERAL_TAB_LABEL); 28 html_source->AddLocalizedString("general", IDS_CERT_INFO_GENERAL_TAB_LABEL);
30 html_source->AddLocalizedString("details", IDS_CERT_INFO_DETAILS_TAB_LABEL); 29 html_source->AddLocalizedString("details", IDS_CERT_INFO_DETAILS_TAB_LABEL);
31 html_source->AddLocalizedString("close", IDS_CLOSE); 30 html_source->AddLocalizedString("close", IDS_CLOSE);
(...skipping 24 matching lines...) Expand all
56 IDS_CERT_DETAILS_CERTIFICATE_FIELD_VALUE_LABEL); 55 IDS_CERT_DETAILS_CERTIFICATE_FIELD_VALUE_LABEL);
57 html_source->set_json_path("strings.js"); 56 html_source->set_json_path("strings.js");
58 57
59 // Add required resources. 58 // Add required resources.
60 html_source->add_resource_path("certificate_viewer.js", 59 html_source->add_resource_path("certificate_viewer.js",
61 IDR_CERTIFICATE_VIEWER_JS); 60 IDR_CERTIFICATE_VIEWER_JS);
62 html_source->add_resource_path("certificate_viewer.css", 61 html_source->add_resource_path("certificate_viewer.css",
63 IDR_CERTIFICATE_VIEWER_CSS); 62 IDR_CERTIFICATE_VIEWER_CSS);
64 html_source->set_default_resource(IDR_CERTIFICATE_VIEWER_HTML); 63 html_source->set_default_resource(IDR_CERTIFICATE_VIEWER_HTML);
65 64
66 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); 65 Profile* profile = Profile::FromBrowserContext(
66 web_ui->web_contents()->GetBrowserContext());
67 profile->GetChromeURLDataManager()->AddDataSource(html_source); 67 profile->GetChromeURLDataManager()->AddDataSource(html_source);
68 } 68 }
69 69
70 CertificateViewerUI::~CertificateViewerUI() { 70 CertificateViewerUI::~CertificateViewerUI() {
71 } 71 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698