| OLD | NEW |
| 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 Loading... |
| 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", ¶meters.dpi); | 117 result &= params->GetDouble("dpi", ¶meters.dpi); |
| 119 result &= params->GetDouble("min_shrink", ¶meters.min_shrink); | 118 result &= params->GetDouble("min_shrink", ¶meters.min_shrink); |
| 120 result &= params->GetDouble("max_shrink", ¶meters.max_shrink); | 119 result &= params->GetDouble("max_shrink", ¶meters.max_shrink); |
| 121 result &= params->GetBoolean("selection_only", ¶meters.selection_only); | 120 result &= params->GetBoolean("selection_only", ¶meters.selection_only); |
| 122 return result; | 121 return result; |
| 123 } | 122 } |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |