diff options
author | abarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-24 01:34:04 +0000 |
---|---|---|
committer | abarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-24 01:34:04 +0000 |
commit | 47f20826e6ecb0f2bb18c7b3132d7d2052acdb68 (patch) | |
tree | 755693e818322c4f298290f422a6fb56c0997edc /chrome/renderer/external_host_bindings.cc | |
parent | ffc22aac0caf43c33c9fc394ec6bfc23522b8dd6 (diff) | |
download | chromium_src-47f20826e6ecb0f2bb18c7b3132d7d2052acdb68.zip chromium_src-47f20826e6ecb0f2bb18c7b3132d7d2052acdb68.tar.gz chromium_src-47f20826e6ecb0f2bb18c7b3132d7d2052acdb68.tar.bz2 |
Update chrome/renderer/external_host_bindings.cc to reflect WEBKIT_FRAME_TO_DOCUMENT_API_MOVE
While I was in this code, I couldn't help remove a fake implementation of
WebSecurityOrigin::toString().
Review URL: http://codereview.chromium.org/7237015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90324 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/external_host_bindings.cc')
-rw-r--r-- | chrome/renderer/external_host_bindings.cc | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/chrome/renderer/external_host_bindings.cc b/chrome/renderer/external_host_bindings.cc index bc10349..4b95ddd 100644 --- a/chrome/renderer/external_host_bindings.cc +++ b/chrome/renderer/external_host_bindings.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -7,6 +7,7 @@ #include "base/values.h" #include "chrome/common/render_messages.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" using WebKit::WebBindings; @@ -47,15 +48,7 @@ void ExternalHostBindings::postMessage( target = "*"; } - std::string origin; - GURL origin_url(GURL(frame_->url()).GetOrigin()); - if (origin_url.is_empty()) { - // If the origin is not a scheme/host/port tuple, then return the literal - // string "null". - origin = "null"; - } else { - origin = origin_url.spec(); - } + std::string origin = frame_->document().securityOrigin().toString().utf8(); result->Set(sender()->Send(new ViewHostMsg_ForwardMessageToExternalHost( routing_id(), message, origin, target))); @@ -70,21 +63,24 @@ bool ExternalHostBindings::ForwardMessageFromExternalHost( bool status = false; if (target.compare("*") != 0) { - GURL frame_url(frame_->url()); - GURL frame_origin(frame_url.GetOrigin()); + // TODO(abarth): This code should use WebSecurityOrigin::toString to + // make origin strings. GURL::GetOrigin() doesn't understand all the + // cases that WebSecurityOrigin::toString understands. + GURL document_url(frame_->document().url()); + GURL document_origin(document_url.GetOrigin()); GURL target_origin(GURL(target).GetOrigin()); // We want to compare the origins of the two URLs but first // we need to make sure that we don't compare an invalid one // to a valid one. - bool drop = (frame_origin.is_valid() != target_origin.is_valid()); + bool drop = (document_origin.is_valid() != target_origin.is_valid()); if (!drop) { - if (!frame_origin.is_valid()) { + if (!document_origin.is_valid()) { // Both origins are invalid, so compare the URLs as opaque strings. - drop = (frame_url.spec().compare(target) != 0); + drop = (document_url.spec().compare(target) != 0); } else { - drop = (frame_origin != target_origin); + drop = (document_origin != target_origin); } } |