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

Side by Side Diff: chrome/common/render_messages.h

Issue 118338: Add support for printing selection only flag. This only adds the flag to the ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 #ifndef CHROME_COMMON_RENDER_MESSAGES_H_ 5 #ifndef CHROME_COMMON_RENDER_MESSAGES_H_
6 #define CHROME_COMMON_RENDER_MESSAGES_H_ 6 #define CHROME_COMMON_RENDER_MESSAGES_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 #include <map> 10 #include <map>
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 284
285 // Maximum shrink factor. See PrintSettings::max_shrink for more information. 285 // Maximum shrink factor. See PrintSettings::max_shrink for more information.
286 double max_shrink; 286 double max_shrink;
287 287
288 // Desired apparent dpi on paper. 288 // Desired apparent dpi on paper.
289 int desired_dpi; 289 int desired_dpi;
290 290
291 // Cookie for the document to ensure correctness. 291 // Cookie for the document to ensure correctness.
292 int document_cookie; 292 int document_cookie;
293 293
294 // Should only print currently selected text.
295 bool selection_only;
296
294 // Warning: do not compare document_cookie. 297 // Warning: do not compare document_cookie.
295 bool Equals(const ViewMsg_Print_Params& rhs) const { 298 bool Equals(const ViewMsg_Print_Params& rhs) const {
296 return printable_size == rhs.printable_size && 299 return printable_size == rhs.printable_size &&
297 dpi == rhs.dpi && 300 dpi == rhs.dpi &&
298 min_shrink == rhs.min_shrink && 301 min_shrink == rhs.min_shrink &&
299 max_shrink == rhs.max_shrink && 302 max_shrink == rhs.max_shrink &&
300 desired_dpi == rhs.desired_dpi; 303 desired_dpi == rhs.desired_dpi &&
304 selection_only == rhs.selection_only;
301 } 305 }
302 306
303 // Checking if the current params is empty. Just initialized after a memset. 307 // Checking if the current params is empty. Just initialized after a memset.
304 bool IsEmpty() const { 308 bool IsEmpty() const {
305 return !document_cookie && !desired_dpi && !max_shrink && !min_shrink && 309 return !document_cookie && !desired_dpi && !max_shrink && !min_shrink &&
306 !dpi && printable_size.IsEmpty(); 310 !dpi && printable_size.IsEmpty() && !selection_only;
307 } 311 }
308 }; 312 };
309 313
310 struct ViewMsg_PrintPage_Params { 314 struct ViewMsg_PrintPage_Params {
311 // Parameters to render the page as a printed page. It must always be the same 315 // Parameters to render the page as a printed page. It must always be the same
312 // value for all the document. 316 // value for all the document.
313 ViewMsg_Print_Params params; 317 ViewMsg_Print_Params params;
314 318
315 // The page number is the indicator of the square that should be rendered 319 // The page number is the indicator of the square that should be rendered
316 // according to the layout specified in ViewMsg_Print_Params. 320 // according to the layout specified in ViewMsg_Print_Params.
(...skipping 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1419 template <> 1423 template <>
1420 struct ParamTraits<ViewMsg_Print_Params> { 1424 struct ParamTraits<ViewMsg_Print_Params> {
1421 typedef ViewMsg_Print_Params param_type; 1425 typedef ViewMsg_Print_Params param_type;
1422 static void Write(Message* m, const param_type& p) { 1426 static void Write(Message* m, const param_type& p) {
1423 WriteParam(m, p.printable_size); 1427 WriteParam(m, p.printable_size);
1424 WriteParam(m, p.dpi); 1428 WriteParam(m, p.dpi);
1425 WriteParam(m, p.min_shrink); 1429 WriteParam(m, p.min_shrink);
1426 WriteParam(m, p.max_shrink); 1430 WriteParam(m, p.max_shrink);
1427 WriteParam(m, p.desired_dpi); 1431 WriteParam(m, p.desired_dpi);
1428 WriteParam(m, p.document_cookie); 1432 WriteParam(m, p.document_cookie);
1433 WriteParam(m, p.selection_only);
1429 } 1434 }
1430 static bool Read(const Message* m, void** iter, param_type* p) { 1435 static bool Read(const Message* m, void** iter, param_type* p) {
1431 return ReadParam(m, iter, &p->printable_size) && 1436 return ReadParam(m, iter, &p->printable_size) &&
1432 ReadParam(m, iter, &p->dpi) && 1437 ReadParam(m, iter, &p->dpi) &&
1433 ReadParam(m, iter, &p->min_shrink) && 1438 ReadParam(m, iter, &p->min_shrink) &&
1434 ReadParam(m, iter, &p->max_shrink) && 1439 ReadParam(m, iter, &p->max_shrink) &&
1435 ReadParam(m, iter, &p->desired_dpi) && 1440 ReadParam(m, iter, &p->desired_dpi) &&
1436 ReadParam(m, iter, &p->document_cookie); 1441 ReadParam(m, iter, &p->document_cookie) &&
1442 ReadParam(m, iter, &p->selection_only);
1437 } 1443 }
1438 static void Log(const param_type& p, std::wstring* l) { 1444 static void Log(const param_type& p, std::wstring* l) {
1439 l->append(L"<ViewMsg_Print_Params>"); 1445 l->append(L"<ViewMsg_Print_Params>");
1440 } 1446 }
1441 }; 1447 };
1442 1448
1443 // Traits for ViewMsg_PrintPage_Params 1449 // Traits for ViewMsg_PrintPage_Params
1444 template <> 1450 template <>
1445 struct ParamTraits<ViewMsg_PrintPage_Params> { 1451 struct ParamTraits<ViewMsg_PrintPage_Params> {
1446 typedef ViewMsg_PrintPage_Params param_type; 1452 typedef ViewMsg_PrintPage_Params param_type;
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
1885 } 1891 }
1886 }; 1892 };
1887 1893
1888 } // namespace IPC 1894 } // namespace IPC
1889 1895
1890 1896
1891 #define MESSAGES_INTERNAL_FILE "chrome/common/render_messages_internal.h" 1897 #define MESSAGES_INTERNAL_FILE "chrome/common/render_messages_internal.h"
1892 #include "chrome/common/ipc_message_macros.h" 1898 #include "chrome/common/ipc_message_macros.h"
1893 1899
1894 #endif // CHROME_COMMON_RENDER_MESSAGES_H_ 1900 #endif // CHROME_COMMON_RENDER_MESSAGES_H_
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/resource_message_filter.cc ('k') | chrome/common/render_messages_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698