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

Side by Side Diff: content/public/common/common_param_traits.cc

Issue 9875026: **NOTFORLANDING** New link rel=prerender API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch sets 3-7 against trunk, for combined browsing Created 8 years, 8 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
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/public/common/common_param_traits.h" 5 #include "content/public/common/common_param_traits.h"
6 6
7 #include "content/public/common/content_constants.h" 7 #include "content/public/common/content_constants.h"
8 #include "content/public/common/referrer.h"
8 #include "net/base/host_port_pair.h" 9 #include "net/base/host_port_pair.h"
9 #include "net/base/upload_data.h" 10 #include "net/base/upload_data.h"
10 #include "net/http/http_response_headers.h" 11 #include "net/http/http_response_headers.h"
11 #include "third_party/skia/include/core/SkBitmap.h" 12 #include "third_party/skia/include/core/SkBitmap.h"
13 #include "third_party/WebKit/Source/Platform/chromium/public/WebReferrerPolicy.h "
12 #include "ui/base/range/range.h" 14 #include "ui/base/range/range.h"
13 #include "ui/gfx/rect.h" 15 #include "ui/gfx/rect.h"
14 16
15 namespace { 17 namespace {
16 18
17 struct SkBitmap_Data { 19 struct SkBitmap_Data {
18 // The configuration for the bitmap (bits per pixel, etc). 20 // The configuration for the bitmap (bits per pixel, etc).
19 SkBitmap::Config fConfig; 21 SkBitmap::Config fConfig;
20 22
21 // The width of the bitmap in pixels. 23 // The width of the bitmap in pixels.
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 LogParam(p.is_directory, l); 440 LogParam(p.is_directory, l);
439 l->append(","); 441 l->append(",");
440 LogParam(p.last_modified.ToDoubleT(), l); 442 LogParam(p.last_modified.ToDoubleT(), l);
441 l->append(","); 443 l->append(",");
442 LogParam(p.last_accessed.ToDoubleT(), l); 444 LogParam(p.last_accessed.ToDoubleT(), l);
443 l->append(","); 445 l->append(",");
444 LogParam(p.creation_time.ToDoubleT(), l); 446 LogParam(p.creation_time.ToDoubleT(), l);
445 l->append(")"); 447 l->append(")");
446 } 448 }
447 449
450 void ParamTraits<content::Referrer>::Write(
451 Message* m, const param_type& p) {
452 WriteParam(m, p.url);
453 WriteParam(m, p.policy);
454 }
455
456 bool ParamTraits<content::Referrer>::Read(
457 const Message* m, PickleIterator* iter, param_type* r) {
458 GURL url;
459 if (!ReadParam(m, iter, &url))
460 return false;
461 WebKit::WebReferrerPolicy policy;
462 if (!ReadParam(m, iter, &policy))
463 return false;
464 r->url = url;
465 r->policy = policy;
466 return true;
467 }
468
469 void ParamTraits<content::Referrer>::Log(
470 const param_type& p, std::string* l) {
471 l->append("(");
472 LogParam(p.url, l);
473 l->append(",");
474 LogParam(p.policy, l);
475 l->append(")");
476 }
477
448 void ParamTraits<gfx::Point>::Write(Message* m, const gfx::Point& p) { 478 void ParamTraits<gfx::Point>::Write(Message* m, const gfx::Point& p) {
449 m->WriteInt(p.x()); 479 m->WriteInt(p.x());
450 m->WriteInt(p.y()); 480 m->WriteInt(p.y());
451 } 481 }
452 482
453 bool ParamTraits<gfx::Point>::Read(const Message* m, PickleIterator* iter, 483 bool ParamTraits<gfx::Point>::Read(const Message* m, PickleIterator* iter,
454 gfx::Point* r) { 484 gfx::Point* r) {
455 int x, y; 485 int x, y;
456 if (!m->ReadInt(iter, &x) || 486 if (!m->ReadInt(iter, &x) ||
457 !m->ReadInt(iter, &y)) 487 !m->ReadInt(iter, &y))
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 const SkBitmap_Data* bmp_data = 599 const SkBitmap_Data* bmp_data =
570 reinterpret_cast<const SkBitmap_Data*>(fixed_data); 600 reinterpret_cast<const SkBitmap_Data*>(fixed_data);
571 return bmp_data->InitSkBitmapFromData(r, variable_data, variable_data_size); 601 return bmp_data->InitSkBitmapFromData(r, variable_data, variable_data_size);
572 } 602 }
573 603
574 void ParamTraits<SkBitmap>::Log(const SkBitmap& p, std::string* l) { 604 void ParamTraits<SkBitmap>::Log(const SkBitmap& p, std::string* l) {
575 l->append("<SkBitmap>"); 605 l->append("<SkBitmap>");
576 } 606 }
577 607
578 } // namespace IPC 608 } // namespace IPC
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698