summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorddorwin@chromium.org <ddorwin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-22 18:10:47 +0000
committerddorwin@chromium.org <ddorwin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-22 18:10:47 +0000
commit76ee293eb93bb75c6f68bcc51aad38f863a41725 (patch)
treea9f4be4ab5fc5fd525d77296dae89d188953c913
parentfb7bc5c917c063ec1a035a218a8596b6c6a88092 (diff)
downloadchromium_src-76ee293eb93bb75c6f68bcc51aad38f863a41725.zip
chromium_src-76ee293eb93bb75c6f68bcc51aad38f863a41725.tar.gz
chromium_src-76ee293eb93bb75c6f68bcc51aad38f863a41725.tar.bz2
Use URLUtil_Dev to check the document URL instead of Private interfaces.
In addition to eliminating dependencies on the Private interfaces, the second instance to call location.GetProperty("origin") (or "href") would fail for unknown reasons if SandboxOrigin is set, as is the case in https://codereview.chromium.org/14756021/ Review URL: https://chromiumcodereview.appspot.com/15536006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@201577 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--webkit/media/crypto/ppapi/cdm_wrapper.cc24
-rw-r--r--webkit/media/webkit_media.gypi2
2 files changed, 14 insertions, 12 deletions
diff --git a/webkit/media/crypto/ppapi/cdm_wrapper.cc b/webkit/media/crypto/ppapi/cdm_wrapper.cc
index cd5b917..72d92cc 100644
--- a/webkit/media/crypto/ppapi/cdm_wrapper.cc
+++ b/webkit/media/crypto/ppapi/cdm_wrapper.cc
@@ -28,10 +28,10 @@
#include "webkit/media/crypto/ppapi/cdm/content_decryption_module.h"
#include "webkit/media/crypto/ppapi/linked_ptr.h"
-#if defined(CHECK_ORIGIN_URL)
-#include "ppapi/cpp/private/instance_private.h"
-#include "ppapi/cpp/private/var_private.h"
-#endif // defined(CHECK_ORIGIN_URL)
+#if defined(CHECK_DOCUMENT_URL)
+#include "ppapi/cpp/dev/url_util_dev.h"
+#include "ppapi/cpp/instance_handle.h"
+#endif // defined(CHECK_DOCUMENT_URL)
namespace {
@@ -642,13 +642,15 @@ void CdmWrapper::GenerateKeyRequest(const std::string& key_system,
PP_DCHECK(!key_system.empty());
PP_DCHECK(key_system_.empty() || key_system_ == key_system);
-#if defined(CHECK_ORIGIN_URL)
- pp::InstancePrivate instance_private(pp_instance());
- pp::VarPrivate window = instance_private.GetWindowObject();
- std::string origin = window.GetProperty("top").GetProperty("location")
- .GetProperty("origin").AsString();
- PP_DCHECK(origin != "null");
-#endif // defined(CHECK_ORIGIN_URL)
+#if defined(CHECK_DOCUMENT_URL)
+ PP_URLComponents_Dev url_components = {};
+ pp::Var href = pp::URLUtil_Dev::Get()->GetDocumentURL(
+ pp::InstanceHandle(pp_instance()), &url_components);
+ PP_DCHECK(href.is_string());
+ PP_DCHECK(!href.AsString().empty());
+ PP_DCHECK(url_components.host.begin);
+ PP_DCHECK(0 < url_components.host.len);
+#endif // defined(CHECK_DOCUMENT_URL)
if (!cdm_) {
if (!CreateCdmInstance(key_system)) {
diff --git a/webkit/media/webkit_media.gypi b/webkit/media/webkit_media.gypi
index 3cf15b4..53e3517 100644
--- a/webkit/media/webkit_media.gypi
+++ b/webkit/media/webkit_media.gypi
@@ -191,7 +191,7 @@
'target_name': 'clearkeycdmadapter',
'type': 'none',
# Check whether the plugin's origin URL is valid.
- 'defines': ['CHECK_ORIGIN_URL'],
+ 'defines': ['CHECK_DOCUMENT_URL'],
'dependencies': [
'<(DEPTH)/ppapi/ppapi.gyp:ppapi_cpp',
'clearkeycdm',