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

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 2656043002: Use explicit WebString conversions in remaining content files (Closed)
Patch Set: build fix Created 3 years, 10 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
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 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 1834 matching lines...) Expand 10 before | Expand all | Expand 10 after
1845 void RenderFrameImpl::OnPasteAndMatchStyle() { 1845 void RenderFrameImpl::OnPasteAndMatchStyle() {
1846 base::AutoReset<bool> handling_select_range(&handling_select_range_, true); 1846 base::AutoReset<bool> handling_select_range(&handling_select_range_, true);
1847 frame_->executeCommand(WebString::fromUTF8("PasteAndMatchStyle")); 1847 frame_->executeCommand(WebString::fromUTF8("PasteAndMatchStyle"));
1848 } 1848 }
1849 1849
1850 #if defined(OS_MACOSX) 1850 #if defined(OS_MACOSX)
1851 void RenderFrameImpl::OnCopyToFindPboard() { 1851 void RenderFrameImpl::OnCopyToFindPboard() {
1852 // Since the find pasteboard supports only plain text, this can be simpler 1852 // Since the find pasteboard supports only plain text, this can be simpler
1853 // than the |OnCopy()| case. 1853 // than the |OnCopy()| case.
1854 if (frame_->hasSelection()) { 1854 if (frame_->hasSelection()) {
1855 base::string16 selection = frame_->selectionAsText(); 1855 base::string16 selection = frame_->selectionAsText().utf16();
1856 RenderThread::Get()->Send( 1856 RenderThread::Get()->Send(
1857 new ClipboardHostMsg_FindPboardWriteStringAsync(selection)); 1857 new ClipboardHostMsg_FindPboardWriteStringAsync(selection));
1858 } 1858 }
1859 } 1859 }
1860 #endif 1860 #endif
1861 1861
1862 void RenderFrameImpl::OnDelete() { 1862 void RenderFrameImpl::OnDelete() {
1863 frame_->executeCommand(WebString::fromUTF8("Delete")); 1863 frame_->executeCommand(WebString::fromUTF8("Delete"));
1864 } 1864 }
1865 1865
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1910 1910
1911 base::AutoReset<bool> handling_select_range(&handling_select_range_, true); 1911 base::AutoReset<bool> handling_select_range(&handling_select_range_, true);
1912 frame_->moveRangeSelectionExtent( 1912 frame_->moveRangeSelectionExtent(
1913 render_view_->ConvertWindowPointToViewport(point)); 1913 render_view_->ConvertWindowPointToViewport(point));
1914 } 1914 }
1915 1915
1916 void RenderFrameImpl::OnReplace(const base::string16& text) { 1916 void RenderFrameImpl::OnReplace(const base::string16& text) {
1917 if (!frame_->hasSelection()) 1917 if (!frame_->hasSelection())
1918 frame_->selectWordAroundCaret(); 1918 frame_->selectWordAroundCaret();
1919 1919
1920 frame_->replaceSelection(text); 1920 frame_->replaceSelection(WebString::fromUTF16(text));
1921 SyncSelectionIfRequired(); 1921 SyncSelectionIfRequired();
1922 } 1922 }
1923 1923
1924 void RenderFrameImpl::OnReplaceMisspelling(const base::string16& text) { 1924 void RenderFrameImpl::OnReplaceMisspelling(const base::string16& text) {
1925 if (!frame_->hasSelection()) 1925 if (!frame_->hasSelection())
1926 return; 1926 return;
1927 1927
1928 frame_->replaceMisspelledRange(text); 1928 frame_->replaceMisspelledRange(WebString::fromUTF16(text));
1929 } 1929 }
1930 1930
1931 void RenderFrameImpl::OnCopyImageAt(int x, int y) { 1931 void RenderFrameImpl::OnCopyImageAt(int x, int y) {
1932 blink::WebFloatRect viewport_position(x, y, 0, 0); 1932 blink::WebFloatRect viewport_position(x, y, 0, 0);
1933 GetRenderWidget()->convertWindowToViewport(&viewport_position); 1933 GetRenderWidget()->convertWindowToViewport(&viewport_position);
1934 frame_->copyImageAt(WebPoint(viewport_position.x, viewport_position.y)); 1934 frame_->copyImageAt(WebPoint(viewport_position.x, viewport_position.y));
1935 } 1935 }
1936 1936
1937 void RenderFrameImpl::OnSaveImageAt(int x, int y) { 1937 void RenderFrameImpl::OnSaveImageAt(int x, int y) {
1938 blink::WebFloatRect viewport_position(x, y, 0, 0); 1938 blink::WebFloatRect viewport_position(x, y, 0, 0);
1939 GetRenderWidget()->convertWindowToViewport(&viewport_position); 1939 GetRenderWidget()->convertWindowToViewport(&viewport_position);
1940 frame_->saveImageAt(WebPoint(viewport_position.x, viewport_position.y)); 1940 frame_->saveImageAt(WebPoint(viewport_position.x, viewport_position.y));
1941 } 1941 }
1942 1942
1943 void RenderFrameImpl::OnAddMessageToConsole(ConsoleMessageLevel level, 1943 void RenderFrameImpl::OnAddMessageToConsole(ConsoleMessageLevel level,
1944 const std::string& message) { 1944 const std::string& message) {
1945 AddMessageToConsole(level, message); 1945 AddMessageToConsole(level, message);
1946 } 1946 }
1947 1947
1948 void RenderFrameImpl::OnJavaScriptExecuteRequest( 1948 void RenderFrameImpl::OnJavaScriptExecuteRequest(
1949 const base::string16& jscript, 1949 const base::string16& jscript,
1950 int id, 1950 int id,
1951 bool notify_result) { 1951 bool notify_result) {
1952 TRACE_EVENT_INSTANT0("test_tracing", "OnJavaScriptExecuteRequest", 1952 TRACE_EVENT_INSTANT0("test_tracing", "OnJavaScriptExecuteRequest",
1953 TRACE_EVENT_SCOPE_THREAD); 1953 TRACE_EVENT_SCOPE_THREAD);
1954 1954
1955 v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); 1955 v8::HandleScope handle_scope(v8::Isolate::GetCurrent());
1956 v8::Local<v8::Value> result = 1956 v8::Local<v8::Value> result = frame_->executeScriptAndReturnValue(
1957 frame_->executeScriptAndReturnValue(WebScriptSource(jscript)); 1957 WebScriptSource(WebString::fromUTF16(jscript)));
1958 1958
1959 HandleJavascriptExecutionResult(jscript, id, notify_result, result); 1959 HandleJavascriptExecutionResult(jscript, id, notify_result, result);
1960 } 1960 }
1961 1961
1962 void RenderFrameImpl::OnJavaScriptExecuteRequestForTests( 1962 void RenderFrameImpl::OnJavaScriptExecuteRequestForTests(
1963 const base::string16& jscript, 1963 const base::string16& jscript,
1964 int id, 1964 int id,
1965 bool notify_result, 1965 bool notify_result,
1966 bool has_user_gesture) { 1966 bool has_user_gesture) {
1967 TRACE_EVENT_INSTANT0("test_tracing", "OnJavaScriptExecuteRequestForTests", 1967 TRACE_EVENT_INSTANT0("test_tracing", "OnJavaScriptExecuteRequestForTests",
1968 TRACE_EVENT_SCOPE_THREAD); 1968 TRACE_EVENT_SCOPE_THREAD);
1969 1969
1970 // A bunch of tests expect to run code in the context of a user gesture, which 1970 // A bunch of tests expect to run code in the context of a user gesture, which
1971 // can grant additional privileges (e.g. the ability to create popups). 1971 // can grant additional privileges (e.g. the ability to create popups).
1972 std::unique_ptr<blink::WebScopedUserGesture> gesture( 1972 std::unique_ptr<blink::WebScopedUserGesture> gesture(
1973 has_user_gesture ? new blink::WebScopedUserGesture(frame_) : nullptr); 1973 has_user_gesture ? new blink::WebScopedUserGesture(frame_) : nullptr);
1974 v8::HandleScope handle_scope(blink::mainThreadIsolate()); 1974 v8::HandleScope handle_scope(blink::mainThreadIsolate());
1975 v8::Local<v8::Value> result = 1975 v8::Local<v8::Value> result = frame_->executeScriptAndReturnValue(
1976 frame_->executeScriptAndReturnValue(WebScriptSource(jscript)); 1976 WebScriptSource(WebString::fromUTF16(jscript)));
1977 1977
1978 HandleJavascriptExecutionResult(jscript, id, notify_result, result); 1978 HandleJavascriptExecutionResult(jscript, id, notify_result, result);
1979 } 1979 }
1980 1980
1981 void RenderFrameImpl::OnJavaScriptExecuteRequestInIsolatedWorld( 1981 void RenderFrameImpl::OnJavaScriptExecuteRequestInIsolatedWorld(
1982 const base::string16& jscript, 1982 const base::string16& jscript,
1983 int id, 1983 int id,
1984 bool notify_result, 1984 bool notify_result,
1985 int world_id) { 1985 int world_id) {
1986 TRACE_EVENT_INSTANT0("test_tracing", 1986 TRACE_EVENT_INSTANT0("test_tracing",
1987 "OnJavaScriptExecuteRequestInIsolatedWorld", 1987 "OnJavaScriptExecuteRequestInIsolatedWorld",
1988 TRACE_EVENT_SCOPE_THREAD); 1988 TRACE_EVENT_SCOPE_THREAD);
1989 1989
1990 if (world_id <= ISOLATED_WORLD_ID_GLOBAL || 1990 if (world_id <= ISOLATED_WORLD_ID_GLOBAL ||
1991 world_id > ISOLATED_WORLD_ID_MAX) { 1991 world_id > ISOLATED_WORLD_ID_MAX) {
1992 // Return if the world_id is not valid. world_id is passed as a plain int 1992 // Return if the world_id is not valid. world_id is passed as a plain int
1993 // over IPC and needs to be verified here, in the IPC endpoint. 1993 // over IPC and needs to be verified here, in the IPC endpoint.
1994 NOTREACHED(); 1994 NOTREACHED();
1995 return; 1995 return;
1996 } 1996 }
1997 1997
1998 v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); 1998 v8::HandleScope handle_scope(v8::Isolate::GetCurrent());
1999 WebScriptSource script = WebScriptSource(jscript); 1999 WebScriptSource script = WebScriptSource(WebString::fromUTF16(jscript));
2000 JavaScriptIsolatedWorldRequest* request = new JavaScriptIsolatedWorldRequest( 2000 JavaScriptIsolatedWorldRequest* request = new JavaScriptIsolatedWorldRequest(
2001 id, notify_result, routing_id_, weak_factory_.GetWeakPtr()); 2001 id, notify_result, routing_id_, weak_factory_.GetWeakPtr());
2002 frame_->requestExecuteScriptInIsolatedWorld(world_id, &script, 1, false, 2002 frame_->requestExecuteScriptInIsolatedWorld(world_id, &script, 1, false,
2003 request); 2003 request);
2004 } 2004 }
2005 2005
2006 RenderFrameImpl::JavaScriptIsolatedWorldRequest::JavaScriptIsolatedWorldRequest( 2006 RenderFrameImpl::JavaScriptIsolatedWorldRequest::JavaScriptIsolatedWorldRequest(
2007 int id, 2007 int id,
2008 bool notify_result, 2008 bool notify_result,
2009 int routing_id, 2009 int routing_id,
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
2225 v8::Local<v8::Context> context = frame_->mainWorldScriptContext(); 2225 v8::Local<v8::Context> context = frame_->mainWorldScriptContext();
2226 v8::Context::Scope context_scope(context); 2226 v8::Context::Scope context_scope(context);
2227 V8ValueConverterImpl converter; 2227 V8ValueConverterImpl converter;
2228 converter.SetDateAllowed(true); 2228 converter.SetDateAllowed(true);
2229 converter.SetRegExpAllowed(true); 2229 converter.SetRegExpAllowed(true);
2230 std::unique_ptr<base::Value> value(new base::StringValue(params.data)); 2230 std::unique_ptr<base::Value> value(new base::StringValue(params.data));
2231 v8::Local<v8::Value> result_value = converter.ToV8Value(value.get(), 2231 v8::Local<v8::Value> result_value = converter.ToV8Value(value.get(),
2232 context); 2232 context);
2233 serialized_script_value = WebSerializedScriptValue::serialize(result_value); 2233 serialized_script_value = WebSerializedScriptValue::serialize(result_value);
2234 } else { 2234 } else {
2235 serialized_script_value = WebSerializedScriptValue::fromString(params.data); 2235 serialized_script_value =
2236 WebSerializedScriptValue::fromString(WebString::fromUTF16(params.data));
2236 } 2237 }
2237 2238
2238 // We must pass in the target_origin to do the security check on this side, 2239 // We must pass in the target_origin to do the security check on this side,
2239 // since it may have changed since the original postMessage call was made. 2240 // since it may have changed since the original postMessage call was made.
2240 WebSecurityOrigin target_origin; 2241 WebSecurityOrigin target_origin;
2241 if (!params.target_origin.empty()) { 2242 if (!params.target_origin.empty()) {
2242 target_origin = 2243 target_origin = WebSecurityOrigin::createFromString(
2243 WebSecurityOrigin::createFromString(WebString(params.target_origin)); 2244 WebString::fromUTF16(params.target_origin));
2244 } 2245 }
2245 2246
2246 WebDOMMessageEvent msg_event(serialized_script_value, 2247 WebDOMMessageEvent msg_event(serialized_script_value,
2247 params.source_origin, 2248 WebString::fromUTF16(params.source_origin),
2248 source_frame, 2249 source_frame, frame_->document(), channels);
2249 frame_->document(),
2250 channels);
2251 frame_->dispatchMessageEventWithOriginCheck(target_origin, msg_event); 2250 frame_->dispatchMessageEventWithOriginCheck(target_origin, msg_event);
2252 } 2251 }
2253 2252
2254 void RenderFrameImpl::OnReload(bool bypass_cache) { 2253 void RenderFrameImpl::OnReload(bool bypass_cache) {
2255 frame_->reload(bypass_cache ? WebFrameLoadType::ReloadBypassingCache 2254 frame_->reload(bypass_cache ? WebFrameLoadType::ReloadBypassingCache
2256 : WebFrameLoadType::ReloadMainResource); 2255 : WebFrameLoadType::ReloadMainResource);
2257 } 2256 }
2258 2257
2259 void RenderFrameImpl::OnReloadLoFiImages() { 2258 void RenderFrameImpl::OnReloadLoFiImages() {
2260 previews_state_ = PREVIEWS_NO_TRANSFORM; 2259 previews_state_ = PREVIEWS_NO_TRANSFORM;
2261 GetWebFrame()->reloadLoFiImages(); 2260 GetWebFrame()->reloadLoFiImages();
2262 } 2261 }
2263 2262
2264 void RenderFrameImpl::OnTextSurroundingSelectionRequest(uint32_t max_length) { 2263 void RenderFrameImpl::OnTextSurroundingSelectionRequest(uint32_t max_length) {
2265 blink::WebSurroundingText surroundingText; 2264 blink::WebSurroundingText surroundingText;
2266 surroundingText.initializeFromCurrentSelection(frame_, max_length); 2265 surroundingText.initializeFromCurrentSelection(frame_, max_length);
2267 2266
2268 if (surroundingText.isNull()) { 2267 if (surroundingText.isNull()) {
2269 // |surroundingText| might not be correctly initialized, for example if 2268 // |surroundingText| might not be correctly initialized, for example if
2270 // |frame_->selectionRange().isNull()|, in other words, if there was no 2269 // |frame_->selectionRange().isNull()|, in other words, if there was no
2271 // selection. 2270 // selection.
2272 Send(new FrameHostMsg_TextSurroundingSelectionResponse( 2271 Send(new FrameHostMsg_TextSurroundingSelectionResponse(
2273 routing_id_, base::string16(), 0, 0)); 2272 routing_id_, base::string16(), 0, 0));
2274 return; 2273 return;
2275 } 2274 }
2276 2275
2277 Send(new FrameHostMsg_TextSurroundingSelectionResponse( 2276 Send(new FrameHostMsg_TextSurroundingSelectionResponse(
2278 routing_id_, 2277 routing_id_, surroundingText.textContent().utf16(),
2279 surroundingText.textContent(),
2280 surroundingText.startOffsetInTextContent(), 2278 surroundingText.startOffsetInTextContent(),
2281 surroundingText.endOffsetInTextContent())); 2279 surroundingText.endOffsetInTextContent()));
2282 } 2280 }
2283 2281
2284 void RenderFrameImpl::OnFocusedFormFieldDataRequest(int request_id) { 2282 void RenderFrameImpl::OnFocusedFormFieldDataRequest(int request_id) {
2285 DCHECK(frame_); 2283 DCHECK(frame_);
2286 2284
2287 // In case of early return, the IPC response message is always needed in 2285 // In case of early return, the IPC response message is always needed in
2288 // order to avoid leaks in the browser for unacknowledged requests. 2286 // order to avoid leaks in the browser for unacknowledged requests.
2289 if (frame_ != render_view_->GetWebView()->focusedFrame() || 2287 if (frame_ != render_view_->GetWebView()->focusedFrame() ||
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
2730 blink::WebPlugin* RenderFrameImpl::createPlugin( 2728 blink::WebPlugin* RenderFrameImpl::createPlugin(
2731 blink::WebLocalFrame* frame, 2729 blink::WebLocalFrame* frame,
2732 const blink::WebPluginParams& params) { 2730 const blink::WebPluginParams& params) {
2733 DCHECK_EQ(frame_, frame); 2731 DCHECK_EQ(frame_, frame);
2734 blink::WebPlugin* plugin = NULL; 2732 blink::WebPlugin* plugin = NULL;
2735 if (GetContentClient()->renderer()->OverrideCreatePlugin( 2733 if (GetContentClient()->renderer()->OverrideCreatePlugin(
2736 this, frame, params, &plugin)) { 2734 this, frame, params, &plugin)) {
2737 return plugin; 2735 return plugin;
2738 } 2736 }
2739 2737
2740 if (base::UTF16ToUTF8(base::StringPiece16(params.mimeType)) == 2738 if (params.mimeType.containsOnlyASCII() &&
2741 kBrowserPluginMimeType) { 2739 params.mimeType.ascii() == kBrowserPluginMimeType) {
2742 return BrowserPluginManager::Get()->CreateBrowserPlugin( 2740 return BrowserPluginManager::Get()->CreateBrowserPlugin(
2743 this, GetContentClient() 2741 this, GetContentClient()
2744 ->renderer() 2742 ->renderer()
2745 ->CreateBrowserPluginDelegate(this, kBrowserPluginMimeType, 2743 ->CreateBrowserPluginDelegate(this, kBrowserPluginMimeType,
2746 GURL(params.url)) 2744 GURL(params.url))
2747 ->GetWeakPtr()); 2745 ->GetWeakPtr());
2748 } 2746 }
2749 2747
2750 #if BUILDFLAG(ENABLE_PLUGINS) 2748 #if BUILDFLAG(ENABLE_PLUGINS)
2751 WebPluginInfo info; 2749 WebPluginInfo info;
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
3018 const blink::WebString& name, 3016 const blink::WebString& name,
3019 const blink::WebString& unique_name, 3017 const blink::WebString& unique_name,
3020 blink::WebSandboxFlags sandbox_flags, 3018 blink::WebSandboxFlags sandbox_flags,
3021 const blink::WebFrameOwnerProperties& frame_owner_properties) { 3019 const blink::WebFrameOwnerProperties& frame_owner_properties) {
3022 // Synchronously notify the browser of a child frame creation to get the 3020 // Synchronously notify the browser of a child frame creation to get the
3023 // routing_id for the RenderFrame. 3021 // routing_id for the RenderFrame.
3024 int child_routing_id = MSG_ROUTING_NONE; 3022 int child_routing_id = MSG_ROUTING_NONE;
3025 FrameHostMsg_CreateChildFrame_Params params; 3023 FrameHostMsg_CreateChildFrame_Params params;
3026 params.parent_routing_id = routing_id_; 3024 params.parent_routing_id = routing_id_;
3027 params.scope = scope; 3025 params.scope = scope;
3028 params.frame_name = base::UTF16ToUTF8(base::StringPiece16(name)); 3026 params.frame_name = name.utf8();
3029 params.frame_unique_name = 3027 params.frame_unique_name = unique_name.utf8();
3030 base::UTF16ToUTF8(base::StringPiece16(unique_name));
3031 params.sandbox_flags = sandbox_flags; 3028 params.sandbox_flags = sandbox_flags;
3032 params.frame_owner_properties = FrameOwnerProperties(frame_owner_properties); 3029 params.frame_owner_properties = FrameOwnerProperties(frame_owner_properties);
3033 Send(new FrameHostMsg_CreateChildFrame(params, &child_routing_id)); 3030 Send(new FrameHostMsg_CreateChildFrame(params, &child_routing_id));
3034 3031
3035 // Allocation of routing id failed, so we can't create a child frame. This can 3032 // Allocation of routing id failed, so we can't create a child frame. This can
3036 // happen if the synchronous IPC message above has failed. This can 3033 // happen if the synchronous IPC message above has failed. This can
3037 // legitimately happen when the browser process has already destroyed 3034 // legitimately happen when the browser process has already destroyed
3038 // RenderProcessHost, but the renderer process hasn't quit yet. 3035 // RenderProcessHost, but the renderer process hasn't quit yet.
3039 if (child_routing_id == MSG_ROUTING_NONE) 3036 if (child_routing_id == MSG_ROUTING_NONE)
3040 return nullptr; 3037 return nullptr;
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
3157 void RenderFrameImpl::willCommitProvisionalLoad(blink::WebLocalFrame* frame) { 3154 void RenderFrameImpl::willCommitProvisionalLoad(blink::WebLocalFrame* frame) {
3158 DCHECK_EQ(frame_, frame); 3155 DCHECK_EQ(frame_, frame);
3159 3156
3160 for (auto& observer : observers_) 3157 for (auto& observer : observers_)
3161 observer.WillCommitProvisionalLoad(); 3158 observer.WillCommitProvisionalLoad();
3162 } 3159 }
3163 3160
3164 void RenderFrameImpl::didChangeName(const blink::WebString& name, 3161 void RenderFrameImpl::didChangeName(const blink::WebString& name,
3165 const blink::WebString& unique_name) { 3162 const blink::WebString& unique_name) {
3166 Send(new FrameHostMsg_DidChangeName( 3163 Send(new FrameHostMsg_DidChangeName(
3167 routing_id_, base::UTF16ToUTF8(base::StringPiece16(name)), 3164 routing_id_, name.utf8(), unique_name.utf8()));
3168 base::UTF16ToUTF8(base::StringPiece16(unique_name))));
3169 3165
3170 if (!committed_first_load_) 3166 if (!committed_first_load_)
3171 name_changed_before_first_commit_ = true; 3167 name_changed_before_first_commit_ = true;
3172 } 3168 }
3173 3169
3174 void RenderFrameImpl::didEnforceInsecureRequestPolicy( 3170 void RenderFrameImpl::didEnforceInsecureRequestPolicy(
3175 blink::WebInsecureRequestPolicy policy) { 3171 blink::WebInsecureRequestPolicy policy) {
3176 Send(new FrameHostMsg_EnforceInsecureRequestPolicy(routing_id_, policy)); 3172 Send(new FrameHostMsg_EnforceInsecureRequestPolicy(routing_id_, policy));
3177 } 3173 }
3178 3174
(...skipping 16 matching lines...) Expand all
3195 } 3191 }
3196 3192
3197 void RenderFrameImpl::didAddContentSecurityPolicy( 3193 void RenderFrameImpl::didAddContentSecurityPolicy(
3198 const blink::WebString& header_value, 3194 const blink::WebString& header_value,
3199 blink::WebContentSecurityPolicyType type, 3195 blink::WebContentSecurityPolicyType type,
3200 blink::WebContentSecurityPolicySource source) { 3196 blink::WebContentSecurityPolicySource source) {
3201 if (!SiteIsolationPolicy::AreCrossProcessFramesPossible()) 3197 if (!SiteIsolationPolicy::AreCrossProcessFramesPossible())
3202 return; 3198 return;
3203 3199
3204 ContentSecurityPolicyHeader header; 3200 ContentSecurityPolicyHeader header;
3205 header.header_value = base::UTF16ToUTF8(base::StringPiece16(header_value)); 3201 header.header_value = header_value.utf8();
3206 header.type = type; 3202 header.type = type;
3207 header.source = source; 3203 header.source = source;
3208 Send(new FrameHostMsg_DidAddContentSecurityPolicy(routing_id_, header)); 3204 Send(new FrameHostMsg_DidAddContentSecurityPolicy(routing_id_, header));
3209 } 3205 }
3210 3206
3211 void RenderFrameImpl::didChangeFrameOwnerProperties( 3207 void RenderFrameImpl::didChangeFrameOwnerProperties(
3212 blink::WebFrame* child_frame, 3208 blink::WebFrame* child_frame,
3213 const blink::WebFrameOwnerProperties& frame_owner_properties) { 3209 const blink::WebFrameOwnerProperties& frame_owner_properties) {
3214 Send(new FrameHostMsg_DidChangeFrameOwnerProperties( 3210 Send(new FrameHostMsg_DidChangeFrameOwnerProperties(
3215 routing_id_, GetRoutingIdForFrameOrProxy(child_frame), 3211 routing_id_, GetRoutingIdForFrameOrProxy(child_frame),
(...skipping 10 matching lines...) Expand all
3226 observer.DidMatchCSS(newly_matching_selectors, stopped_matching_selectors); 3222 observer.DidMatchCSS(newly_matching_selectors, stopped_matching_selectors);
3227 } 3223 }
3228 3224
3229 void RenderFrameImpl::setHasReceivedUserGesture() { 3225 void RenderFrameImpl::setHasReceivedUserGesture() {
3230 Send(new FrameHostMsg_SetHasReceivedUserGesture(routing_id_)); 3226 Send(new FrameHostMsg_SetHasReceivedUserGesture(routing_id_));
3231 } 3227 }
3232 3228
3233 bool RenderFrameImpl::shouldReportDetailedMessageForSource( 3229 bool RenderFrameImpl::shouldReportDetailedMessageForSource(
3234 const blink::WebString& source) { 3230 const blink::WebString& source) {
3235 return GetContentClient()->renderer()->ShouldReportDetailedMessageForSource( 3231 return GetContentClient()->renderer()->ShouldReportDetailedMessageForSource(
3236 source); 3232 source.utf16());
3237 } 3233 }
3238 3234
3239 void RenderFrameImpl::didAddMessageToConsole( 3235 void RenderFrameImpl::didAddMessageToConsole(
3240 const blink::WebConsoleMessage& message, 3236 const blink::WebConsoleMessage& message,
3241 const blink::WebString& source_name, 3237 const blink::WebString& source_name,
3242 unsigned source_line, 3238 unsigned source_line,
3243 const blink::WebString& stack_trace) { 3239 const blink::WebString& stack_trace) {
3244 logging::LogSeverity log_severity = logging::LOG_VERBOSE; 3240 logging::LogSeverity log_severity = logging::LOG_VERBOSE;
3245 switch (message.level) { 3241 switch (message.level) {
3246 case blink::WebConsoleMessage::LevelVerbose: 3242 case blink::WebConsoleMessage::LevelVerbose:
3247 log_severity = logging::LOG_VERBOSE; 3243 log_severity = logging::LOG_VERBOSE;
3248 break; 3244 break;
3249 case blink::WebConsoleMessage::LevelInfo: 3245 case blink::WebConsoleMessage::LevelInfo:
3250 log_severity = logging::LOG_INFO; 3246 log_severity = logging::LOG_INFO;
3251 break; 3247 break;
3252 case blink::WebConsoleMessage::LevelWarning: 3248 case blink::WebConsoleMessage::LevelWarning:
3253 log_severity = logging::LOG_WARNING; 3249 log_severity = logging::LOG_WARNING;
3254 break; 3250 break;
3255 case blink::WebConsoleMessage::LevelError: 3251 case blink::WebConsoleMessage::LevelError:
3256 log_severity = logging::LOG_ERROR; 3252 log_severity = logging::LOG_ERROR;
3257 break; 3253 break;
3258 default: 3254 default:
3259 log_severity = logging::LOG_VERBOSE; 3255 log_severity = logging::LOG_VERBOSE;
3260 } 3256 }
3261 3257
3262 if (shouldReportDetailedMessageForSource(source_name)) { 3258 if (shouldReportDetailedMessageForSource(source_name)) {
3263 for (auto& observer : observers_) { 3259 for (auto& observer : observers_) {
3264 observer.DetailedConsoleMessageAdded(message.text, source_name, 3260 observer.DetailedConsoleMessageAdded(
3265 stack_trace, source_line, 3261 message.text.utf16(), source_name.utf16(), stack_trace.utf16(),
3266 static_cast<uint32_t>(log_severity)); 3262 source_line, static_cast<uint32_t>(log_severity));
3267 } 3263 }
3268 } 3264 }
3269 3265
3270 Send(new FrameHostMsg_DidAddMessageToConsole( 3266 Send(new FrameHostMsg_DidAddMessageToConsole(
3271 routing_id_, static_cast<int32_t>(log_severity), message.text, 3267 routing_id_, static_cast<int32_t>(log_severity), message.text.utf16(),
3272 static_cast<int32_t>(source_line), source_name)); 3268 static_cast<int32_t>(source_line), source_name.utf16()));
3273 } 3269 }
3274 3270
3275 void RenderFrameImpl::loadURLExternally(const blink::WebURLRequest& request, 3271 void RenderFrameImpl::loadURLExternally(const blink::WebURLRequest& request,
3276 blink::WebNavigationPolicy policy, 3272 blink::WebNavigationPolicy policy,
3277 const blink::WebString& suggested_name, 3273 const blink::WebString& suggested_name,
3278 bool should_replace_current_entry) { 3274 bool should_replace_current_entry) {
3279 Referrer referrer(RenderViewImpl::GetReferrerFromRequest(frame_, request)); 3275 Referrer referrer(RenderViewImpl::GetReferrerFromRequest(frame_, request));
3280 if (policy == blink::WebNavigationPolicyDownload) { 3276 if (policy == blink::WebNavigationPolicyDownload) {
3281 FrameHostMsg_DownloadUrl_Params params; 3277 FrameHostMsg_DownloadUrl_Params params;
3282 params.render_view_id = render_view_->GetRoutingID(); 3278 params.render_view_id = render_view_->GetRoutingID();
3283 params.render_frame_id = GetRoutingID(); 3279 params.render_frame_id = GetRoutingID();
3284 params.url = request.url(); 3280 params.url = request.url();
3285 params.referrer = referrer; 3281 params.referrer = referrer;
3286 params.initiator_origin = request.requestorOrigin(); 3282 params.initiator_origin = request.requestorOrigin();
3287 params.suggested_name = suggested_name; 3283 params.suggested_name = suggested_name.utf16();
3288 3284
3289 Send(new FrameHostMsg_DownloadUrl(params)); 3285 Send(new FrameHostMsg_DownloadUrl(params));
3290 } else { 3286 } else {
3291 OpenURL(request.url(), IsHttpPost(request), 3287 OpenURL(request.url(), IsHttpPost(request),
3292 GetRequestBodyForWebURLRequest(request), 3288 GetRequestBodyForWebURLRequest(request),
3293 GetWebURLRequestHeaders(request), referrer, policy, 3289 GetWebURLRequestHeaders(request), referrer, policy,
3294 should_replace_current_entry, false); 3290 should_replace_current_entry, false);
3295 } 3291 }
3296 } 3292 }
3297 3293
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
3773 GetContentClient()->renderer()->RunScriptsAtDocumentStart(this); 3769 GetContentClient()->renderer()->RunScriptsAtDocumentStart(this);
3774 // Do not use |this| or |frame|! ContentClient might have deleted them by now! 3770 // Do not use |this| or |frame|! ContentClient might have deleted them by now!
3775 } 3771 }
3776 3772
3777 void RenderFrameImpl::didReceiveTitle(blink::WebLocalFrame* frame, 3773 void RenderFrameImpl::didReceiveTitle(blink::WebLocalFrame* frame,
3778 const blink::WebString& title, 3774 const blink::WebString& title,
3779 blink::WebTextDirection direction) { 3775 blink::WebTextDirection direction) {
3780 DCHECK_EQ(frame_, frame); 3776 DCHECK_EQ(frame_, frame);
3781 // Ignore all but top level navigations. 3777 // Ignore all but top level navigations.
3782 if (!frame->parent()) { 3778 if (!frame->parent()) {
3783 base::string16 title16 = title;
3784 base::trace_event::TraceLog::GetInstance()->UpdateProcessLabel( 3779 base::trace_event::TraceLog::GetInstance()->UpdateProcessLabel(
3785 routing_id_, base::UTF16ToUTF8(title16)); 3780 routing_id_, title.utf8());
3786 3781
3782 base::string16 title16 = title.utf16();
3787 base::string16 shortened_title = title16.substr(0, kMaxTitleChars); 3783 base::string16 shortened_title = title16.substr(0, kMaxTitleChars);
3788 Send(new FrameHostMsg_UpdateTitle(routing_id_, 3784 Send(new FrameHostMsg_UpdateTitle(routing_id_,
3789 shortened_title, direction)); 3785 shortened_title, direction));
3790 } 3786 }
3791 3787
3792 // Also check whether we have new encoding name. 3788 // Also check whether we have new encoding name.
3793 UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); 3789 UpdateEncoding(frame, frame->view()->pageEncoding().utf8());
3794 } 3790 }
3795 3791
3796 void RenderFrameImpl::didChangeIcon(blink::WebLocalFrame* frame, 3792 void RenderFrameImpl::didChangeIcon(blink::WebLocalFrame* frame,
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
4067 new RendererWebColorChooserImpl(this, client); 4063 new RendererWebColorChooserImpl(this, client);
4068 std::vector<ColorSuggestion> color_suggestions; 4064 std::vector<ColorSuggestion> color_suggestions;
4069 for (size_t i = 0; i < suggestions.size(); i++) { 4065 for (size_t i = 0; i < suggestions.size(); i++) {
4070 color_suggestions.push_back(ColorSuggestion(suggestions[i])); 4066 color_suggestions.push_back(ColorSuggestion(suggestions[i]));
4071 } 4067 }
4072 color_chooser->Open(static_cast<SkColor>(initial_color), color_suggestions); 4068 color_chooser->Open(static_cast<SkColor>(initial_color), color_suggestions);
4073 return color_chooser; 4069 return color_chooser;
4074 } 4070 }
4075 4071
4076 void RenderFrameImpl::runModalAlertDialog(const blink::WebString& message) { 4072 void RenderFrameImpl::runModalAlertDialog(const blink::WebString& message) {
4077 RunJavaScriptMessage(JAVASCRIPT_MESSAGE_TYPE_ALERT, 4073 RunJavaScriptMessage(JAVASCRIPT_MESSAGE_TYPE_ALERT, message.utf16(),
4078 message, 4074 base::string16(), frame_->document().url(), NULL);
4079 base::string16(),
4080 frame_->document().url(),
4081 NULL);
4082 } 4075 }
4083 4076
4084 bool RenderFrameImpl::runModalConfirmDialog(const blink::WebString& message) { 4077 bool RenderFrameImpl::runModalConfirmDialog(const blink::WebString& message) {
4085 return RunJavaScriptMessage(JAVASCRIPT_MESSAGE_TYPE_CONFIRM, 4078 return RunJavaScriptMessage(JAVASCRIPT_MESSAGE_TYPE_CONFIRM, message.utf16(),
4086 message, 4079 base::string16(), frame_->document().url(), NULL);
4087 base::string16(),
4088 frame_->document().url(),
4089 NULL);
4090 } 4080 }
4091 4081
4092 bool RenderFrameImpl::runModalPromptDialog( 4082 bool RenderFrameImpl::runModalPromptDialog(
4093 const blink::WebString& message, 4083 const blink::WebString& message,
4094 const blink::WebString& default_value, 4084 const blink::WebString& default_value,
4095 blink::WebString* actual_value) { 4085 blink::WebString* actual_value) {
4096 base::string16 result; 4086 base::string16 result;
4097 bool ok = RunJavaScriptMessage(JAVASCRIPT_MESSAGE_TYPE_PROMPT, 4087 bool ok = RunJavaScriptMessage(JAVASCRIPT_MESSAGE_TYPE_PROMPT,
4098 message, 4088 message.utf16(), default_value.utf16(),
4099 default_value, 4089 frame_->document().url(), &result);
4100 frame_->document().url(),
4101 &result);
4102 if (ok) 4090 if (ok)
4103 actual_value->assign(result); 4091 actual_value->assign(WebString::fromUTF16(result));
4104 return ok; 4092 return ok;
4105 } 4093 }
4106 4094
4107 bool RenderFrameImpl::runModalBeforeUnloadDialog(bool is_reload) { 4095 bool RenderFrameImpl::runModalBeforeUnloadDialog(bool is_reload) {
4108 // Don't allow further dialogs if we are waiting to swap out, since the 4096 // Don't allow further dialogs if we are waiting to swap out, since the
4109 // ScopedPageLoadDeferrer in our stack prevents it. 4097 // ScopedPageLoadDeferrer in our stack prevents it.
4110 if (suppress_further_dialogs_) 4098 if (suppress_further_dialogs_)
4111 return false; 4099 return false;
4112 4100
4113 bool success = false; 4101 bool success = false;
(...skipping 12 matching lines...) Expand all
4126 4114
4127 FileChooserParams ipc_params; 4115 FileChooserParams ipc_params;
4128 if (params.directory) 4116 if (params.directory)
4129 ipc_params.mode = FileChooserParams::UploadFolder; 4117 ipc_params.mode = FileChooserParams::UploadFolder;
4130 else if (params.multiSelect) 4118 else if (params.multiSelect)
4131 ipc_params.mode = FileChooserParams::OpenMultiple; 4119 ipc_params.mode = FileChooserParams::OpenMultiple;
4132 else if (params.saveAs) 4120 else if (params.saveAs)
4133 ipc_params.mode = FileChooserParams::Save; 4121 ipc_params.mode = FileChooserParams::Save;
4134 else 4122 else
4135 ipc_params.mode = FileChooserParams::Open; 4123 ipc_params.mode = FileChooserParams::Open;
4136 ipc_params.title = params.title; 4124 ipc_params.title = params.title.utf16();
4137 ipc_params.accept_types.reserve(params.acceptTypes.size()); 4125 ipc_params.accept_types.reserve(params.acceptTypes.size());
4138 for (const auto& type : params.acceptTypes) 4126 for (const auto& type : params.acceptTypes)
4139 ipc_params.accept_types.push_back(type); 4127 ipc_params.accept_types.push_back(type.utf16());
4140 ipc_params.need_local_path = params.needLocalPath; 4128 ipc_params.need_local_path = params.needLocalPath;
4141 #if defined(OS_ANDROID) 4129 #if defined(OS_ANDROID)
4142 ipc_params.capture = params.useMediaCapture; 4130 ipc_params.capture = params.useMediaCapture;
4143 #endif 4131 #endif
4144 ipc_params.requestor = params.requestor; 4132 ipc_params.requestor = params.requestor;
4145 4133
4146 return ScheduleFileChooser(ipc_params, chooser_completion); 4134 return ScheduleFileChooser(ipc_params, chooser_completion);
4147 } 4135 }
4148 4136
4149 void RenderFrameImpl::showContextMenu(const blink::WebContextMenuData& data) { 4137 void RenderFrameImpl::showContextMenu(const blink::WebContextMenuData& data) {
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
4692 } 4680 }
4693 4681
4694 void RenderFrameImpl::exitFullscreen() { 4682 void RenderFrameImpl::exitFullscreen() {
4695 Send(new FrameHostMsg_ToggleFullscreen(routing_id_, false)); 4683 Send(new FrameHostMsg_ToggleFullscreen(routing_id_, false));
4696 } 4684 }
4697 4685
4698 void RenderFrameImpl::registerProtocolHandler(const WebString& scheme, 4686 void RenderFrameImpl::registerProtocolHandler(const WebString& scheme,
4699 const WebURL& url, 4687 const WebURL& url,
4700 const WebString& title) { 4688 const WebString& title) {
4701 bool user_gesture = WebUserGestureIndicator::isProcessingUserGesture(); 4689 bool user_gesture = WebUserGestureIndicator::isProcessingUserGesture();
4702 Send(new FrameHostMsg_RegisterProtocolHandler( 4690 Send(new FrameHostMsg_RegisterProtocolHandler(routing_id_, scheme.utf8(), url,
4703 routing_id_, 4691 title.utf16(), user_gesture));
4704 base::UTF16ToUTF8(base::StringPiece16(scheme)),
4705 url,
4706 title,
4707 user_gesture));
4708 } 4692 }
4709 4693
4710 void RenderFrameImpl::unregisterProtocolHandler(const WebString& scheme, 4694 void RenderFrameImpl::unregisterProtocolHandler(const WebString& scheme,
4711 const WebURL& url) { 4695 const WebURL& url) {
4712 bool user_gesture = WebUserGestureIndicator::isProcessingUserGesture(); 4696 bool user_gesture = WebUserGestureIndicator::isProcessingUserGesture();
4713 Send(new FrameHostMsg_UnregisterProtocolHandler( 4697 Send(new FrameHostMsg_UnregisterProtocolHandler(routing_id_, scheme.utf8(),
4714 routing_id_, 4698 url, user_gesture));
4715 base::UTF16ToUTF8(base::StringPiece16(scheme)),
4716 url,
4717 user_gesture));
4718 } 4699 }
4719 4700
4720 void RenderFrameImpl::didSerializeDataForFrame( 4701 void RenderFrameImpl::didSerializeDataForFrame(
4721 const WebCString& data, 4702 const WebCString& data,
4722 WebFrameSerializerClient::FrameSerializationStatus status) { 4703 WebFrameSerializerClient::FrameSerializationStatus status) {
4723 bool end_of_data = status == WebFrameSerializerClient::CurrentFrameIsFinished; 4704 bool end_of_data = status == WebFrameSerializerClient::CurrentFrameIsFinished;
4724 Send(new FrameHostMsg_SerializedHtmlWithLocalLinksResponse( 4705 Send(new FrameHostMsg_SerializedHtmlWithLocalLinksResponse(
4725 routing_id_, data, end_of_data)); 4706 routing_id_, data, end_of_data));
4726 } 4707 }
4727 4708
(...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after
5619 const WebFindOptions& options) { 5600 const WebFindOptions& options) {
5620 DCHECK(!search_text.empty()); 5601 DCHECK(!search_text.empty());
5621 5602
5622 blink::WebPlugin* plugin = GetWebPluginForFind(); 5603 blink::WebPlugin* plugin = GetWebPluginForFind();
5623 // Check if the plugin still exists in the document. 5604 // Check if the plugin still exists in the document.
5624 if (plugin) { 5605 if (plugin) {
5625 if (options.findNext) { 5606 if (options.findNext) {
5626 // Just navigate back/forward. 5607 // Just navigate back/forward.
5627 plugin->selectFindResult(options.forward, request_id); 5608 plugin->selectFindResult(options.forward, request_id);
5628 } else { 5609 } else {
5629 if (!plugin->startFind(search_text, options.matchCase, request_id)) { 5610 if (!plugin->startFind(WebString::fromUTF16(search_text),
5611 options.matchCase, request_id)) {
5630 // Send "no results". 5612 // Send "no results".
5631 SendFindReply(request_id, 0 /* match_count */, 0 /* ordinal */, 5613 SendFindReply(request_id, 0 /* match_count */, 0 /* ordinal */,
5632 gfx::Rect(), true /* final_status_update */); 5614 gfx::Rect(), true /* final_status_update */);
5633 } 5615 }
5634 } 5616 }
5635 return; 5617 return;
5636 } 5618 }
5637 5619
5638 frame_->requestFind(request_id, search_text, options); 5620 frame_->requestFind(request_id, WebString::fromUTF16(search_text), options);
5639 } 5621 }
5640 5622
5641 void RenderFrameImpl::OnClearActiveFindMatch() { 5623 void RenderFrameImpl::OnClearActiveFindMatch() {
5642 frame_->executeCommand(WebString::fromUTF8("Unselect")); 5624 frame_->executeCommand(WebString::fromUTF8("Unselect"));
5643 frame_->clearActiveFindMatch(); 5625 frame_->clearActiveFindMatch();
5644 } 5626 }
5645 5627
5646 // Ensure that content::StopFindAction and blink::WebLocalFrame::StopFindAction 5628 // Ensure that content::StopFindAction and blink::WebLocalFrame::StopFindAction
5647 // are kept in sync. 5629 // are kept in sync.
5648 STATIC_ASSERT_ENUM(STOP_FIND_ACTION_CLEAR_SELECTION, 5630 STATIC_ASSERT_ENUM(STOP_FIND_ACTION_CLEAR_SELECTION,
(...skipping 28 matching lines...) Expand all
5677 // This could happen if we navigated to a different page before the user 5659 // This could happen if we navigated to a different page before the user
5678 // closed the chooser. 5660 // closed the chooser.
5679 if (file_chooser_completions_.empty()) 5661 if (file_chooser_completions_.empty())
5680 return; 5662 return;
5681 5663
5682 // Convert Chrome's SelectedFileInfo list to WebKit's. 5664 // Convert Chrome's SelectedFileInfo list to WebKit's.
5683 WebVector<blink::WebFileChooserCompletion::SelectedFileInfo> selected_files( 5665 WebVector<blink::WebFileChooserCompletion::SelectedFileInfo> selected_files(
5684 files.size()); 5666 files.size());
5685 for (size_t i = 0; i < files.size(); ++i) { 5667 for (size_t i = 0; i < files.size(); ++i) {
5686 blink::WebFileChooserCompletion::SelectedFileInfo selected_file; 5668 blink::WebFileChooserCompletion::SelectedFileInfo selected_file;
5687 selected_file.path = files[i].file_path.AsUTF16Unsafe(); 5669 selected_file.path = blink::FilePathToWebString(files[i].file_path);
5688 selected_file.displayName = 5670 selected_file.displayName =
5689 base::FilePath(files[i].display_name).AsUTF16Unsafe(); 5671 blink::FilePathToWebString(base::FilePath(files[i].display_name));
5690 if (files[i].file_system_url.is_valid()) { 5672 if (files[i].file_system_url.is_valid()) {
5691 selected_file.fileSystemURL = files[i].file_system_url; 5673 selected_file.fileSystemURL = files[i].file_system_url;
5692 selected_file.length = files[i].length; 5674 selected_file.length = files[i].length;
5693 selected_file.modificationTime = files[i].modification_time.ToDoubleT(); 5675 selected_file.modificationTime = files[i].modification_time.ToDoubleT();
5694 selected_file.isDirectory = files[i].is_directory; 5676 selected_file.isDirectory = files[i].is_directory;
5695 } 5677 }
5696 selected_files[i] = selected_file; 5678 selected_files[i] = selected_file;
5697 } 5679 }
5698 5680
5699 if (file_chooser_completions_.front()->completion) { 5681 if (file_chooser_completions_.front()->completion) {
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
6115 blink::WebTextInputTypeNone) { 6097 blink::WebTextInputTypeNone) {
6116 // If current focused element is editable, we will send 100 more chars 6098 // If current focused element is editable, we will send 100 more chars
6117 // before and after selection. It is for input method surrounding text 6099 // before and after selection. It is for input method surrounding text
6118 // feature. 6100 // feature.
6119 if (selection.startOffset() > kExtraCharsBeforeAndAfterSelection) 6101 if (selection.startOffset() > kExtraCharsBeforeAndAfterSelection)
6120 offset = selection.startOffset() - kExtraCharsBeforeAndAfterSelection; 6102 offset = selection.startOffset() - kExtraCharsBeforeAndAfterSelection;
6121 else 6103 else
6122 offset = 0; 6104 offset = 0;
6123 size_t length = 6105 size_t length =
6124 selection.endOffset() - offset + kExtraCharsBeforeAndAfterSelection; 6106 selection.endOffset() - offset + kExtraCharsBeforeAndAfterSelection;
6125 text = frame_->rangeAsText(WebRange(offset, length)); 6107 text = frame_->rangeAsText(WebRange(offset, length)).utf16();
6126 } else { 6108 } else {
6127 offset = selection.startOffset(); 6109 offset = selection.startOffset();
6128 text = frame_->selectionAsText(); 6110 text = frame_->selectionAsText().utf16();
6129 // http://crbug.com/101435 6111 // http://crbug.com/101435
6130 // In some case, frame->selectionAsText() returned text's length is not 6112 // In some case, frame->selectionAsText() returned text's length is not
6131 // equal to the length returned from 6113 // equal to the length returned from
6132 // GetWebWidget()->caretOrSelectionRange(). 6114 // GetWebWidget()->caretOrSelectionRange().
6133 // So we have to set the range according to text.length(). 6115 // So we have to set the range according to text.length().
6134 range.set_end(range.start() + text.length()); 6116 range.set_end(range.start() + text.length());
6135 } 6117 }
6136 } 6118 }
6137 6119
6138 // TODO(dglazkov): Investigate if and why this would be happening, 6120 // TODO(dglazkov): Investigate if and why this would be happening,
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
6390 new MojoBindingsController(this, MojoBindingsType::FOR_HEADLESS); 6372 new MojoBindingsController(this, MojoBindingsType::FOR_HEADLESS);
6391 } 6373 }
6392 } 6374 }
6393 6375
6394 void RenderFrameImpl::SendFailedProvisionalLoad( 6376 void RenderFrameImpl::SendFailedProvisionalLoad(
6395 const blink::WebURLRequest& request, 6377 const blink::WebURLRequest& request,
6396 const blink::WebURLError& error, 6378 const blink::WebURLError& error,
6397 blink::WebLocalFrame* frame) { 6379 blink::WebLocalFrame* frame) {
6398 bool show_repost_interstitial = 6380 bool show_repost_interstitial =
6399 (error.reason == net::ERR_CACHE_MISS && 6381 (error.reason == net::ERR_CACHE_MISS &&
6400 base::EqualsASCII(base::StringPiece16(request.httpMethod()), "POST")); 6382 base::EqualsASCII(request.httpMethod().utf16(), "POST"));
6401 6383
6402 FrameHostMsg_DidFailProvisionalLoadWithError_Params params; 6384 FrameHostMsg_DidFailProvisionalLoadWithError_Params params;
6403 params.error_code = error.reason; 6385 params.error_code = error.reason;
6404 GetContentClient()->renderer()->GetNavigationErrorStrings( 6386 GetContentClient()->renderer()->GetNavigationErrorStrings(
6405 this, request, error, nullptr, &params.error_description); 6387 this, request, error, nullptr, &params.error_description);
6406 params.url = error.unreachableURL; 6388 params.url = error.unreachableURL;
6407 params.showing_repost_interstitial = show_repost_interstitial; 6389 params.showing_repost_interstitial = show_repost_interstitial;
6408 params.was_ignored_by_handler = error.wasIgnoredByHandler; 6390 params.was_ignored_by_handler = error.wasIgnoredByHandler;
6409 Send(new FrameHostMsg_DidFailProvisionalLoadWithError(routing_id_, params)); 6391 Send(new FrameHostMsg_DidFailProvisionalLoadWithError(routing_id_, params));
6410 } 6392 }
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
6864 // event target. Potentially a Pepper plugin will receive the event. 6846 // event target. Potentially a Pepper plugin will receive the event.
6865 // In order to tell whether a plugin gets the last mouse event and which it 6847 // In order to tell whether a plugin gets the last mouse event and which it
6866 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6848 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6867 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6849 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6868 // |pepper_last_mouse_event_target_|. 6850 // |pepper_last_mouse_event_target_|.
6869 pepper_last_mouse_event_target_ = nullptr; 6851 pepper_last_mouse_event_target_ = nullptr;
6870 #endif 6852 #endif
6871 } 6853 }
6872 6854
6873 } // namespace content 6855 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698