summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/browser_resources.grd3
-rw-r--r--chrome/browser/resources/about_conflicts.html70
-rw-r--r--chrome/browser/resources/about_conflicts.js62
-rw-r--r--chrome/browser/ui/webui/conflicts_ui.cc109
-rw-r--r--chrome/test/functional/special_tabs.py2
5 files changed, 103 insertions, 143 deletions
diff --git a/chrome/browser/browser_resources.grd b/chrome/browser/browser_resources.grd
index 406c3ed..ad9efec0 100644
--- a/chrome/browser/browser_resources.grd
+++ b/chrome/browser/browser_resources.grd
@@ -10,7 +10,8 @@
<release seq="1">
<includes>
<if expr="is_win">
- <include name="IDR_ABOUT_CONFLICTS_HTML" file="resources\about_conflicts.html" flattenhtml="true" type="BINDATA" />
+ <include name="IDR_ABOUT_CONFLICTS_HTML" file="resources\about_conflicts.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" />
+ <include name="IDR_ABOUT_CONFLICTS_JS" file="resources\about_conflicts.js" type="BINDATA" />
</if>
<include name="IDR_ABOUT_FLASH_HTML" file="resources\about_flash.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" />
<include name="IDR_ABOUT_FLASH_JS" file="resources\about_flash.js" type="BINDATA" />
diff --git a/chrome/browser/resources/about_conflicts.html b/chrome/browser/resources/about_conflicts.html
index 9fb36db..6ac20b1 100644
--- a/chrome/browser/resources/about_conflicts.html
+++ b/chrome/browser/resources/about_conflicts.html
@@ -2,6 +2,9 @@
<html i18n-values="dir:textdirection;">
<head>
<meta charset="utf-8">
+<meta http-equiv="X-WebKit-CSP"
+ content="object-src 'none';
+ script-src chrome://resources 'self' 'unsafe-eval'">
<style>
body {
margin: 10px;
@@ -144,68 +147,6 @@ html[dir=rtl] .clearing {
border-bottom: 1px solid #aaa;
}
</style>
-<script>
-
- /**
- * This variable structure is here to document the structure that the template
- * expects to correctly populate the page.
- */
- var moduleListDataFormat = {
- 'moduleList': [
- {
- 'type': 'The type of module found',
- 'type_description':
- 'The type of module (string), defaults to blank for regular modules',
- 'status': 'The module status',
- 'location': 'The module path, not including filename',
- 'name': 'The name of the module',
- 'product_name': 'The name of the product the module belongs to',
- 'description': 'The module description',
- 'version': 'The module version',
- 'digital_signer': 'The signer of the digital certificate for the module',
- 'recommended_action': 'The help tips bitmask',
- 'possible_resolution': 'The help tips in string form',
- 'help_url': 'The link to the Help Center article'
- }
- ]
- };
-
- /**
- * Takes the |moduleListData| input argument which represents data about
- * the currently available modules and populates the html jstemplate
- * with that data. It expects an object structure like the above.
- * @param {Object} moduleListData Information about available modules
- */
- function renderTemplate(moduleListData) {
- // This is the javascript code that processes the template:
- var input = new JsEvalContext(moduleListData);
- var output = document.getElementById('modulesTemplate');
- jstProcess(input, output);
- }
-
- /**
- * Asks the C++ ConflictsDOMHandler to get details about the available modules
- * and return detailed data about the configuration. The ConflictsDOMHandler
- * should reply to returnModuleList() (below).
- */
- function requestModuleListData() {
- chrome.send('requestModuleList', []);
- }
-
- /**
- * Called by the WebUI to re-populate the page with data representing the
- * current state of installed modules.
- */
- function returnModuleList(moduleListData) {
- renderTemplate(moduleListData);
- document.getElementById('loading-message').style.visibility = 'hidden';
- document.getElementById('body-container').style.visibility = 'visible';
- }
-
- // Get data and have it displayed upon loading.
- document.addEventListener('DOMContentLoaded', requestModuleListData);
-
-</script>
</head>
<body i18n-values=".style.fontFamily:fontfamily;.style.fontSize:fontsize">
<div id="loading-message" i18n-content="loadingMessage">LOADING_MESSAGE</div>
@@ -309,5 +250,10 @@ html[dir=rtl] .clearing {
</div>
</div>
</div>
+<script src="chrome://conflicts/strings.js"></script>
+<script src="chrome://conflicts/conflicts.js"></script>
+<script src="chrome://resources/js/i18n_template.js"></script>
+<script src="chrome://resources/js/i18n_process.js"></script>
+<script src="chrome://resources/js/jstemplate_compiled.js"></script>
</body>
</html>
diff --git a/chrome/browser/resources/about_conflicts.js b/chrome/browser/resources/about_conflicts.js
new file mode 100644
index 0000000..f49365f
--- /dev/null
+++ b/chrome/browser/resources/about_conflicts.js
@@ -0,0 +1,62 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/**
+* This variable structure is here to document the structure that the template
+* expects to correctly populate the page.
+*/
+var moduleListDataFormat = {
+ 'moduleList': [
+ {
+ 'type': 'The type of module found',
+ 'type_description':
+ 'The type of module (string), defaults to blank for regular modules',
+ 'status': 'The module status',
+ 'location': 'The module path, not including filename',
+ 'name': 'The name of the module',
+ 'product_name': 'The name of the product the module belongs to',
+ 'description': 'The module description',
+ 'version': 'The module version',
+ 'digital_signer': 'The signer of the digital certificate for the module',
+ 'recommended_action': 'The help tips bitmask',
+ 'possible_resolution': 'The help tips in string form',
+ 'help_url': 'The link to the Help Center article'
+ }
+]
+};
+
+/**
+* Takes the |moduleListData| input argument which represents data about
+* the currently available modules and populates the html jstemplate
+* with that data. It expects an object structure like the above.
+* @param {Object} moduleListData Information about available modules
+*/
+function renderTemplate(moduleListData) {
+ // This is the javascript code that processes the template:
+ var input = new JsEvalContext(moduleListData);
+ var output = document.getElementById('modulesTemplate');
+ jstProcess(input, output);
+}
+
+/**
+* Asks the C++ ConflictsDOMHandler to get details about the available modules
+* and return detailed data about the configuration. The ConflictsDOMHandler
+* should reply to returnModuleList() (below).
+*/
+function requestModuleListData() {
+ chrome.send('requestModuleList', []);
+}
+
+/**
+* Called by the WebUI to re-populate the page with data representing the
+* current state of installed modules.
+*/
+function returnModuleList(moduleListData) {
+ renderTemplate(moduleListData);
+ document.getElementById('loading-message').style.visibility = 'hidden';
+ document.getElementById('body-container').style.visibility = 'visible';
+}
+
+// Get data and have it displayed upon loading.
+document.addEventListener('DOMContentLoaded', requestModuleListData);
diff --git a/chrome/browser/ui/webui/conflicts_ui.cc b/chrome/browser/ui/webui/conflicts_ui.cc
index a5dc564..a3d5296 100644
--- a/chrome/browser/ui/webui/conflicts_ui.cc
+++ b/chrome/browser/ui/webui/conflicts_ui.cc
@@ -14,6 +14,7 @@
#include "chrome/browser/enumerate_modules_model_win.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/webui/chrome_url_data_manager.h"
+#include "chrome/browser/ui/webui/chrome_web_ui_data_source.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/jstemplate_builder.h"
#include "chrome/common/url_constants.h"
@@ -32,79 +33,32 @@
namespace {
-////////////////////////////////////////////////////////////////////////////////
-//
-// ConflictsUIHTMLSource
-//
-////////////////////////////////////////////////////////////////////////////////
-
-class ConflictsUIHTMLSource : public ChromeURLDataManager::DataSource {
- public:
- ConflictsUIHTMLSource()
- : DataSource(chrome::kChromeUIConflictsHost, MessageLoop::current()) {}
-
- // Called when the network layer has requested a resource underneath
- // the path we registered.
- virtual void StartDataRequest(const std::string& path,
- bool is_incognito,
- int request_id);
-
- virtual std::string GetMimeType(const std::string&) const {
- return "text/html";
- }
-
- private:
- DISALLOW_COPY_AND_ASSIGN(ConflictsUIHTMLSource);
-};
-
-void ConflictsUIHTMLSource::StartDataRequest(const std::string& path,
- bool is_incognito,
- int request_id) {
- // Strings used in the JsTemplate file.
- DictionaryValue localized_strings;
- localized_strings.SetString("loadingMessage",
- l10n_util::GetStringUTF16(IDS_CONFLICTS_LOADING_MESSAGE));
- localized_strings.SetString("modulesLongTitle",
- l10n_util::GetStringUTF16(IDS_CONFLICTS_CHECK_PAGE_TITLE_LONG));
- localized_strings.SetString("modulesBlurb",
- l10n_util::GetStringUTF16(IDS_CONFLICTS_EXPLANATION_TEXT));
- localized_strings.SetString("moduleSuspectedBad",
- l10n_util::GetStringUTF16(IDS_CONFLICTS_CHECK_WARNING_SUSPECTED));
- localized_strings.SetString("moduleConfirmedBad",
- l10n_util::GetStringUTF16(IDS_CONFLICTS_CHECK_WARNING_CONFIRMED));
- localized_strings.SetString("helpCenterLink",
- l10n_util::GetStringUTF16(IDS_CONFLICTS_HELP_CENTER_LINK));
- localized_strings.SetString("investigatingText",
- l10n_util::GetStringUTF16(IDS_CONFLICTS_CHECK_INVESTIGATING));
- localized_strings.SetString("modulesNoneLoaded",
- l10n_util::GetStringUTF16(IDS_CONFLICTS_NO_MODULES_LOADED));
- localized_strings.SetString("headerSoftware",
- l10n_util::GetStringUTF16(IDS_CONFLICTS_HEADER_SOFTWARE));
- localized_strings.SetString("headerSignedBy",
- l10n_util::GetStringUTF16(IDS_CONFLICTS_HEADER_SIGNED_BY));
- localized_strings.SetString("headerLocation",
- l10n_util::GetStringUTF16(IDS_CONFLICTS_HEADER_LOCATION));
- localized_strings.SetString("headerVersion",
- l10n_util::GetStringUTF16(IDS_CONFLICTS_HEADER_VERSION));
- localized_strings.SetString("headerHelpTip",
- l10n_util::GetStringUTF16(IDS_CONFLICTS_HEADER_HELP_TIP));
-
- ChromeURLDataManager::DataSource::SetFontAndTextDirection(&localized_strings);
-
- static const base::StringPiece flags_html(
- ResourceBundle::GetSharedInstance().GetRawDataResource(
- IDR_ABOUT_CONFLICTS_HTML));
- std::string full_html(flags_html.data(), flags_html.size());
- jstemplate_builder::AppendJsonHtml(&localized_strings, &full_html);
- jstemplate_builder::AppendI18nTemplateSourceHtml(&full_html);
- jstemplate_builder::AppendI18nTemplateProcessHtml(&full_html);
- jstemplate_builder::AppendJsTemplateSourceHtml(&full_html);
-
- scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes);
- html_bytes->data.resize(full_html.size());
- std::copy(full_html.begin(), full_html.end(), html_bytes->data.begin());
-
- SendResponse(request_id, html_bytes);
+ChromeWebUIDataSource* CreateConflictsUIHTMLSource() {
+ ChromeWebUIDataSource* source =
+ new ChromeWebUIDataSource(chrome::kChromeUIConflictsHost);
+
+ source->AddLocalizedString("loadingMessage", IDS_CONFLICTS_LOADING_MESSAGE);
+ source->AddLocalizedString("modulesLongTitle",
+ IDS_CONFLICTS_CHECK_PAGE_TITLE_LONG);
+ source->AddLocalizedString("modulesBlurb", IDS_CONFLICTS_EXPLANATION_TEXT);
+ source->AddLocalizedString("moduleSuspectedBad",
+ IDS_CONFLICTS_CHECK_WARNING_SUSPECTED);
+ source->AddLocalizedString("moduleConfirmedBad",
+ IDS_CONFLICTS_CHECK_WARNING_CONFIRMED);
+ source->AddLocalizedString("helpCenterLink", IDS_CONFLICTS_HELP_CENTER_LINK);
+ source->AddLocalizedString("investigatingText",
+ IDS_CONFLICTS_CHECK_INVESTIGATING);
+ source->AddLocalizedString("modulesNoneLoaded",
+ IDS_CONFLICTS_NO_MODULES_LOADED);
+ source->AddLocalizedString("headerSoftware", IDS_CONFLICTS_HEADER_SOFTWARE);
+ source->AddLocalizedString("headerSignedBy", IDS_CONFLICTS_HEADER_SIGNED_BY);
+ source->AddLocalizedString("headerLocation", IDS_CONFLICTS_HEADER_LOCATION);
+ source->AddLocalizedString("headerVersion", IDS_CONFLICTS_HEADER_VERSION);
+ source->AddLocalizedString("headerHelpTip", IDS_CONFLICTS_HEADER_HELP_TIP);
+ source->set_json_path("strings.js");
+ source->add_resource_path("conflicts.js", IDR_ABOUT_CONFLICTS_JS);
+ source->set_default_resource(IDR_ABOUT_CONFLICTS_HTML);
+ return source;
}
////////////////////////////////////////////////////////////////////////////////
@@ -199,15 +153,12 @@ void ConflictsDOMHandler::Observe(int type,
///////////////////////////////////////////////////////////////////////////////
ConflictsUI::ConflictsUI(TabContents* contents) : ChromeWebUI(contents) {
- UserMetrics::RecordAction(
- UserMetricsAction("ViewAboutConflicts"));
-
+ UserMetrics::RecordAction(UserMetricsAction("ViewAboutConflicts"));
AddMessageHandler((new ConflictsDOMHandler())->Attach(this));
- ConflictsUIHTMLSource* html_source = new ConflictsUIHTMLSource();
-
// Set up the about:conflicts source.
- contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source);
+ contents->profile()->GetChromeURLDataManager()->AddDataSource(
+ CreateConflictsUIHTMLSource());
}
// static
diff --git a/chrome/test/functional/special_tabs.py b/chrome/test/functional/special_tabs.py
index ab2e94d..620f326 100644
--- a/chrome/test/functional/special_tabs.py
+++ b/chrome/test/functional/special_tabs.py
@@ -151,7 +151,7 @@ class SpecialTabsTest(pyauto.PyUITest):
}
win_special_url_tabs = {
- 'chrome://conflicts': { 'CSP': False },
+ 'chrome://conflicts': {},
# OVERRIDE - different title for page.
'chrome://settings': { 'title': 'Options - Basics' },