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

Side by Side Diff: ipc/ipc_message_utils.cc

Issue 12193012: Merge 179141 (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1364/src/
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « content/browser/download/save_package_unittest.cc ('k') | ipc/ipc_message_utils_unittest.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 (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 "ipc/ipc_message_utils.h" 5 #include "ipc/ipc_message_utils.h"
6 6
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/nullable_string16.h" 10 #include "base/nullable_string16.h"
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 std::string* l) { 492 std::string* l) {
493 if (p.auto_close) { 493 if (p.auto_close) {
494 l->append(StringPrintf("FD(%d auto-close)", p.fd)); 494 l->append(StringPrintf("FD(%d auto-close)", p.fd));
495 } else { 495 } else {
496 l->append(StringPrintf("FD(%d)", p.fd)); 496 l->append(StringPrintf("FD(%d)", p.fd));
497 } 497 }
498 } 498 }
499 #endif // defined(OS_POSIX) 499 #endif // defined(OS_POSIX)
500 500
501 void ParamTraits<FilePath>::Write(Message* m, const param_type& p) { 501 void ParamTraits<FilePath>::Write(Message* m, const param_type& p) {
502 ParamTraits<FilePath::StringType>::Write(m, p.value()); 502 p.WriteToPickle(m);
503 } 503 }
504 504
505 bool ParamTraits<FilePath>::Read(const Message* m, 505 bool ParamTraits<FilePath>::Read(const Message* m,
506 PickleIterator* iter, 506 PickleIterator* iter,
507 param_type* r) { 507 param_type* r) {
508 FilePath::StringType value; 508 return r->ReadFromPickle(iter);
509 if (!ParamTraits<FilePath::StringType>::Read(m, iter, &value))
510 return false;
511 // Reject embedded NULs as they can cause security checks to go awry.
512 if (value.find(FILE_PATH_LITERAL('\0')) != FilePath::StringType::npos)
513 return false;
514 *r = FilePath(value);
515 return true;
516 } 509 }
517 510
518 void ParamTraits<FilePath>::Log(const param_type& p, std::string* l) { 511 void ParamTraits<FilePath>::Log(const param_type& p, std::string* l) {
519 ParamTraits<FilePath::StringType>::Log(p.value(), l); 512 ParamTraits<FilePath::StringType>::Log(p.value(), l);
520 } 513 }
521 514
522 void ParamTraits<ListValue>::Write(Message* m, const param_type& p) { 515 void ParamTraits<ListValue>::Write(Message* m, const param_type& p) {
523 WriteValue(m, &p, 0); 516 WriteValue(m, &p, 0);
524 } 517 }
525 518
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 return result; 824 return result;
832 } 825 }
833 826
834 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) { 827 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) {
835 l->append("<MSG>"); 828 l->append("<MSG>");
836 } 829 }
837 830
838 #endif // OS_WIN 831 #endif // OS_WIN
839 832
840 } // namespace IPC 833 } // namespace IPC
OLDNEW
« no previous file with comments | « content/browser/download/save_package_unittest.cc ('k') | ipc/ipc_message_utils_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698