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

Side by Side Diff: content/renderer/render_view_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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_view_impl.h" 5 #include "content/renderer/render_view_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <memory> 9 #include <memory>
10 10
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 377
378 namespace { 378 namespace {
379 379
380 typedef void (*SetFontFamilyWrapper)(blink::WebSettings*, 380 typedef void (*SetFontFamilyWrapper)(blink::WebSettings*,
381 const base::string16&, 381 const base::string16&,
382 UScriptCode); 382 UScriptCode);
383 383
384 void SetStandardFontFamilyWrapper(WebSettings* settings, 384 void SetStandardFontFamilyWrapper(WebSettings* settings,
385 const base::string16& font, 385 const base::string16& font,
386 UScriptCode script) { 386 UScriptCode script) {
387 settings->setStandardFontFamily(font, script); 387 settings->setStandardFontFamily(WebString::fromUTF16(font), script);
388 } 388 }
389 389
390 void SetFixedFontFamilyWrapper(WebSettings* settings, 390 void SetFixedFontFamilyWrapper(WebSettings* settings,
391 const base::string16& font, 391 const base::string16& font,
392 UScriptCode script) { 392 UScriptCode script) {
393 settings->setFixedFontFamily(font, script); 393 settings->setFixedFontFamily(WebString::fromUTF16(font), script);
394 } 394 }
395 395
396 void SetSerifFontFamilyWrapper(WebSettings* settings, 396 void SetSerifFontFamilyWrapper(WebSettings* settings,
397 const base::string16& font, 397 const base::string16& font,
398 UScriptCode script) { 398 UScriptCode script) {
399 settings->setSerifFontFamily(font, script); 399 settings->setSerifFontFamily(WebString::fromUTF16(font), script);
400 } 400 }
401 401
402 void SetSansSerifFontFamilyWrapper(WebSettings* settings, 402 void SetSansSerifFontFamilyWrapper(WebSettings* settings,
403 const base::string16& font, 403 const base::string16& font,
404 UScriptCode script) { 404 UScriptCode script) {
405 settings->setSansSerifFontFamily(font, script); 405 settings->setSansSerifFontFamily(WebString::fromUTF16(font), script);
406 } 406 }
407 407
408 void SetCursiveFontFamilyWrapper(WebSettings* settings, 408 void SetCursiveFontFamilyWrapper(WebSettings* settings,
409 const base::string16& font, 409 const base::string16& font,
410 UScriptCode script) { 410 UScriptCode script) {
411 settings->setCursiveFontFamily(font, script); 411 settings->setCursiveFontFamily(WebString::fromUTF16(font), script);
412 } 412 }
413 413
414 void SetFantasyFontFamilyWrapper(WebSettings* settings, 414 void SetFantasyFontFamilyWrapper(WebSettings* settings,
415 const base::string16& font, 415 const base::string16& font,
416 UScriptCode script) { 416 UScriptCode script) {
417 settings->setFantasyFontFamily(font, script); 417 settings->setFantasyFontFamily(WebString::fromUTF16(font), script);
418 } 418 }
419 419
420 void SetPictographFontFamilyWrapper(WebSettings* settings, 420 void SetPictographFontFamilyWrapper(WebSettings* settings,
421 const base::string16& font, 421 const base::string16& font,
422 UScriptCode script) { 422 UScriptCode script) {
423 settings->setPictographFontFamily(font, script); 423 settings->setPictographFontFamily(WebString::fromUTF16(font), script);
424 } 424 }
425 425
426 // If |scriptCode| is a member of a family of "similar" script codes, returns 426 // If |scriptCode| is a member of a family of "similar" script codes, returns
427 // the script code in that family that is used by WebKit for font selection 427 // the script code in that family that is used by WebKit for font selection
428 // purposes. For example, USCRIPT_KATAKANA_OR_HIRAGANA and USCRIPT_JAPANESE are 428 // purposes. For example, USCRIPT_KATAKANA_OR_HIRAGANA and USCRIPT_JAPANESE are
429 // considered equivalent for the purposes of font selection. WebKit uses the 429 // considered equivalent for the purposes of font selection. WebKit uses the
430 // script code USCRIPT_KATAKANA_OR_HIRAGANA. So, if |scriptCode| is 430 // script code USCRIPT_KATAKANA_OR_HIRAGANA. So, if |scriptCode| is
431 // USCRIPT_JAPANESE, the function returns USCRIPT_KATAKANA_OR_HIRAGANA. WebKit 431 // USCRIPT_JAPANESE, the function returns USCRIPT_KATAKANA_OR_HIRAGANA. WebKit
432 // uses different scripts than the ones in Chrome pref names because the version 432 // uses different scripts than the ones in Chrome pref names because the version
433 // of ICU included on certain ports does not have some of the newer scripts. If 433 // of ICU included on certain ports does not have some of the newer scripts. If
(...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after
1409 bool suppress_opener) { 1409 bool suppress_opener) {
1410 RenderFrameImpl* creator_frame = RenderFrameImpl::FromWebFrame(creator); 1410 RenderFrameImpl* creator_frame = RenderFrameImpl::FromWebFrame(creator);
1411 mojom::CreateNewWindowParamsPtr params = mojom::CreateNewWindowParams::New(); 1411 mojom::CreateNewWindowParamsPtr params = mojom::CreateNewWindowParams::New();
1412 params->opener_render_frame_id = creator_frame->GetRoutingID(); 1412 params->opener_render_frame_id = creator_frame->GetRoutingID();
1413 params->user_gesture = WebUserGestureIndicator::isProcessingUserGesture(); 1413 params->user_gesture = WebUserGestureIndicator::isProcessingUserGesture();
1414 if (GetContentClient()->renderer()->AllowPopup()) 1414 if (GetContentClient()->renderer()->AllowPopup())
1415 params->user_gesture = true; 1415 params->user_gesture = true;
1416 params->window_container_type = WindowFeaturesToContainerType(features); 1416 params->window_container_type = WindowFeaturesToContainerType(features);
1417 params->session_storage_namespace_id = session_storage_namespace_id_; 1417 params->session_storage_namespace_id = session_storage_namespace_id_;
1418 if (frame_name != "_blank") 1418 if (frame_name != "_blank")
1419 params->frame_name = base::UTF16ToUTF8(base::StringPiece16(frame_name)); 1419 params->frame_name = frame_name.utf8(
1420 WebString::UTF8ConversionMode::kStrictReplacingErrorsWithFFFD);
1420 params->opener_url = creator->document().url(); 1421 params->opener_url = creator->document().url();
1421 1422
1422 // The browser process uses the top frame's URL for a content settings check 1423 // The browser process uses the top frame's URL for a content settings check
1423 // to determine whether the popup is allowed. If the top frame is remote, 1424 // to determine whether the popup is allowed. If the top frame is remote,
1424 // its URL is not available, so use its replicated origin instead. 1425 // its URL is not available, so use its replicated origin instead.
1425 // 1426 //
1426 // TODO(alexmos): This works fine for regular origins but may break path 1427 // TODO(alexmos): This works fine for regular origins but may break path
1427 // matching for file URLs with OOP subframes that open popups. This should 1428 // matching for file URLs with OOP subframes that open popups. This should
1428 // be fixed by either moving this lookup to the browser process or removing 1429 // be fixed by either moving this lookup to the browser process or removing
1429 // path-based matching for file URLs from content settings. See 1430 // path-based matching for file URLs from content settings. See
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
1617 } 1618 }
1618 } 1619 }
1619 } 1620 }
1620 1621
1621 void RenderViewImpl::showValidationMessage( 1622 void RenderViewImpl::showValidationMessage(
1622 const blink::WebRect& anchor_in_viewport, 1623 const blink::WebRect& anchor_in_viewport,
1623 const blink::WebString& main_text, 1624 const blink::WebString& main_text,
1624 blink::WebTextDirection main_text_hint, 1625 blink::WebTextDirection main_text_hint,
1625 const blink::WebString& sub_text, 1626 const blink::WebString& sub_text,
1626 blink::WebTextDirection sub_text_hint) { 1627 blink::WebTextDirection sub_text_hint) {
1627 base::string16 wrapped_main_text = main_text; 1628 base::string16 wrapped_main_text = main_text.utf16();
1628 base::string16 wrapped_sub_text = sub_text; 1629 base::string16 wrapped_sub_text = sub_text.utf16();
1629 1630
1630 SetValidationMessageDirection( 1631 SetValidationMessageDirection(
1631 &wrapped_main_text, main_text_hint, &wrapped_sub_text, sub_text_hint); 1632 &wrapped_main_text, main_text_hint, &wrapped_sub_text, sub_text_hint);
1632 1633
1633 Send(new ViewHostMsg_ShowValidationMessage( 1634 Send(new ViewHostMsg_ShowValidationMessage(
1634 GetRoutingID(), AdjustValidationMessageAnchor(anchor_in_viewport), 1635 GetRoutingID(), AdjustValidationMessageAnchor(anchor_in_viewport),
1635 wrapped_main_text, wrapped_sub_text)); 1636 wrapped_main_text, wrapped_sub_text));
1636 } 1637 }
1637 1638
1638 void RenderViewImpl::hideValidationMessage() { 1639 void RenderViewImpl::hideValidationMessage() {
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
2092 } 2093 }
2093 2094
2094 void RenderViewImpl::OnEnumerateDirectoryResponse( 2095 void RenderViewImpl::OnEnumerateDirectoryResponse(
2095 int id, 2096 int id,
2096 const std::vector<base::FilePath>& paths) { 2097 const std::vector<base::FilePath>& paths) {
2097 if (!enumeration_completions_[id]) 2098 if (!enumeration_completions_[id])
2098 return; 2099 return;
2099 2100
2100 WebVector<WebString> ws_file_names(paths.size()); 2101 WebVector<WebString> ws_file_names(paths.size());
2101 for (size_t i = 0; i < paths.size(); ++i) 2102 for (size_t i = 0; i < paths.size(); ++i)
2102 ws_file_names[i] = paths[i].AsUTF16Unsafe(); 2103 ws_file_names[i] = blink::FilePathToWebString(paths[i]);
2103 2104
2104 enumeration_completions_[id]->didChooseFile(ws_file_names); 2105 enumeration_completions_[id]->didChooseFile(ws_file_names);
2105 enumeration_completions_.erase(id); 2106 enumeration_completions_.erase(id);
2106 } 2107 }
2107 2108
2108 void RenderViewImpl::OnEnableAutoResize(const gfx::Size& min_size, 2109 void RenderViewImpl::OnEnableAutoResize(const gfx::Size& min_size,
2109 const gfx::Size& max_size) { 2110 const gfx::Size& max_size) {
2110 DCHECK(disable_scrollbars_size_limit_.IsEmpty()); 2111 DCHECK(disable_scrollbars_size_limit_.IsEmpty());
2111 if (!webview()) 2112 if (!webview())
2112 return; 2113 return;
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
2728 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); 2729 INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
2729 } 2730 }
2730 2731
2731 std::unique_ptr<InputEventAck> ack( 2732 std::unique_ptr<InputEventAck> ack(
2732 new InputEventAck(InputEventAckSource::MAIN_THREAD, input_event->type(), 2733 new InputEventAck(InputEventAckSource::MAIN_THREAD, input_event->type(),
2733 INPUT_EVENT_ACK_STATE_NOT_CONSUMED)); 2734 INPUT_EVENT_ACK_STATE_NOT_CONSUMED));
2734 OnInputEventAck(std::move(ack)); 2735 OnInputEventAck(std::move(ack));
2735 } 2736 }
2736 2737
2737 } // namespace content 2738 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698