Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9307)

Unified Diff: chrome/renderer/chrome_content_renderer_client.cc

Issue 13032002: Add RequestOSFileHandle as a private PPAPI (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fix test Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/chrome_content_renderer_client.cc
diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc
index 27fd2857db4de9bda258225e80a81f33efcef8a0..5e5cde70c3870c673974223c64f9d979c43e7ec5 100644
--- a/chrome/renderer/chrome_content_renderer_client.cc
+++ b/chrome/renderer/chrome_content_renderer_client.cc
@@ -11,6 +11,7 @@
#include "base/logging.h"
#include "base/metrics/histogram.h"
#include "base/path_service.h"
+#include "base/strings/string_tokenizer.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/common/child_process_logging.h"
@@ -336,6 +337,10 @@ void ChromeContentRendererClient::RenderThreadStarted() {
extension_resource_scheme);
RegisterExtensionManifestHandlers();
+
+ RegisterRequestOSFileHandleAllowedHosts(
+ command_line->GetSwitchValueASCII(
+ switches::kAllowRequestOSFileHandleAPI));
}
void ChromeContentRendererClient::RenderViewCreated(
@@ -1193,4 +1198,37 @@ 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_.insert(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;
+ }
+
+ if (request_os_file_handle_allowed_hosts_.count(inner.host()))
+ return true;
+
+ return false;
+}
+
} // namespace chrome

Powered by Google App Engine
This is Rietveld 408576698