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

Side by Side Diff: components/html_viewer/html_frame.cc

Issue 1367333002: Remove WebDocument::createEvent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | components/plugins/renderer/loadable_plugin_placeholder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/html_viewer/html_frame.h" 5 #include "components/html_viewer/html_frame.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 return; 741 return;
742 } 742 }
743 743
744 blink::WebLocalFrame* target_web_frame = 744 blink::WebLocalFrame* target_web_frame =
745 target->web_frame_->toWebLocalFrame(); 745 target->web_frame_->toWebLocalFrame();
746 746
747 blink::WebSerializedScriptValue serialized_script_value; 747 blink::WebSerializedScriptValue serialized_script_value;
748 serialized_script_value = blink::WebSerializedScriptValue::fromString( 748 serialized_script_value = blink::WebSerializedScriptValue::fromString(
749 serialized_event->data.To<blink::WebString>()); 749 serialized_event->data.To<blink::WebString>());
750 750
751 blink::WebMessagePortChannelArray channels;
752
753 // Create an event with the message. The next-to-last parameter to
754 // initMessageEvent is the last event ID, which is not used with postMessage.
755 blink::WebDOMEvent event =
756 target_web_frame->document().createEvent("MessageEvent");
757 blink::WebDOMMessageEvent msg_event = event.to<blink::WebDOMMessageEvent>();
758 msg_event.initMessageEvent(
759 "message",
760 // |canBubble| and |cancellable| are always false
761 false, false, serialized_script_value,
762 serialized_event->source_origin.To<blink::WebString>(),
763 source->web_frame_, target_web_frame->document(), "", channels);
764
765 // We must pass in the target_origin to do the security check on this side, 751 // We must pass in the target_origin to do the security check on this side,
766 // since it may have changed since the original postMessage call was made. 752 // since it may have changed since the original postMessage call was made.
767 blink::WebSecurityOrigin target_origin; 753 blink::WebSecurityOrigin target_origin;
768 if (!serialized_event->target_origin.is_null()) { 754 if (!serialized_event->target_origin.is_null()) {
769 target_origin = blink::WebSecurityOrigin::createFromString( 755 target_origin = blink::WebSecurityOrigin::createFromString(
770 serialized_event->target_origin.To<blink::WebString>()); 756 serialized_event->target_origin.To<blink::WebString>());
771 } 757 }
758
759 // TODO(esprehn): Shouldn't this also fill in channels like RenderFrameImpl?
760 blink::WebMessagePortChannelArray channels;
761 blink::WebDOMMessageEvent msg_event(serialized_script_value,
762 serialized_event->source_origin.To<blink::WebString>(),
763 source->web_frame_, target_web_frame->document(), channels);
764
772 target_web_frame->dispatchMessageEventWithOriginCheck(target_origin, 765 target_web_frame->dispatchMessageEventWithOriginCheck(target_origin,
773 msg_event); 766 msg_event);
774 } 767 }
775 768
776 void HTMLFrame::OnWillNavigate(const mojo::String& origin, 769 void HTMLFrame::OnWillNavigate(const mojo::String& origin,
777 const OnWillNavigateCallback& callback) { 770 const OnWillNavigateCallback& callback) {
778 DVLOG(2) << "HTMLFrame::OnWillNavigate this=" << this << " id=" << id_ 771 DVLOG(2) << "HTMLFrame::OnWillNavigate this=" << this << " id=" << id_
779 << " local=" << IsLocal() << " will_swap=" 772 << " local=" << IsLocal() << " will_swap="
780 << (IsLocal() && this != frame_tree_manager_->local_root_); 773 << (IsLocal() && this != frame_tree_manager_->local_root_);
781 callback.Run(); 774 callback.Run();
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 855
863 void HTMLFrame::reload(bool ignore_cache, bool is_client_redirect) { 856 void HTMLFrame::reload(bool ignore_cache, bool is_client_redirect) {
864 NOTIMPLEMENTED(); 857 NOTIMPLEMENTED();
865 } 858 }
866 859
867 void HTMLFrame::forwardInputEvent(const blink::WebInputEvent* event) { 860 void HTMLFrame::forwardInputEvent(const blink::WebInputEvent* event) {
868 NOTIMPLEMENTED(); 861 NOTIMPLEMENTED();
869 } 862 }
870 863
871 } // namespace mojo 864 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | components/plugins/renderer/loadable_plugin_placeholder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698