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

Side by Side Diff: content/renderer/render_frame_impl.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 | « content/renderer/pepper/message_channel.cc ('k') | content/shell/renderer/ipc_echo.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/renderer/render_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 1730 matching lines...) Expand 10 before | Expand all | Expand 10 after
1741 converter.SetDateAllowed(true); 1741 converter.SetDateAllowed(true);
1742 converter.SetRegExpAllowed(true); 1742 converter.SetRegExpAllowed(true);
1743 scoped_ptr<base::Value> value(new base::StringValue(params.data)); 1743 scoped_ptr<base::Value> value(new base::StringValue(params.data));
1744 v8::Local<v8::Value> result_value = converter.ToV8Value(value.get(), 1744 v8::Local<v8::Value> result_value = converter.ToV8Value(value.get(),
1745 context); 1745 context);
1746 serialized_script_value = WebSerializedScriptValue::serialize(result_value); 1746 serialized_script_value = WebSerializedScriptValue::serialize(result_value);
1747 } else { 1747 } else {
1748 serialized_script_value = WebSerializedScriptValue::fromString(params.data); 1748 serialized_script_value = WebSerializedScriptValue::fromString(params.data);
1749 } 1749 }
1750 1750
1751 // Create an event with the message. The next-to-last parameter to
1752 // initMessageEvent is the last event ID, which is not used with postMessage.
1753 WebDOMEvent event = frame_->document().createEvent("MessageEvent");
1754 WebDOMMessageEvent msg_event = event.to<WebDOMMessageEvent>();
1755 msg_event.initMessageEvent("message",
1756 // |canBubble| and |cancellable| are always false
1757 false, false,
1758 serialized_script_value,
1759 params.source_origin, source_frame,
1760 frame_->document(), "", channels);
1761
1762 // We must pass in the target_origin to do the security check on this side, 1751 // We must pass in the target_origin to do the security check on this side,
1763 // since it may have changed since the original postMessage call was made. 1752 // since it may have changed since the original postMessage call was made.
1764 WebSecurityOrigin target_origin; 1753 WebSecurityOrigin target_origin;
1765 if (!params.target_origin.empty()) { 1754 if (!params.target_origin.empty()) {
1766 target_origin = 1755 target_origin =
1767 WebSecurityOrigin::createFromString(WebString(params.target_origin)); 1756 WebSecurityOrigin::createFromString(WebString(params.target_origin));
1768 } 1757 }
1758
1759 WebDOMMessageEvent msg_event(serialized_script_value,
1760 params.source_origin,
1761 source_frame,
1762 frame_->document(),
1763 channels);
1769 frame_->dispatchMessageEventWithOriginCheck(target_origin, msg_event); 1764 frame_->dispatchMessageEventWithOriginCheck(target_origin, msg_event);
1770 } 1765 }
1771 1766
1772 #if defined(OS_ANDROID) 1767 #if defined(OS_ANDROID)
1773 void RenderFrameImpl::OnSelectPopupMenuItems( 1768 void RenderFrameImpl::OnSelectPopupMenuItems(
1774 bool canceled, 1769 bool canceled,
1775 const std::vector<int>& selected_indices) { 1770 const std::vector<int>& selected_indices) {
1776 // It is possible to receive more than one of these calls if the user presses 1771 // It is possible to receive more than one of these calls if the user presses
1777 // a select faster than it takes for the show-select-popup IPC message to make 1772 // a select faster than it takes for the show-select-popup IPC message to make
1778 // it to the browser UI thread. Ignore the extra-messages. 1773 // it to the browser UI thread. Ignore the extra-messages.
(...skipping 3359 matching lines...) Expand 10 before | Expand all | Expand 10 after
5138 mojo::ServiceProviderPtr service_provider; 5133 mojo::ServiceProviderPtr service_provider;
5139 mojo::URLRequestPtr request(mojo::URLRequest::New()); 5134 mojo::URLRequestPtr request(mojo::URLRequest::New());
5140 request->url = mojo::String::From(url); 5135 request->url = mojo::String::From(url);
5141 mojo_shell_->ConnectToApplication(request.Pass(), GetProxy(&service_provider), 5136 mojo_shell_->ConnectToApplication(request.Pass(), GetProxy(&service_provider),
5142 nullptr, nullptr, 5137 nullptr, nullptr,
5143 base::Bind(&OnGotContentHandlerID)); 5138 base::Bind(&OnGotContentHandlerID));
5144 return service_provider.Pass(); 5139 return service_provider.Pass();
5145 } 5140 }
5146 5141
5147 } // namespace content 5142 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/message_channel.cc ('k') | content/shell/renderer/ipc_echo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698