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

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

Issue 6289009: [Mac] Implement the system dictionary popup by implementing NSTextInput methods. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Clang Created 9 years, 7 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/common/common_param_traits.h ('k') | content/common/font_descriptor_mac.h » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/common/common_param_traits.h" 5 #include "content/common/common_param_traits.h"
6 6
7 #include "content/common/content_constants.h" 7 #include "content/common/content_constants.h"
8 #include "net/base/host_port_pair.h" 8 #include "net/base/host_port_pair.h"
9 #include "net/base/upload_data.h" 9 #include "net/base/upload_data.h"
10 #include "net/http/http_response_headers.h" 10 #include "net/http/http_response_headers.h"
11 #include "third_party/skia/include/core/SkBitmap.h" 11 #include "third_party/skia/include/core/SkBitmap.h"
12 #include "ui/base/range/range.h"
12 #include "ui/gfx/rect.h" 13 #include "ui/gfx/rect.h"
13 14
14 namespace { 15 namespace {
15 16
16 struct SkBitmap_Data { 17 struct SkBitmap_Data {
17 // The configuration for the bitmap (bits per pixel, etc). 18 // The configuration for the bitmap (bits per pixel, etc).
18 SkBitmap::Config fConfig; 19 SkBitmap::Config fConfig;
19 20
20 // The width of the bitmap in pixels. 21 // The width of the bitmap in pixels.
21 uint32 fWidth; 22 uint32 fWidth;
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 r->set_width(w); 495 r->set_width(w);
495 r->set_height(h); 496 r->set_height(h);
496 return true; 497 return true;
497 } 498 }
498 499
499 void ParamTraits<gfx::Rect>::Log(const gfx::Rect& p, std::string* l) { 500 void ParamTraits<gfx::Rect>::Log(const gfx::Rect& p, std::string* l) {
500 l->append(base::StringPrintf("(%d, %d, %d, %d)", p.x(), p.y(), 501 l->append(base::StringPrintf("(%d, %d, %d, %d)", p.x(), p.y(),
501 p.width(), p.height())); 502 p.width(), p.height()));
502 } 503 }
503 504
505 void ParamTraits<ui::Range>::Write(Message* m, const ui::Range& r) {
506 m->WriteSize(r.start());
507 m->WriteSize(r.end());
508 }
509
510 bool ParamTraits<ui::Range>::Read(const Message* m, void** iter, ui::Range* r) {
511 size_t start, end;
512 if (!m->ReadSize(iter, &start) || !m->ReadSize(iter, &end))
513 return false;
514 r->set_start(start);
515 r->set_end(end);
516 return true;
517 }
518
519 void ParamTraits<ui::Range>::Log(const ui::Range& r, std::string* l) {
520 l->append(base::StringPrintf("(%"PRIuS", %"PRIuS")", r.start(), r.end()));
521 }
522
504 void ParamTraits<SkBitmap>::Write(Message* m, const SkBitmap& p) { 523 void ParamTraits<SkBitmap>::Write(Message* m, const SkBitmap& p) {
505 size_t fixed_size = sizeof(SkBitmap_Data); 524 size_t fixed_size = sizeof(SkBitmap_Data);
506 SkBitmap_Data bmp_data; 525 SkBitmap_Data bmp_data;
507 bmp_data.InitSkBitmapDataForTransfer(p); 526 bmp_data.InitSkBitmapDataForTransfer(p);
508 m->WriteData(reinterpret_cast<const char*>(&bmp_data), 527 m->WriteData(reinterpret_cast<const char*>(&bmp_data),
509 static_cast<int>(fixed_size)); 528 static_cast<int>(fixed_size));
510 size_t pixel_size = p.getSize(); 529 size_t pixel_size = p.getSize();
511 SkAutoLockPixels p_lock(p); 530 SkAutoLockPixels p_lock(p);
512 m->WriteData(reinterpret_cast<const char*>(p.getPixels()), 531 m->WriteData(reinterpret_cast<const char*>(p.getPixels()),
513 static_cast<int>(pixel_size)); 532 static_cast<int>(pixel_size));
(...skipping 20 matching lines...) Expand all
534 const SkBitmap_Data* bmp_data = 553 const SkBitmap_Data* bmp_data =
535 reinterpret_cast<const SkBitmap_Data*>(fixed_data); 554 reinterpret_cast<const SkBitmap_Data*>(fixed_data);
536 return bmp_data->InitSkBitmapFromData(r, variable_data, variable_data_size); 555 return bmp_data->InitSkBitmapFromData(r, variable_data, variable_data_size);
537 } 556 }
538 557
539 void ParamTraits<SkBitmap>::Log(const SkBitmap& p, std::string* l) { 558 void ParamTraits<SkBitmap>::Log(const SkBitmap& p, std::string* l) {
540 l->append("<SkBitmap>"); 559 l->append("<SkBitmap>");
541 } 560 }
542 561
543 } // namespace IPC 562 } // namespace IPC
OLDNEW
« no previous file with comments | « content/common/common_param_traits.h ('k') | content/common/font_descriptor_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698