summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-27 14:34:12 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-27 14:34:12 +0000
commit0082d7e0d4531edc2a923ec9ca990c74397cdae2 (patch)
treea669316a8a234b44f39ebf085d5b5785d7357ce9 /chrome/common/extensions
parent1b7e93b7e3ac1f74f61a83d6c6eb1575d427b578 (diff)
downloadchromium_src-0082d7e0d4531edc2a923ec9ca990c74397cdae2.zip
chromium_src-0082d7e0d4531edc2a923ec9ca990c74397cdae2.tar.gz
chromium_src-0082d7e0d4531edc2a923ec9ca990c74397cdae2.tar.bz2
Continue removing bad dependency of chrome/common on chrome/browser
TEST=none BUG=none Review URL: http://codereview.chromium.org/661178 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40224 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/extensions')
-rw-r--r--chrome/common/extensions/extension_l10n_util.cc12
-rw-r--r--chrome/common/extensions/extension_l10n_util.h6
-rw-r--r--chrome/common/extensions/extension_l10n_util_unittest.cc97
3 files changed, 0 insertions, 115 deletions
diff --git a/chrome/common/extensions/extension_l10n_util.cc b/chrome/common/extensions/extension_l10n_util.cc
index 3f329fb..e7406b2 100644
--- a/chrome/common/extensions/extension_l10n_util.cc
+++ b/chrome/common/extensions/extension_l10n_util.cc
@@ -14,7 +14,6 @@
#include "base/string_util.h"
#include "base/values.h"
#include "chrome/browser/browser_process.h"
-#include "chrome/browser/renderer_host/resource_dispatcher_host_request_info.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/extensions/extension_file_util.h"
@@ -296,15 +295,4 @@ ExtensionMessageBundle* LoadMessageCatalogs(
return ExtensionMessageBundle::Create(catalogs, error);
}
-void ApplyMessageFilterPolicy(const GURL& url,
- const ResourceType::Type& resource_type,
- ResourceDispatcherHostRequestInfo* request_info) {
- // Apply filter only to chrome extension css files that don't have
- // security filter already set.
- if (url.SchemeIs(chrome::kExtensionScheme) &&
- request_info->filter_policy() == FilterPolicy::DONT_FILTER &&
- resource_type == ResourceType::STYLESHEET)
- request_info->set_filter_policy(FilterPolicy::FILTER_EXTENSION_MESSAGES);
-}
-
} // namespace extension_l10n_util
diff --git a/chrome/common/extensions/extension_l10n_util.h b/chrome/common/extensions/extension_l10n_util.h
index a63bfdb..886db24 100644
--- a/chrome/common/extensions/extension_l10n_util.h
+++ b/chrome/common/extensions/extension_l10n_util.h
@@ -95,12 +95,6 @@ ExtensionMessageBundle* LoadMessageCatalogs(
const std::set<std::string>& valid_locales,
std::string* error);
-// Applies FilterPolicy::FILTER_EXTENSION_MESSAGES to all text/css requests
-// that have "chrome-extension://" scheme.
-void ApplyMessageFilterPolicy(const GURL& url,
- const ResourceType::Type& resource_type,
- ResourceDispatcherHostRequestInfo* request_info);
-
} // namespace extension_l10n_util
#endif // CHROME_COMMON_EXTENSIONS_EXTENSION_L10N_UTIL_H_
diff --git a/chrome/common/extensions/extension_l10n_util_unittest.cc b/chrome/common/extensions/extension_l10n_util_unittest.cc
index 3fb2f7a..c2211a7 100644
--- a/chrome/common/extensions/extension_l10n_util_unittest.cc
+++ b/chrome/common/extensions/extension_l10n_util_unittest.cc
@@ -10,8 +10,6 @@
#include "base/scoped_ptr.h"
#include "base/scoped_temp_dir.h"
#include "base/values.h"
-#include "chrome/browser/renderer_host/resource_dispatcher_host_request_info.h"
-#include "chrome/browser/renderer_host/resource_handler.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_constants.h"
@@ -382,99 +380,4 @@ TEST(ExtensionL10nUtil, ShouldRelocalizeManifestDifferentCurrentLocale) {
EXPECT_TRUE(extension_l10n_util::ShouldRelocalizeManifest(info));
}
-class DummyResourceHandler : public ResourceHandler {
- public:
- DummyResourceHandler() {}
-
- bool OnRequestRedirected(int request_id, const GURL& url,
- ResourceResponse* response, bool* defer) {
- return true;
- }
-
- bool OnResponseStarted(int request_id, ResourceResponse* response) {
- return true;
- }
-
- bool OnWillRead(
- int request_id, net::IOBuffer** buf, int* buf_size, int min_size) {
- return true;
- }
-
- bool OnReadCompleted(int request_id, int* bytes_read) { return true; }
-
- bool OnResponseCompleted(
- int request_id, const URLRequestStatus& status, const std::string& info) {
- return true;
- }
-
- private:
- DISALLOW_COPY_AND_ASSIGN(DummyResourceHandler);
-};
-
-class ApplyMessageFilterPolicyTest : public testing::Test {
- protected:
- void SetUp() {
- url_.reset(new GURL(
- "chrome-extension://behllobkkfkfnphdnhnkndlbkcpglgmj/popup.html"));
- resource_type_ = ResourceType::STYLESHEET;
- resource_handler_.reset(new DummyResourceHandler());
- request_info_.reset(CreateNewResourceRequestInfo());
- }
-
- ResourceDispatcherHostRequestInfo* CreateNewResourceRequestInfo() {
- return new ResourceDispatcherHostRequestInfo(
- resource_handler_.get(), ChildProcessInfo::RENDER_PROCESS, 0, 0, 0,
- "not important", "not important",
- ResourceType::STYLESHEET, 0U, false, false, -1, -1);
- }
-
- scoped_ptr<GURL> url_;
- ResourceType::Type resource_type_;
- scoped_ptr<DummyResourceHandler> resource_handler_;
- scoped_ptr<ResourceDispatcherHostRequestInfo> request_info_;
-};
-
-TEST_F(ApplyMessageFilterPolicyTest, WrongScheme) {
- url_.reset(new GURL("html://behllobkkfkfnphdnhnkndlbkcpglgmj/popup.html"));
- extension_l10n_util::ApplyMessageFilterPolicy(
- *url_, resource_type_, request_info_.get());
-
- EXPECT_EQ(FilterPolicy::DONT_FILTER, request_info_->filter_policy());
-}
-
-TEST_F(ApplyMessageFilterPolicyTest, GoodScheme) {
- extension_l10n_util::ApplyMessageFilterPolicy(
- *url_, resource_type_, request_info_.get());
-
- EXPECT_EQ(FilterPolicy::FILTER_EXTENSION_MESSAGES,
- request_info_->filter_policy());
-}
-
-TEST_F(ApplyMessageFilterPolicyTest, GoodSchemeWithSecurityFilter) {
- request_info_->set_filter_policy(FilterPolicy::FILTER_ALL_EXCEPT_IMAGES);
- extension_l10n_util::ApplyMessageFilterPolicy(
- *url_, resource_type_, request_info_.get());
-
- EXPECT_EQ(FilterPolicy::FILTER_ALL_EXCEPT_IMAGES,
- request_info_->filter_policy());
-}
-
-TEST_F(ApplyMessageFilterPolicyTest, GoodSchemeWrongResourceType) {
- resource_type_ = ResourceType::MAIN_FRAME;
- extension_l10n_util::ApplyMessageFilterPolicy(
- *url_, resource_type_, request_info_.get());
-
- EXPECT_EQ(FilterPolicy::DONT_FILTER, request_info_->filter_policy());
-}
-
-TEST_F(ApplyMessageFilterPolicyTest, WrongSchemeResourceAndFilter) {
- url_.reset(new GURL("html://behllobkkfkfnphdnhnkndlbkcpglgmj/popup.html"));
- resource_type_ = ResourceType::MEDIA;
- request_info_->set_filter_policy(FilterPolicy::FILTER_ALL);
- extension_l10n_util::ApplyMessageFilterPolicy(
- *url_, resource_type_, request_info_.get());
-
- EXPECT_EQ(FilterPolicy::FILTER_ALL, request_info_->filter_policy());
-}
-
} // namespace