summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authormihaip@chromium.org <mihaip@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-04 18:27:57 +0000
committermihaip@chromium.org <mihaip@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-04 18:27:57 +0000
commit5e3477e34c93c52e03f10101909ceeb71324b38c (patch)
tree1484fa0fcf8bb278a4337996c978cbafeb1a16a6 /chrome
parent27e2aac0cf49bc7e72e71c1f550c95bd62c001e1 (diff)
downloadchromium_src-5e3477e34c93c52e03f10101909ceeb71324b38c.zip
chromium_src-5e3477e34c93c52e03f10101909ceeb71324b38c.tar.gz
chromium_src-5e3477e34c93c52e03f10101909ceeb71324b38c.tar.bz2
Remove content_scripts and permissions from detail JSON output.
Neither seems to be used anywhere. BUG=none TEST=ExtensionUITest.* R=aa@chromium.org,finnur@chromium.org Review URL: http://codereview.chromium.org/6788026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80344 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/extensions/extension_ui_unittest.cc15
-rw-r--r--chrome/browser/extensions/extensions_ui.cc60
-rw-r--r--chrome/browser/extensions/extensions_ui.h5
-rw-r--r--chrome/browser/resources/extensions_ui.html36
-rw-r--r--chrome/browser/ui/webui/options/extension_settings_handler.cc60
-rw-r--r--chrome/test/data/extensions/ui/create_extension_detail_value_expected_output/good-extension1.json12
-rw-r--r--chrome/test/data/extensions/ui/create_extension_detail_value_expected_output/good-extension2.json2
-rw-r--r--chrome/test/data/extensions/ui/create_extension_detail_value_expected_output/good-extension3.json2
8 files changed, 12 insertions, 180 deletions
diff --git a/chrome/browser/extensions/extension_ui_unittest.cc b/chrome/browser/extensions/extension_ui_unittest.cc
index e8b440d..953abbc 100644
--- a/chrome/browser/extensions/extension_ui_unittest.cc
+++ b/chrome/browser/extensions/extension_ui_unittest.cc
@@ -61,18 +61,23 @@ namespace {
// Compare the outputs.
// Ignore unknown fields in the actual output data.
+ std::string paths_details = " - expected (" +
+ expected_output_path.MaybeAsASCII() + ") vs. actual (" +
+ extension_path.MaybeAsASCII() + ")";
for (DictionaryValue::key_iterator key = expected_output_data->begin_keys();
key != expected_output_data->end_keys();
++key) {
Value* expected_value = NULL;
Value* actual_value = NULL;
- EXPECT_TRUE(expected_output_data->Get(*key, &expected_value));
- EXPECT_TRUE(actual_output_data->Get(*key, &actual_value));
+ EXPECT_TRUE(expected_output_data->Get(*key, &expected_value)) <<
+ *key + " is missing" + paths_details;
+ EXPECT_TRUE(actual_output_data->Get(*key, &actual_value)) <<
+ *key + " is missing" + paths_details;
if (expected_value == NULL) {
- EXPECT_EQ(NULL, actual_value) << extension_path.value();
+ EXPECT_EQ(NULL, actual_value) << *key + paths_details;
} else {
- EXPECT_TRUE(expected_value->Equals(actual_value))
- << extension_path.value();
+ EXPECT_TRUE(expected_value->Equals(actual_value)) << *key +
+ paths_details;
}
}
}
diff --git a/chrome/browser/extensions/extensions_ui.cc b/chrome/browser/extensions/extensions_ui.cc
index d332354..3b95bee 100644
--- a/chrome/browser/extensions/extensions_ui.cc
+++ b/chrome/browser/extensions/extensions_ui.cc
@@ -675,46 +675,6 @@ void ExtensionsDOMHandler::MaybeUpdateAfterNotification() {
deleting_rvh_ = NULL;
}
-static void CreateScriptFileDetailValue(
- const FilePath& extension_path, const UserScript::FileList& scripts,
- const char* key, DictionaryValue* script_data) {
- if (scripts.empty())
- return;
-
- ListValue *list = new ListValue();
- for (size_t i = 0; i < scripts.size(); ++i) {
- const UserScript::File& file = scripts[i];
- // TODO(cira): this information is not used on extension page yet. We
- // may want to display actual resource that got loaded, not default.
- list->Append(
- new StringValue(file.relative_path().value()));
- }
- script_data->Set(key, list);
-}
-
-// Static
-DictionaryValue* ExtensionsDOMHandler::CreateContentScriptDetailValue(
- const UserScript& script, const FilePath& extension_path) {
- DictionaryValue* script_data = new DictionaryValue();
- CreateScriptFileDetailValue(extension_path, script.js_scripts(), "js",
- script_data);
- CreateScriptFileDetailValue(extension_path, script.css_scripts(), "css",
- script_data);
-
- // Get list of glob "matches" strings
- ListValue *url_pattern_list = new ListValue();
- const std::vector<URLPattern>& url_patterns = script.url_patterns();
- for (std::vector<URLPattern>::const_iterator url_pattern =
- url_patterns.begin();
- url_pattern != url_patterns.end(); ++url_pattern) {
- url_pattern_list->Append(new StringValue(url_pattern->GetAsString()));
- }
-
- script_data->Set("matches", url_pattern_list);
-
- return script_data;
-}
-
// Static
DictionaryValue* ExtensionsDOMHandler::CreateExtensionDetailValue(
ExtensionService* service, const Extension* extension,
@@ -760,26 +720,6 @@ DictionaryValue* ExtensionsDOMHandler::CreateExtensionDetailValue(
if (service && !service->GetBrowserActionVisibility(extension))
extension_data->SetBoolean("enable_show_button", true);
- // Add list of content_script detail DictionaryValues.
- ListValue *content_script_list = new ListValue();
- UserScriptList content_scripts = extension->content_scripts();
- for (UserScriptList::const_iterator script = content_scripts.begin();
- script != content_scripts.end(); ++script) {
- content_script_list->Append(
- CreateContentScriptDetailValue(*script, extension->path()));
- }
- extension_data->Set("content_scripts", content_script_list);
-
- // Add permissions.
- ListValue *permission_list = new ListValue;
- std::vector<URLPattern> permissions = extension->host_permissions();
- for (std::vector<URLPattern>::iterator permission = permissions.begin();
- permission != permissions.end(); ++permission) {
- permission_list->Append(Value::CreateStringValue(
- permission->GetAsString()));
- }
- extension_data->Set("permissions", permission_list);
-
// Add views
ListValue* views = new ListValue;
for (std::vector<ExtensionPage>::const_iterator iter = pages.begin();
diff --git a/chrome/browser/extensions/extensions_ui.h b/chrome/browser/extensions/extensions_ui.h
index 5f4a9d2..d743160 100644
--- a/chrome/browser/extensions/extensions_ui.h
+++ b/chrome/browser/extensions/extensions_ui.h
@@ -81,11 +81,6 @@ class ExtensionsDOMHandler : public WebUIMessageHandler,
bool enabled,
bool terminated);
- // ContentScript JSON Struct for page. (static for ease of testing).
- static DictionaryValue* CreateContentScriptDetailValue(
- const UserScript& script,
- const FilePath& extension_path);
-
// ExtensionPackJob::Client
virtual void OnPackSuccess(const FilePath& crx_file,
const FilePath& key_file);
diff --git a/chrome/browser/resources/extensions_ui.html b/chrome/browser/resources/extensions_ui.html
index e3ef946..4da383b 100644
--- a/chrome/browser/resources/extensions_ui.html
+++ b/chrome/browser/resources/extensions_ui.html
@@ -343,18 +343,6 @@ var extensionDataFormat = {
'options_url': 'options.html',
'enable_show_button': false,
'icon': 'relative-path-to-icon.png',
- 'content_scripts': [
- {
- 'js': ['script1_file1.js', 'script1_file2.js'],
- 'css': ['script1_file1.css', 'script1_file2.css'],
- 'matches': ['http://*/*', 'http://other.com/*']
- },
- {
- 'js': ['script2_file1.js', 'script2_file2.js'],
- 'css': ['script2_file1.css', 'script2_file2.css'],
- 'matches': ['http://*/*', 'http://other.com/*']
- }
- ],
// TODO(aa): It would be nice to also render what type of view each one
// is, like 'toolstrip', 'background', etc. Eventually, if we can also
// debug and inspect content scripts, maybe we don't need to list the
@@ -389,26 +377,6 @@ var extensionDataFormat = {
'is_hosted_app': false,
'order': 2,
'icon': '',
- 'content_scripts': [
- {
- 'js': ['script1_file1.js', 'script1_file2.js'],
- 'css': ['script1_file1.css', 'script1_file2.css'],
- 'matches': ['http://*/*', 'http://other.com/*']
- },
- {
- 'js': ['script2_file1.js', 'script2_file2.js'],
- 'css': ['script2_file1.css', 'script2_file2.css'],
- 'matches': ['http://*/*', 'http://other.com/*']
- }
- ],
- 'views': [
- {
- 'path': 'foo/bar/toolstrip.html',
- 'renderViewId': 3,
- 'renderProcessId': 1,
- 'incognito': false
- }
- ],
"hasPopupAction": false
}
]
@@ -907,7 +875,7 @@ document.addEventListener('DOMContentLoaded', requestExtensionsData);
href="javascript:void 0;"
i18n-content="uninstall"
>UNINSTALL</a>
- <span jsdisplay="options_url && enabled">-</span>
+ <span jsdisplay="options_url && enabled">-</span>
<a
jsdisplay="options_url && enabled"
jsvalues=".extensionId:id"
@@ -938,7 +906,7 @@ document.addEventListener('DOMContentLoaded', requestExtensionsData);
onchange="handleToggleAllowFileAccess(this)">
<span i18n-content="allowFileAccess">ALLOW THIS EXTENSION ACCESS TO FILE URLS</span></label>
<span jsdisplay="!mayDisable">-</span>
- <span jsdisplay="!mayDisable"
+ <span jsdisplay="!mayDisable"
i18n-content="policyControlled">THIS EXTENSION CAN NOT BE DISABLED OR UNINSTALLED BY USER</span>
</span>
</div>
diff --git a/chrome/browser/ui/webui/options/extension_settings_handler.cc b/chrome/browser/ui/webui/options/extension_settings_handler.cc
index 49b43a1..0796863 100644
--- a/chrome/browser/ui/webui/options/extension_settings_handler.cc
+++ b/chrome/browser/ui/webui/options/extension_settings_handler.cc
@@ -766,46 +766,6 @@ void ExtensionsDOMHandler::MaybeUpdateAfterNotification() {
deleting_rvh_ = NULL;
}
-static void CreateScriptFileDetailValue(
- const FilePath& extension_path, const UserScript::FileList& scripts,
- const char* key, DictionaryValue* script_data) {
- if (scripts.empty())
- return;
-
- ListValue *list = new ListValue();
- for (size_t i = 0; i < scripts.size(); ++i) {
- const UserScript::File& file = scripts[i];
- // TODO(cira): this information is not used on extension page yet. We
- // may want to display actual resource that got loaded, not default.
- list->Append(
- new StringValue(file.relative_path().value()));
- }
- script_data->Set(key, list);
-}
-
-// Static
-DictionaryValue* ExtensionsDOMHandler::CreateContentScriptDetailValue(
- const UserScript& script, const FilePath& extension_path) {
- DictionaryValue* script_data = new DictionaryValue();
- CreateScriptFileDetailValue(extension_path, script.js_scripts(), "js",
- script_data);
- CreateScriptFileDetailValue(extension_path, script.css_scripts(), "css",
- script_data);
-
- // Get list of glob "matches" strings
- ListValue *url_pattern_list = new ListValue();
- const std::vector<URLPattern>& url_patterns = script.url_patterns();
- for (std::vector<URLPattern>::const_iterator url_pattern =
- url_patterns.begin();
- url_pattern != url_patterns.end(); ++url_pattern) {
- url_pattern_list->Append(new StringValue(url_pattern->GetAsString()));
- }
-
- script_data->Set("matches", url_pattern_list);
-
- return script_data;
-}
-
// Static
DictionaryValue* ExtensionsDOMHandler::CreateExtensionDetailValue(
ExtensionService* service, const Extension* extension,
@@ -840,26 +800,6 @@ DictionaryValue* ExtensionsDOMHandler::CreateExtensionDetailValue(
if (service && !service->GetBrowserActionVisibility(extension))
extension_data->SetBoolean("enable_show_button", true);
- // Add list of content_script detail DictionaryValues.
- ListValue *content_script_list = new ListValue();
- UserScriptList content_scripts = extension->content_scripts();
- for (UserScriptList::const_iterator script = content_scripts.begin();
- script != content_scripts.end(); ++script) {
- content_script_list->Append(
- CreateContentScriptDetailValue(*script, extension->path()));
- }
- extension_data->Set("content_scripts", content_script_list);
-
- // Add permissions.
- ListValue *permission_list = new ListValue;
- std::vector<URLPattern> permissions = extension->host_permissions();
- for (std::vector<URLPattern>::iterator permission = permissions.begin();
- permission != permissions.end(); ++permission) {
- permission_list->Append(Value::CreateStringValue(
- permission->GetAsString()));
- }
- extension_data->Set("permissions", permission_list);
-
// Add views
ListValue* views = new ListValue;
for (std::vector<ExtensionPage>::const_iterator iter = pages.begin();
diff --git a/chrome/test/data/extensions/ui/create_extension_detail_value_expected_output/good-extension1.json b/chrome/test/data/extensions/ui/create_extension_detail_value_expected_output/good-extension1.json
index 6f8a6f0c..a0ea15d 100644
--- a/chrome/test/data/extensions/ui/create_extension_detail_value_expected_output/good-extension1.json
+++ b/chrome/test/data/extensions/ui/create_extension_detail_value_expected_output/good-extension1.json
@@ -6,24 +6,12 @@
"enabled": true,
"terminated": false,
"description": "__MSG_chrome_extension_description__",
- "permissions": ["http://*.google.com/*", "https://*.google.com/*"],
"allow_reload": false,
"is_hosted_app": false,
"order": 2,
"enabledIncognito": false,
"wantsFileAccess": true,
"allowFileAccess": false,
- "content_scripts": [
- {
- "matches": ["file://*", "http://*.google.com/*", "https://*.google.com/*"],
- "js": ["script1.js", "script2.js"],
- "css": ["style1.css", "style2.css", "style2.css"]
- },
- {
- "matches": ["http://*.news.com/*"],
- "js": ["js_files/script3.js"]
- }
- ],
"views": [
{
"path": "bar.html",
diff --git a/chrome/test/data/extensions/ui/create_extension_detail_value_expected_output/good-extension2.json b/chrome/test/data/extensions/ui/create_extension_detail_value_expected_output/good-extension2.json
index 56bcff0..8e8b166 100644
--- a/chrome/test/data/extensions/ui/create_extension_detail_value_expected_output/good-extension2.json
+++ b/chrome/test/data/extensions/ui/create_extension_detail_value_expected_output/good-extension2.json
@@ -6,14 +6,12 @@
"enabled": true,
"terminated": false,
"description": "",
- "permissions": [],
"allow_reload": false,
"is_hosted_app": false,
"order": 2,
"enabledIncognito": false,
"wantsFileAccess": false,
"allowFileAccess": false,
- "content_scripts": [],
"views": [
{
"path": "bar.html",
diff --git a/chrome/test/data/extensions/ui/create_extension_detail_value_expected_output/good-extension3.json b/chrome/test/data/extensions/ui/create_extension_detail_value_expected_output/good-extension3.json
index 990605f..f0413a7 100644
--- a/chrome/test/data/extensions/ui/create_extension_detail_value_expected_output/good-extension3.json
+++ b/chrome/test/data/extensions/ui/create_extension_detail_value_expected_output/good-extension3.json
@@ -6,14 +6,12 @@
"enabled": true,
"terminated": false,
"description": "",
- "permissions": [],
"allow_reload": false,
"is_hosted_app": false,
"order": 2,
"enabledIncognito": false,
"wantsFileAccess": false,
"allowFileAccess": false,
- "content_scripts": [],
"views": [],
"hasPopupAction": false,
"homepageUrl": "",