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

Side by Side Diff: content/renderer/npapi/webplugin_impl.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 "content/renderer/npapi/webplugin_impl.h" 5 #include "content/renderer/npapi/webplugin_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/crash_logging.h" 9 #include "base/debug/crash_logging.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 render_view_(render_view), 546 render_view_(render_view),
547 webframe_(webframe), 547 webframe_(webframe),
548 delegate_(NULL), 548 delegate_(NULL),
549 container_(NULL), 549 container_(NULL),
550 npp_(NULL), 550 npp_(NULL),
551 plugin_url_(params.url), 551 plugin_url_(params.url),
552 load_manually_(params.loadManually), 552 load_manually_(params.loadManually),
553 first_geometry_update_(true), 553 first_geometry_update_(true),
554 ignore_response_error_(false), 554 ignore_response_error_(false),
555 file_path_(file_path), 555 file_path_(file_path),
556 mime_type_(base::UTF16ToASCII(params.mimeType)), 556 mime_type_(base::UTF16ToASCII(base::StringPiece16(params.mimeType))),
557 loader_client_(this), 557 loader_client_(this),
558 weak_factory_(this) { 558 weak_factory_(this) {
559 DCHECK_EQ(params.attributeNames.size(), params.attributeValues.size()); 559 DCHECK_EQ(params.attributeNames.size(), params.attributeValues.size());
560 base::StringToLowerASCII(&mime_type_); 560 base::StringToLowerASCII(&mime_type_);
561 561
562 for (size_t i = 0; i < params.attributeNames.size(); ++i) { 562 for (size_t i = 0; i < params.attributeNames.size(); ++i) {
563 arg_names_.push_back(params.attributeNames[i].utf8()); 563 arg_names_.push_back(params.attributeNames[i].utf8());
564 arg_values_.push_back(params.attributeValues[i].utf8()); 564 arg_values_.push_back(params.attributeValues[i].utf8());
565 } 565 }
566 566
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 const GURL& first_party_for_cookies) { 797 const GURL& first_party_for_cookies) {
798 if (!render_view_.get()) 798 if (!render_view_.get())
799 return std::string(); 799 return std::string();
800 800
801 WebCookieJar* cookie_jar = render_frame_->cookie_jar(); 801 WebCookieJar* cookie_jar = render_frame_->cookie_jar();
802 if (!cookie_jar) { 802 if (!cookie_jar) {
803 DLOG(WARNING) << "No cookie jar!"; 803 DLOG(WARNING) << "No cookie jar!";
804 return std::string(); 804 return std::string();
805 } 805 }
806 806
807 return base::UTF16ToUTF8(cookie_jar->cookies(url, first_party_for_cookies)); 807 return base::UTF16ToUTF8(base::StringPiece16(
808 cookie_jar->cookies(url, first_party_for_cookies)));
808 } 809 }
809 810
810 void WebPluginImpl::URLRedirectResponse(bool allow, int resource_id) { 811 void WebPluginImpl::URLRedirectResponse(bool allow, int resource_id) {
811 for (size_t i = 0; i < clients_.size(); ++i) { 812 for (size_t i = 0; i < clients_.size(); ++i) {
812 if (clients_[i].id == static_cast<unsigned long>(resource_id)) { 813 if (clients_[i].id == static_cast<unsigned long>(resource_id)) {
813 if (clients_[i].loader.get()) { 814 if (clients_[i].loader.get()) {
814 if (allow) { 815 if (allow) {
815 clients_[i].loader->setDefersLoading(false); 816 clients_[i].loader->setDefersLoading(false);
816 } else { 817 } else {
817 clients_[i].loader->cancel(); 818 clients_[i].loader->cancel();
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after
1541 case PLUGIN_SRC: 1542 case PLUGIN_SRC:
1542 webframe_->setReferrerForRequest(*request, plugin_url_); 1543 webframe_->setReferrerForRequest(*request, plugin_url_);
1543 break; 1544 break;
1544 1545
1545 default: 1546 default:
1546 break; 1547 break;
1547 } 1548 }
1548 } 1549 }
1549 1550
1550 } // namespace content 1551 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/rtc_peer_connection_handler.cc ('k') | content/renderer/render_frame_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698