diff options
-rw-r--r-- | chrome/browser/chrome_content_browser_client.cc | 1 | ||||
-rw-r--r-- | chrome/common/chrome_switches.cc | 5 | ||||
-rw-r--r-- | chrome/common/chrome_switches.h | 3 | ||||
-rw-r--r-- | chrome/renderer/chrome_content_renderer_client.cc | 40 | ||||
-rw-r--r-- | chrome/renderer/chrome_content_renderer_client.h | 9 | ||||
-rw-r--r-- | chrome/renderer/chrome_content_renderer_client_unittest.cc | 55 | ||||
-rw-r--r-- | content/public/renderer/content_renderer_client.cc | 5 | ||||
-rw-r--r-- | content/public/renderer/content_renderer_client.h | 3 | ||||
-rw-r--r-- | content/renderer/pepper/pepper_file_io_host.cc | 6 |
9 files changed, 1 insertions, 126 deletions
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index c55c6be..39d0c49 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc @@ -1206,7 +1206,6 @@ void ChromeContentBrowserClient::AppendExtraCommandLineSwitches( // Please keep this in alphabetical order. static const char* const kSwitchNames[] = { autofill::switches::kEnableExperimentalFormFilling, - switches::kAllowRequestOSFileHandleAPI, switches::kAllowHTTPBackgroundPage, switches::kAllowLegacyExtensionManifests, switches::kAllowScriptingGallery, diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index 48c1851..b2894aa 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc @@ -44,11 +44,6 @@ const char kAllowNaClSocketAPI[] = "allow-nacl-socket-api"; // Don't block outdated plugins. const char kAllowOutdatedPlugins[] = "allow-outdated-plugins"; -// Specifies command-separated list of extension ids or hosts to grant -// access to RequestOSFileHandle private API. -const char kAllowRequestOSFileHandleAPI[] = - "allow-request-os-file-handle-api"; - // By default, an https page cannot run JavaScript, CSS or plug-ins from http // URLs. This provides an override to get the old insecure behavior. const char kAllowRunningInsecureContent[] = "allow-running-insecure-content"; diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index 8237004..35f8095 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h @@ -31,9 +31,6 @@ extern const char kAllowHTTPBackgroundPage[]; extern const char kAllowLegacyExtensionManifests[]; extern const char kAllowNaClSocketAPI[]; extern const char kAllowOutdatedPlugins[]; -// TODO(hamaji): Remove this once the two issues are fixed. -// http://crbug.com/224753 http://crbug.com/220029 -extern const char kAllowRequestOSFileHandleAPI[]; extern const char kAllowRunningInsecureContent[]; extern const char kAllowScriptingGallery[]; extern const char kAlwaysAuthorizePlugins[]; diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc index 6608b7f..1236cc2 100644 --- a/chrome/renderer/chrome_content_renderer_client.cc +++ b/chrome/renderer/chrome_content_renderer_client.cc @@ -11,7 +11,6 @@ #include "base/metrics/histogram.h" #include "base/path_service.h" #include "base/string_util.h" -#include "base/strings/string_tokenizer.h" #include "base/utf_string_conversions.h" #include "base/values.h" #include "chrome/common/child_process_logging.h" @@ -346,10 +345,6 @@ void ChromeContentRendererClient::RenderThreadStarted() { extensions::PermissionsInfo::GetInstance()->InitializeWithDelegate( permissions); RegisterExtensionManifestHandlers(); - - RegisterRequestOSFileHandleAllowedHosts( - command_line->GetSwitchValueASCII( - switches::kAllowRequestOSFileHandleAPI)); } void ChromeContentRendererClient::RenderViewCreated( @@ -1204,39 +1199,4 @@ bool ChromeContentRendererClient::AllowBrowserPlugin( tag_name.equals(WebString::fromUTF8(kAdViewTagName)); } -void ChromeContentRendererClient::RegisterRequestOSFileHandleAllowedHosts( - const std::string& allowed_list) { - if (!allowed_list.empty()) { - base::StringTokenizer t(allowed_list, ","); - while (t.GetNext()) { - request_os_file_handle_allowed_hosts_.push_back(t.token()); - } - } -} - -bool ChromeContentRendererClient::IsRequestOSFileHandleAllowedForURL( - const GURL& url) const { - if (!url.is_valid() || !url.SchemeIsFileSystem() || !url.inner_url()) { - return false; - } - - const GURL& inner = *url.inner_url(); - if (!inner.is_valid()) - return false; - - if (inner.SchemeIs(extensions::kExtensionScheme)) { - // TODO(hamaji): We don't need this whitelist once this issue is - // fixed: http://crbug.com/224123 http://crbug.com/224753 - if (inner.host() == "dolnidnbiendbodmklboojlnlpdeeipo") - return true; - } - - for (size_t i = 0; i < request_os_file_handle_allowed_hosts_.size(); ++i) { - if (MatchPattern(inner.host(), request_os_file_handle_allowed_hosts_[i])) - return true; - } - - return false; -} - } // namespace chrome diff --git a/chrome/renderer/chrome_content_renderer_client.h b/chrome/renderer/chrome_content_renderer_client.h index f6db8b1..fbf48ad 100644 --- a/chrome/renderer/chrome_content_renderer_client.h +++ b/chrome/renderer/chrome_content_renderer_client.h @@ -120,8 +120,6 @@ class ChromeContentRendererClient : public content::ContentRendererClient { WebKit::WebPluginContainer* container) const OVERRIDE; virtual void RegisterPPAPIInterfaceFactories( webkit::ppapi::PpapiInterfaceFactoryManager* factory_manager) OVERRIDE; - virtual bool IsRequestOSFileHandleAllowedForURL( - const GURL& url) const OVERRIDE; // For testing. void SetExtensionDispatcher(extensions::Dispatcher* extension_dispatcher); @@ -150,8 +148,6 @@ class ChromeContentRendererClient : public content::ContentRendererClient { private: FRIEND_TEST_ALL_PREFIXES(ChromeContentRendererClientTest, NaClRestriction); - FRIEND_TEST_ALL_PREFIXES(ChromeContentRendererClientTest, - IsRequestOSFileHandleAllowedForURL); const extensions::Extension* GetExtension( const WebKit::WebSecurityOrigin& origin) const; @@ -172,9 +168,6 @@ class ChromeContentRendererClient : public content::ContentRendererClient { const extensions::Extension* extension, WebKit::WebPluginParams* params); - void RegisterRequestOSFileHandleAllowedHosts( - const std::string& allowed_list); - scoped_ptr<ChromeRenderProcessObserver> chrome_observer_; scoped_ptr<extensions::Dispatcher> extension_dispatcher_; scoped_ptr<RendererNetPredictor> net_predictor_; @@ -182,8 +175,6 @@ class ChromeContentRendererClient : public content::ContentRendererClient { scoped_ptr<components::VisitedLinkSlave> visited_link_slave_; scoped_ptr<safe_browsing::PhishingClassifierFilter> phishing_classifier_; scoped_ptr<prerender::PrerenderDispatcher> prerender_dispatcher_; - // The whitelist for RequestOSFileHandle specified by commandline. - std::vector<std::string> request_os_file_handle_allowed_hosts_; }; } // namespace chrome diff --git a/chrome/renderer/chrome_content_renderer_client_unittest.cc b/chrome/renderer/chrome_content_renderer_client_unittest.cc index 1387ff0..1194f01 100644 --- a/chrome/renderer/chrome_content_renderer_client_unittest.cc +++ b/chrome/renderer/chrome_content_renderer_client_unittest.cc @@ -287,59 +287,4 @@ TEST_F(ChromeContentRendererClientTest, NaClRestriction) { } } -TEST_F(ChromeContentRendererClientTest, IsRequestOSFileHandleAllowedForURL) { - ChromeContentRendererClient client; - const std::string& kWhitelistedExtensionID = - "dolnidnbiendbodmklboojlnlpdeeipo"; - const std::string& kRandomExtensionID = - "abcdefghijklmnopqrstuvwxyzabcdef"; - EXPECT_FALSE(client.IsRequestOSFileHandleAllowedForURL(GURL())); - EXPECT_FALSE(client.IsRequestOSFileHandleAllowedForURL( - GURL("http://example.com/"))); - EXPECT_FALSE(client.IsRequestOSFileHandleAllowedForURL( - GURL("chrome-extension://" + kWhitelistedExtensionID))); - EXPECT_TRUE(client.IsRequestOSFileHandleAllowedForURL( - GURL("filesystem:chrome-extension://" + - kWhitelistedExtensionID + "/foo"))); - EXPECT_FALSE(client.IsRequestOSFileHandleAllowedForURL( - GURL("filesystem:http://" + - kWhitelistedExtensionID + "/foo"))); - EXPECT_FALSE(client.IsRequestOSFileHandleAllowedForURL( - GURL("filesystem:chrome-extension://" + - kRandomExtensionID + "/foo"))); - EXPECT_FALSE(client.IsRequestOSFileHandleAllowedForURL( - GURL("filesystem:http://127.0.0.1/foo"))); - - client.RegisterRequestOSFileHandleAllowedHosts( - "127.0.0.1," + kRandomExtensionID); - EXPECT_TRUE(client.IsRequestOSFileHandleAllowedForURL( - GURL("filesystem:chrome-extension://" + - kRandomExtensionID + "/foo"))); - EXPECT_TRUE(client.IsRequestOSFileHandleAllowedForURL( - GURL("filesystem:http://127.0.0.1/foo"))); - EXPECT_FALSE(client.IsRequestOSFileHandleAllowedForURL( - GURL("http://127.0.0.1/foo"))); - EXPECT_FALSE(client.IsRequestOSFileHandleAllowedForURL( - GURL("filesystem:http://192.168.0.1/foo"))); - - client.RegisterRequestOSFileHandleAllowedHosts("127.0.0.?"); - EXPECT_TRUE(client.IsRequestOSFileHandleAllowedForURL( - GURL("filesystem:http://127.0.0.1/foo"))); - EXPECT_TRUE(client.IsRequestOSFileHandleAllowedForURL( - GURL("filesystem:http://127.0.0.2/foo"))); - EXPECT_FALSE(client.IsRequestOSFileHandleAllowedForURL( - GURL("filesystem:http://127.0.1.0/foo"))); - - client.RegisterRequestOSFileHandleAllowedHosts("*"); - EXPECT_TRUE(client.IsRequestOSFileHandleAllowedForURL( - GURL("filesystem:chrome-extension://" + - kRandomExtensionID + "/foo"))); - EXPECT_TRUE(client.IsRequestOSFileHandleAllowedForURL( - GURL("filesystem:http://127.0.0.1/foo"))); - EXPECT_FALSE(client.IsRequestOSFileHandleAllowedForURL( - GURL("http://127.0.0.1/foo"))); - EXPECT_TRUE(client.IsRequestOSFileHandleAllowedForURL( - GURL("filesystem:http://192.168.0.1/foo"))); -} - } // namespace chrome diff --git a/content/public/renderer/content_renderer_client.cc b/content/public/renderer/content_renderer_client.cc index 2223824..8997832 100644 --- a/content/public/renderer/content_renderer_client.cc +++ b/content/public/renderer/content_renderer_client.cc @@ -157,9 +157,4 @@ bool ContentRendererClient::ShouldCreateCompositorInputHandler() const { return true; } -bool ContentRendererClient::IsRequestOSFileHandleAllowedForURL( - const GURL& url) const { - return false; -} - } // namespace content diff --git a/content/public/renderer/content_renderer_client.h b/content/public/renderer/content_renderer_client.h index 3fbd437..653d38c 100644 --- a/content/public/renderer/content_renderer_client.h +++ b/content/public/renderer/content_renderer_client.h @@ -236,9 +236,6 @@ class CONTENT_EXPORT ContentRendererClient { // Allow the embedder to disable input event filtering by the compositor. virtual bool ShouldCreateCompositorInputHandler() const; - - // Check if we can allow RequestOSFileHandle API access for |url|. - virtual bool IsRequestOSFileHandleAllowedForURL(const GURL& url) const; }; } // namespace content diff --git a/content/renderer/pepper/pepper_file_io_host.cc b/content/renderer/pepper/pepper_file_io_host.cc index 7f91cc0..108bdcd 100644 --- a/content/renderer/pepper/pepper_file_io_host.cc +++ b/content/renderer/pepper/pepper_file_io_host.cc @@ -426,11 +426,7 @@ int32_t PepperFileIOHost::OnHostMsgWillSetLength( int32_t PepperFileIOHost::OnHostMsgRequestOSFileHandle( ppapi::host::HostMessageContext* context) { if (!is_running_in_process_ && - quota_policy_ != quota::kQuotaLimitTypeUnlimited && - // TODO(hamaji): Remove the whitelist once it turned out the - // quota check is sufficient. http://crbug.com/226386 - !GetContentClient()->renderer()->IsRequestOSFileHandleAllowedForURL( - file_system_url_)) + quota_policy_ != quota::kQuotaLimitTypeUnlimited) return PP_ERROR_FAILED; RendererPpapiHost* renderer_ppapi_host = |