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

Side by Side Diff: chrome/browser/printing/print_dialog_cloud.cc

Issue 7661009: base: Add Is* functions to Value class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tony review Created 9 years, 4 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) 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 "chrome/browser/printing/print_dialog_cloud.h" 5 #include "chrome/browser/printing/print_dialog_cloud.h"
6 #include "chrome/browser/printing/print_dialog_cloud_internal.h" 6 #include "chrome/browser/printing/print_dialog_cloud_internal.h"
7 7
8 #include "base/base64.h" 8 #include "base/base64.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 // high-level flow (where the data is generated before even 100 // high-level flow (where the data is generated before even
101 // bringing up the dialog) isn't what we want. 101 // bringing up the dialog) isn't what we want.
102 102
103 namespace internal_cloud_print_helpers { 103 namespace internal_cloud_print_helpers {
104 104
105 // From the JSON parsed value, get the entries for the page setup 105 // From the JSON parsed value, get the entries for the page setup
106 // parameters. 106 // parameters.
107 bool GetPageSetupParameters(const std::string& json, 107 bool GetPageSetupParameters(const std::string& json,
108 PrintMsg_Print_Params& parameters) { 108 PrintMsg_Print_Params& parameters) {
109 scoped_ptr<Value> parsed_value(base::JSONReader::Read(json, false)); 109 scoped_ptr<Value> parsed_value(base::JSONReader::Read(json, false));
110 DLOG_IF(ERROR, (!parsed_value.get() || 110 DLOG_IF(ERROR, (!parsed_value.get() || !parsed_value->IsDictionary()))
111 !parsed_value->IsType(Value::TYPE_DICTIONARY)))
112 << "PageSetup call didn't have expected contents"; 111 << "PageSetup call didn't have expected contents";
113 if (!parsed_value.get() || !parsed_value->IsType(Value::TYPE_DICTIONARY)) 112 if (!parsed_value.get() || !parsed_value->IsDictionary())
114 return false; 113 return false;
115 114
116 bool result = true; 115 bool result = true;
117 DictionaryValue* params = static_cast<DictionaryValue*>(parsed_value.get()); 116 DictionaryValue* params = static_cast<DictionaryValue*>(parsed_value.get());
118 result &= params->GetDouble("dpi", &parameters.dpi); 117 result &= params->GetDouble("dpi", &parameters.dpi);
119 result &= params->GetDouble("min_shrink", &parameters.min_shrink); 118 result &= params->GetDouble("min_shrink", &parameters.min_shrink);
120 result &= params->GetDouble("max_shrink", &parameters.max_shrink); 119 result &= params->GetDouble("max_shrink", &parameters.max_shrink);
121 result &= params->GetBoolean("selection_only", &parameters.selection_only); 120 result &= params->GetBoolean("selection_only", &parameters.selection_only);
122 return result; 121 return result;
123 } 122 }
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 print_job_title, 634 print_job_title,
636 file_type, 635 file_type,
637 false); 636 false);
638 return true; 637 return true;
639 } 638 }
640 } 639 }
641 return false; 640 return false;
642 } 641 }
643 642
644 } // end namespace 643 } // end namespace
OLDNEW
« no previous file with comments | « chrome/browser/printing/cloud_print/cloud_print_setup_message_handler.cc ('k') | chrome/browser/sync/syncable/model_type.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698