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

Side by Side Diff: android_webview/renderer/aw_render_view_ext.cc

Issue 1259673002: Make UTF16ToASCII and UTF16TOUTF8 take a StringPiece (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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 "android_webview/renderer/aw_render_view_ext.h" 5 #include "android_webview/renderer/aw_render_view_ext.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "android_webview/common/aw_hit_test_data.h" 9 #include "android_webview/common/aw_hit_test_data.h"
10 #include "android_webview/common/render_view_messages.h" 10 #include "android_webview/common/render_view_messages.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 bool RemovePrefixAndAssignIfMatches(const base::StringPiece& prefix, 73 bool RemovePrefixAndAssignIfMatches(const base::StringPiece& prefix,
74 const GURL& url, 74 const GURL& url,
75 std::string* dest) { 75 std::string* dest) {
76 const base::StringPiece spec(url.possibly_invalid_spec()); 76 const base::StringPiece spec(url.possibly_invalid_spec());
77 77
78 if (spec.starts_with(prefix)) { 78 if (spec.starts_with(prefix)) {
79 url::RawCanonOutputW<1024> output; 79 url::RawCanonOutputW<1024> output;
80 url::DecodeURLEscapeSequences(spec.data() + prefix.length(), 80 url::DecodeURLEscapeSequences(spec.data() + prefix.length(),
81 spec.length() - prefix.length(), 81 spec.length() - prefix.length(),
82 &output); 82 &output);
83 std::string decoded_url = base::UTF16ToUTF8( 83 *dest = base::UTF16ToUTF8(
84 base::string16(output.data(), output.length())); 84 base::StringPiece16(output.data(), output.length()));
85 dest->assign(decoded_url.begin(), decoded_url.end());
86 return true; 85 return true;
87 } 86 }
88 return false; 87 return false;
89 } 88 }
90 89
91 void DistinguishAndAssignSrcLinkType(const GURL& url, AwHitTestData* data) { 90 void DistinguishAndAssignSrcLinkType(const GURL& url, AwHitTestData* data) {
92 if (RemovePrefixAndAssignIfMatches( 91 if (RemovePrefixAndAssignIfMatches(
93 content::kAddressPrefix, 92 content::kAddressPrefix,
94 url, 93 url,
95 &data->extra_data_for_type)) { 94 &data->extra_data_for_type)) {
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 page_scale_factor); 314 page_scale_factor);
316 } 315 }
317 316
318 void AwRenderViewExt::OnSetBackgroundColor(SkColor c) { 317 void AwRenderViewExt::OnSetBackgroundColor(SkColor c) {
319 if (!render_view() || !render_view()->GetWebView()) 318 if (!render_view() || !render_view()->GetWebView())
320 return; 319 return;
321 render_view()->GetWebView()->setBaseBackgroundColor(c); 320 render_view()->GetWebView()->setBaseBackgroundColor(c);
322 } 321 }
323 322
324 } // namespace android_webview 323 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/renderer/aw_content_renderer_client.cc ('k') | base/strings/utf_string_conversions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698