diff options
27 files changed, 200 insertions, 183 deletions
diff --git a/chrome/common/appcache/appcache_dispatcher_host.cc b/chrome/browser/appcache/appcache_dispatcher_host.cc index e2f1d11..ee4ba3a 100644 --- a/chrome/common/appcache/appcache_dispatcher_host.cc +++ b/chrome/browser/appcache/appcache_dispatcher_host.cc @@ -2,13 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/appcache/appcache_dispatcher_host.h" +#include "chrome/browser/appcache/appcache_dispatcher_host.h" #include "base/callback.h" +#include "chrome/browser/appcache/chrome_appcache_service.h" #include "chrome/browser/renderer_host/browser_render_process_host.h" -// TODO(eroman): uh oh, depending on stuff outside of common/ #include "chrome/browser/net/chrome_url_request_context.h" -#include "chrome/common/appcache/chrome_appcache_service.h" #include "chrome/common/render_messages.h" AppCacheDispatcherHost::AppCacheDispatcherHost( diff --git a/chrome/common/appcache/appcache_dispatcher_host.h b/chrome/browser/appcache/appcache_dispatcher_host.h index 9ad46fb..ea2fe93 100644 --- a/chrome/common/appcache/appcache_dispatcher_host.h +++ b/chrome/browser/appcache/appcache_dispatcher_host.h @@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_COMMON_APPCACHE_APPCACHE_DISPATCHER_HOST_H_ -#define CHROME_COMMON_APPCACHE_APPCACHE_DISPATCHER_HOST_H_ +#ifndef CHROME_BROWSER_APPCACHE_APPCACHE_DISPATCHER_HOST_H_ +#define CHROME_BROWSER_APPCACHE_APPCACHE_DISPATCHER_HOST_H_ #include <vector> #include "base/process.h" #include "base/ref_counted.h" #include "base/scoped_ptr.h" -#include "chrome/common/appcache/appcache_frontend_proxy.h" +#include "chrome/browser/appcache/appcache_frontend_proxy.h" #include "ipc/ipc_message.h" #include "webkit/appcache/appcache_backend_impl.h" @@ -75,4 +75,4 @@ class AppCacheDispatcherHost { DISALLOW_COPY_AND_ASSIGN(AppCacheDispatcherHost); }; -#endif // CHROME_COMMON_APPCACHE_APPCACHE_DISPATCHER_HOST_H_ +#endif // CHROME_BROWSER_APPCACHE_APPCACHE_DISPATCHER_HOST_H_ diff --git a/chrome/common/appcache/appcache_frontend_proxy.cc b/chrome/browser/appcache/appcache_frontend_proxy.cc index 08c8510..c0448592 100644 --- a/chrome/common/appcache/appcache_frontend_proxy.cc +++ b/chrome/browser/appcache/appcache_frontend_proxy.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/appcache/appcache_frontend_proxy.h" +#include "chrome/browser/appcache/appcache_frontend_proxy.h" #include "chrome/common/render_messages.h" diff --git a/chrome/common/appcache/appcache_frontend_proxy.h b/chrome/browser/appcache/appcache_frontend_proxy.h index b18f9bb..78865ab 100644 --- a/chrome/common/appcache/appcache_frontend_proxy.h +++ b/chrome/browser/appcache/appcache_frontend_proxy.h @@ -2,10 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_COMMON_APPCACHE_APPCACHE_FRONTEND_PROXY_H_ -#define CHROME_COMMON_APPCACHE_APPCACHE_FRONTEND_PROXY_H_ +#ifndef CHROME_BROWSER_APPCACHE_APPCACHE_FRONTEND_PROXY_H_ +#define CHROME_BROWSER_APPCACHE_APPCACHE_FRONTEND_PROXY_H_ #include <vector> + #include "ipc/ipc_message.h" #include "webkit/appcache/appcache_interfaces.h" @@ -28,4 +29,4 @@ class AppCacheFrontendProxy : public appcache::AppCacheFrontend { IPC::Message::Sender* sender_; }; -#endif // CHROME_COMMON_APPCACHE_APPCACHE_FRONTEND_PROXY_H_ +#endif // CHROME_BROWSER_APPCACHE_APPCACHE_FRONTEND_PROXY_H_ diff --git a/chrome/common/appcache/chrome_appcache_service.cc b/chrome/browser/appcache/chrome_appcache_service.cc index 5fdb17f..8a5160a 100644 --- a/chrome/common/appcache/chrome_appcache_service.cc +++ b/chrome/browser/appcache/chrome_appcache_service.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/appcache/chrome_appcache_service.h" +#include "chrome/browser/appcache/chrome_appcache_service.h" #include "base/file_path.h" #include "base/file_util.h" diff --git a/chrome/common/appcache/chrome_appcache_service.h b/chrome/browser/appcache/chrome_appcache_service.h index fd36a05..848a83f 100644 --- a/chrome/common/appcache/chrome_appcache_service.h +++ b/chrome/browser/appcache/chrome_appcache_service.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_COMMON_APPCACHE_CHROME_APPCACHE_SERVICE_H_ -#define CHROME_COMMON_APPCACHE_CHROME_APPCACHE_SERVICE_H_ +#ifndef CHROME_BROWSER_APPCACHE_CHROME_APPCACHE_SERVICE_H_ +#define CHROME_BROWSER_APPCACHE_CHROME_APPCACHE_SERVICE_H_ #include "base/ref_counted.h" #include "chrome/browser/host_content_settings_map.h" @@ -51,4 +51,4 @@ class ChromeAppCacheService NotificationRegistrar registrar_; }; -#endif // CHROME_COMMON_APPCACHE_CHROME_APPCACHE_SERVICE_H_ +#endif // CHROME_BROWSER_APPCACHE_CHROME_APPCACHE_SERVICE_H_ diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc index d993afb..b7311b7 100644 --- a/chrome/browser/automation/automation_provider.cc +++ b/chrome/browser/automation/automation_provider.cc @@ -2005,11 +2005,6 @@ void AutomationProvider::SavePackageShouldPromptUser(bool should_prompt) { SavePackage::SetShouldPromptUser(should_prompt); } -void AutomationProvider::GetWindowTitle(int handle, string16* text) { - gfx::NativeWindow window = window_tracker_->GetResource(handle); - text->assign(platform_util::GetWindowTitle(window)); -} - void AutomationProvider::GetBlockedPopupCount(int handle, int* count) { *count = -1; // -1 is the error code if (tab_tracker_->ContainsHandle(handle)) { diff --git a/chrome/browser/automation/automation_provider_gtk.cc b/chrome/browser/automation/automation_provider_gtk.cc index f7c7292..cc7050c 100644 --- a/chrome/browser/automation/automation_provider_gtk.cc +++ b/chrome/browser/automation/automation_provider_gtk.cc @@ -228,3 +228,10 @@ void AutomationProvider::GetWindowBounds(int handle, gfx::Rect* bounds, *result = false; NOTIMPLEMENTED(); } + +void AutomationProvider::GetWindowTitle(int handle, string16* text) { + gfx::NativeWindow window = window_tracker_->GetResource(handle); + const gchar* title = gtk_window_get_title(window); + text->assign(UTF8ToUTF16(title)); +} + diff --git a/chrome/browser/automation/automation_provider_mac.mm b/chrome/browser/automation/automation_provider_mac.mm index 907dafc..78ac739 100644 --- a/chrome/browser/automation/automation_provider_mac.mm +++ b/chrome/browser/automation/automation_provider_mac.mm @@ -5,9 +5,15 @@ #include "chrome/browser/automation/automation_provider.h" #import <Cocoa/Cocoa.h> + +#include "app/l10n_util.h" +#include "app/l10n_util_mac.h" #include "base/gfx/point.h" #include "base/gfx/rect.h" +#include "base/sys_string_conversions.h" +#include "chrome/browser/cocoa/tab_window_controller.h" #include "chrome/test/automation/automation_messages.h" +#include "grit/generated_resources.h" void AutomationProvider::SetWindowBounds(int handle, const gfx::Rect& bounds, bool* success) { @@ -138,3 +144,24 @@ void AutomationProvider::GetWindowBounds(int handle, gfx::Rect* bounds, *result = false; NOTIMPLEMENTED(); } + +void AutomationProvider::GetWindowTitle(int handle, string16* text) { + gfx::NativeWindow window = window_tracker_->GetResource(handle); + NSString* title = nil; + if ([[window delegate] isKindOfClass:[TabWindowController class]]) { + TabWindowController* delegate = + reinterpret_cast<TabWindowController*>([window delegate]); + title = [delegate selectedTabTitle]; + } else { + title = [window title]; + } + // If we don't yet have a title, use "Untitled". + if (![title length]) { + text->assign(WideToUTF16(l10n_util::GetString( + IDS_BROWSER_WINDOW_MAC_TAB_UNTITLED))); + return; + } + + text->assign(base::SysNSStringToUTF16(title)); +} + diff --git a/chrome/browser/automation/automation_provider_win.cc b/chrome/browser/automation/automation_provider_win.cc index 59d9867..d31836f9 100644 --- a/chrome/browser/automation/automation_provider_win.cc +++ b/chrome/browser/automation/automation_provider_win.cc @@ -516,3 +516,11 @@ void AutomationProvider::OnBrowserMoved(int tab_handle) { "AutomationProvider::OnBrowserMoved called with invalid tab handle."; } } + +void AutomationProvider::GetWindowTitle(int handle, string16* text) { + gfx::NativeWindow window = window_tracker_->GetResource(handle); + std::wstring result; + int length = ::GetWindowTextLength(window) + 1; + ::GetWindowText(window, WriteInto(&result, length), length); + text->assign(WideToUTF16(result)); +} diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc index 9edd612..87793fa 100644 --- a/chrome/browser/browser_process_impl.cc +++ b/chrome/browser/browser_process_impl.cc @@ -11,6 +11,7 @@ #include "base/path_service.h" #include "base/thread.h" #include "base/waitable_event.h" +#include "chrome/browser/appcache/chrome_appcache_service.h" #include "chrome/browser/browser_main.h" #include "chrome/browser/browser_process_sub_thread.h" #include "chrome/browser/browser_trial.h" @@ -37,7 +38,6 @@ #include "chrome/browser/renderer_host/render_process_host.h" #include "chrome/browser/renderer_host/resource_dispatcher_host.h" #include "chrome/browser/safe_browsing/safe_browsing_service.h" -#include "chrome/common/appcache/chrome_appcache_service.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" diff --git a/chrome/browser/browsing_data_appcache_helper.h b/chrome/browser/browsing_data_appcache_helper.h index 8c28d40..aa04dae 100644 --- a/chrome/browser/browsing_data_appcache_helper.h +++ b/chrome/browser/browsing_data_appcache_helper.h @@ -10,7 +10,7 @@ #include "base/scoped_ptr.h" #include "base/task.h" -#include "chrome/common/appcache/chrome_appcache_service.h" +#include "chrome/browser/appcache/chrome_appcache_service.h" class Profile; diff --git a/chrome/browser/net/chrome_url_request_context.h b/chrome/browser/net/chrome_url_request_context.h index c4a5023..1aea2b0 100644 --- a/chrome/browser/net/chrome_url_request_context.h +++ b/chrome/browser/net/chrome_url_request_context.h @@ -8,6 +8,7 @@ #include "base/file_path.h" #include "base/linked_ptr.h" #include "net/base/cookie_policy.h" +#include "chrome/browser/appcache/chrome_appcache_service.h" #include "chrome/browser/host_content_settings_map.h" #include "chrome/browser/host_zoom_map.h" #include "chrome/browser/io_thread.h" @@ -15,7 +16,6 @@ #include "chrome/browser/privacy_blacklist/blacklist.h" #include "chrome/browser/net/chrome_cookie_policy.h" #include "chrome/browser/net/url_request_context_getter.h" -#include "chrome/common/appcache/chrome_appcache_service.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/notification_registrar.h" #include "net/url_request/url_request_context.h" diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc index a83ad4a..6a3bd8c 100644 --- a/chrome/browser/profile.cc +++ b/chrome/browser/profile.cc @@ -11,6 +11,7 @@ #include "base/path_service.h" #include "base/scoped_ptr.h" #include "base/string_util.h" +#include "chrome/browser/appcache/chrome_appcache_service.h" #include "chrome/browser/autofill/personal_data_manager.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/browser_list.h" @@ -52,7 +53,6 @@ #include "chrome/browser/visitedlink_event_listener.h" #include "chrome/browser/webdata/web_data_service.h" #include "chrome/browser/web_resource/web_resource_service.h" -#include "chrome/common/appcache/chrome_appcache_service.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" diff --git a/chrome/browser/renderer_host/resource_dispatcher_host.cc b/chrome/browser/renderer_host/resource_dispatcher_host.cc index d7985d7..c7e6050 100644 --- a/chrome/browser/renderer_host/resource_dispatcher_host.cc +++ b/chrome/browser/renderer_host/resource_dispatcher_host.cc @@ -51,9 +51,9 @@ #include "chrome/browser/ssl/ssl_manager.h" #include "chrome/browser/worker_host/worker_service.h" #include "chrome/common/chrome_switches.h" -#include "chrome/common/extensions/extension_l10n_util.h" #include "chrome/common/notification_service.h" #include "chrome/common/render_messages.h" +#include "chrome/common/url_constants.h" #include "net/base/auth.h" #include "net/base/cert_status_flags.h" #include "net/base/load_flags.h" @@ -467,8 +467,9 @@ void ResourceDispatcherHost::BeginRequest( ResourceType::IsFrame(request_data.resource_type), // allow_download request_data.host_renderer_id, request_data.host_render_view_id); - extension_l10n_util::ApplyMessageFilterPolicy( - request_data.url, request_data.resource_type, extra_info); + ApplyExtensionMessageFilterPolicy(request_data.url, + request_data.resource_type, + extra_info); SetRequestInfo(request, extra_info); // Request takes ownership. chrome_browser_net::SetOriginProcessUniqueIDForRequest( request_data.origin_child_id, request); @@ -1738,6 +1739,7 @@ void ResourceDispatcherHost::ProcessBlockedRequestsForRoute( delete requests; } +// static bool ResourceDispatcherHost::IsResourceDispatcherHostMessage( const IPC::Message& message) { switch (message.type()) { @@ -1757,3 +1759,17 @@ bool ResourceDispatcherHost::IsResourceDispatcherHostMessage( return false; } + +// static +void ResourceDispatcherHost::ApplyExtensionMessageFilterPolicy( + 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); + } +} diff --git a/chrome/browser/renderer_host/resource_dispatcher_host.h b/chrome/browser/renderer_host/resource_dispatcher_host.h index 121265f..e6d5d24 100644 --- a/chrome/browser/renderer_host/resource_dispatcher_host.h +++ b/chrome/browser/renderer_host/resource_dispatcher_host.h @@ -274,6 +274,14 @@ class ResourceDispatcherHost : public URLRequest::Delegate { IncrementOutstandingRequestsMemoryCost); FRIEND_TEST(ResourceDispatcherHostTest, CalculateApproximateMemoryCost); + FRIEND_TEST(ApplyExtensionMessageFilterPolicyTest, WrongScheme); + FRIEND_TEST(ApplyExtensionMessageFilterPolicyTest, GoodScheme); + FRIEND_TEST(ApplyExtensionMessageFilterPolicyTest, + GoodSchemeWithSecurityFilter); + FRIEND_TEST(ApplyExtensionMessageFilterPolicyTest, + GoodSchemeWrongResourceType); + FRIEND_TEST(ApplyExtensionMessageFilterPolicyTest, + WrongSchemeResourceAndFilter); class ShutdownTask; @@ -402,6 +410,13 @@ class ResourceDispatcherHost : public URLRequest::Delegate { // Returns true if the message passed in is a resource related message. static bool IsResourceDispatcherHostMessage(const IPC::Message&); + // Applies FilterPolicy::FILTER_EXTENSION_MESSAGES to all text/css requests + // that have "chrome-extension://" scheme. + static void ApplyExtensionMessageFilterPolicy( + const GURL& url, + const ResourceType::Type& resource_type, + ResourceDispatcherHostRequestInfo* request_info); + PendingRequestList pending_requests_; // A timer that periodically calls UpdateLoadStates while pending_requests_ diff --git a/chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc b/chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc index 1edc26b..51d346d 100644 --- a/chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc +++ b/chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc @@ -10,6 +10,8 @@ #include "chrome/browser/child_process_security_policy.h" #include "chrome/browser/chrome_thread.h" #include "chrome/browser/renderer_host/resource_dispatcher_host.h" +#include "chrome/browser/renderer_host/resource_dispatcher_host_request_info.h" +#include "chrome/browser/renderer_host/resource_handler.h" #include "chrome/common/chrome_plugin_lib.h" #include "chrome/common/render_messages.h" #include "net/base/net_errors.h" @@ -886,3 +888,98 @@ TEST_F(ResourceDispatcherHostTest, MimeSniff204) { GetResponseHead(msgs[0], &response_head); ASSERT_EQ("text/plain", response_head.mime_type); } + +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 ApplyExtensionMessageFilterPolicyTest : 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(ApplyExtensionMessageFilterPolicyTest, WrongScheme) { + url_.reset(new GURL("html://behllobkkfkfnphdnhnkndlbkcpglgmj/popup.html")); + ResourceDispatcherHost::ApplyExtensionMessageFilterPolicy( + *url_, resource_type_, request_info_.get()); + + EXPECT_EQ(FilterPolicy::DONT_FILTER, request_info_->filter_policy()); +} + +TEST_F(ApplyExtensionMessageFilterPolicyTest, GoodScheme) { + ResourceDispatcherHost::ApplyExtensionMessageFilterPolicy( + *url_, resource_type_, request_info_.get()); + + EXPECT_EQ(FilterPolicy::FILTER_EXTENSION_MESSAGES, + request_info_->filter_policy()); +} + +TEST_F(ApplyExtensionMessageFilterPolicyTest, GoodSchemeWithSecurityFilter) { + request_info_->set_filter_policy(FilterPolicy::FILTER_ALL_EXCEPT_IMAGES); + ResourceDispatcherHost::ApplyExtensionMessageFilterPolicy( + *url_, resource_type_, request_info_.get()); + + EXPECT_EQ(FilterPolicy::FILTER_ALL_EXCEPT_IMAGES, + request_info_->filter_policy()); +} + +TEST_F(ApplyExtensionMessageFilterPolicyTest, GoodSchemeWrongResourceType) { + resource_type_ = ResourceType::MAIN_FRAME; + ResourceDispatcherHost::ApplyExtensionMessageFilterPolicy( + *url_, resource_type_, request_info_.get()); + + EXPECT_EQ(FilterPolicy::DONT_FILTER, request_info_->filter_policy()); +} + +TEST_F(ApplyExtensionMessageFilterPolicyTest, WrongSchemeResourceAndFilter) { + url_.reset(new GURL("html://behllobkkfkfnphdnhnkndlbkcpglgmj/popup.html")); + resource_type_ = ResourceType::MEDIA; + request_info_->set_filter_policy(FilterPolicy::FILTER_ALL); + ResourceDispatcherHost::ApplyExtensionMessageFilterPolicy( + *url_, resource_type_, request_info_.get()); + + EXPECT_EQ(FilterPolicy::FILTER_ALL, request_info_->filter_policy()); +} diff --git a/chrome/browser/renderer_host/resource_message_filter.cc b/chrome/browser/renderer_host/resource_message_filter.cc index 70ab6e9..b7c75e4 100644 --- a/chrome/browser/renderer_host/resource_message_filter.cc +++ b/chrome/browser/renderer_host/resource_message_filter.cc @@ -12,6 +12,7 @@ #include "base/histogram.h" #include "base/process_util.h" #include "base/thread.h" +#include "chrome/browser/appcache/appcache_dispatcher_host.h" #include "chrome/browser/browser_about_handler.h" #include "chrome/browser/child_process_security_policy.h" #include "chrome/browser/chrome_plugin_browsing_context.h" @@ -44,7 +45,6 @@ #include "chrome/browser/task_manager.h" #include "chrome/browser/worker_host/message_port_dispatcher.h" #include "chrome/browser/worker_host/worker_service.h" -#include "chrome/common/appcache/appcache_dispatcher_host.h" #include "chrome/common/chrome_plugin_lib.h" #include "chrome/common/chrome_plugin_util.h" #include "chrome/common/chrome_switches.h" diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index e8221c0..1ab0c9d 100755 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -27,6 +27,7 @@ '../third_party/libxml/libxml.gyp:libxml', '../third_party/npapi/npapi.gyp:npapi', '../third_party/hunspell/hunspell.gyp:hunspell', + '../webkit/webkit.gyp:appcache', '../webkit/webkit.gyp:database', '../webkit/webkit.gyp:glue', ], @@ -61,6 +62,12 @@ 'browser/app_modal_dialog_win.cc', 'browser/app_modal_dialog_queue.cc', 'browser/app_modal_dialog_queue.h', + 'browser/appcache/appcache_dispatcher_host.cc', + 'browser/appcache/appcache_dispatcher_host.h', + 'browser/appcache/appcache_frontend_proxy.cc', + 'browser/appcache/appcache_frontend_proxy.h', + 'browser/appcache/chrome_appcache_service.cc', + 'browser/appcache/chrome_appcache_service.h', 'browser/autocomplete/autocomplete.cc', 'browser/autocomplete/autocomplete.h', 'browser/autocomplete/autocomplete_accessibility.cc', diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi index b2f0bd6..566bfe3 100644 --- a/chrome/chrome_common.gypi +++ b/chrome/chrome_common.gypi @@ -183,12 +183,6 @@ 'common/appcache/appcache_backend_proxy.h', 'common/appcache/appcache_dispatcher.cc', 'common/appcache/appcache_dispatcher.h', - 'common/appcache/appcache_dispatcher_host.cc', - 'common/appcache/appcache_dispatcher_host.h', - 'common/appcache/appcache_frontend_proxy.cc', - 'common/appcache/appcache_frontend_proxy.h', - 'common/appcache/chrome_appcache_service.cc', - 'common/appcache/chrome_appcache_service.h', 'common/automation_constants.cc', 'common/automation_constants.h', 'common/chrome_descriptors.h', 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 diff --git a/chrome/common/platform_util.h b/chrome/common/platform_util.h index 99b322e..a2f5d31 100644 --- a/chrome/common/platform_util.h +++ b/chrome/common/platform_util.h @@ -26,9 +26,6 @@ void OpenExternal(const GURL& url); // Get the top level window for the native view. This can return NULL. gfx::NativeWindow GetTopLevel(gfx::NativeView view); -// Get the title of the window. -string16 GetWindowTitle(gfx::NativeWindow window); - // Returns true if |window| is the foreground top level window. bool IsWindowActive(gfx::NativeWindow window); diff --git a/chrome/common/platform_util_linux.cc b/chrome/common/platform_util_linux.cc index 5baaefc..816fca7 100644 --- a/chrome/common/platform_util_linux.cc +++ b/chrome/common/platform_util_linux.cc @@ -9,7 +9,6 @@ #include "base/file_util.h" #include "base/process_util.h" #include "base/string_util.h" -#include "chrome/browser/gtk/gtk_theme_provider.h" #include "chrome/common/gtk_util.h" #include "chrome/common/process_watcher.h" #include "googleurl/src/gurl.h" @@ -73,11 +72,6 @@ gfx::NativeWindow GetTopLevel(gfx::NativeView view) { return GTK_IS_WINDOW(toplevel) ? GTK_WINDOW(toplevel) : NULL; } -string16 GetWindowTitle(gfx::NativeWindow window) { - const gchar* title = gtk_window_get_title(window); - return UTF8ToUTF16(title); -} - bool IsWindowActive(gfx::NativeWindow window) { return gtk_window_is_active(window); } diff --git a/chrome/common/platform_util_mac.mm b/chrome/common/platform_util_mac.mm index 3b72ef3..8753f35 100644 --- a/chrome/common/platform_util_mac.mm +++ b/chrome/common/platform_util_mac.mm @@ -12,7 +12,6 @@ #include "base/logging.h" #include "base/mac_util.h" #include "base/sys_string_conversions.h" -#include "chrome/browser/cocoa/tab_window_controller.h" #include "googleurl/src/gurl.h" #include "grit/generated_resources.h" @@ -45,23 +44,6 @@ gfx::NativeWindow GetTopLevel(gfx::NativeView view) { return [view window]; } -string16 GetWindowTitle(gfx::NativeWindow window) { - NSString* title = nil; - if ([[window delegate] isKindOfClass:[TabWindowController class]]) { - TabWindowController* delegate = - reinterpret_cast<TabWindowController*>([window delegate]); - title = [delegate selectedTabTitle]; - } else { - title = [window title]; - } - // If we don't yet have a title, use "Untitled". - if (![title length]) - return WideToUTF16(l10n_util::GetString( - IDS_BROWSER_WINDOW_MAC_TAB_UNTITLED)); - - return base::SysNSStringToUTF16(title); -} - bool IsWindowActive(gfx::NativeWindow window) { return [window isKeyWindow] || [window isMainWindow]; } diff --git a/chrome/common/platform_util_win.cc b/chrome/common/platform_util_win.cc index bcf3a58..5553c81 100644 --- a/chrome/common/platform_util_win.cc +++ b/chrome/common/platform_util_win.cc @@ -136,13 +136,6 @@ gfx::NativeWindow GetTopLevel(gfx::NativeView view) { return GetAncestor(view, GA_ROOT); } -string16 GetWindowTitle(gfx::NativeWindow window_handle) { - std::wstring result; - int length = ::GetWindowTextLength(window_handle) + 1; - ::GetWindowText(window_handle, WriteInto(&result, length), length); - return WideToUTF16(result); -} - bool IsWindowActive(gfx::NativeWindow window) { return ::GetForegroundWindow() == window; } |