OLD | NEW |
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 "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/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 using content::RenderViewHost; | 123 using content::RenderViewHost; |
124 using content::WebContents; | 124 using content::WebContents; |
125 using content::WebUIMessageHandler; | 125 using content::WebUIMessageHandler; |
126 | 126 |
127 namespace internal_cloud_print_helpers { | 127 namespace internal_cloud_print_helpers { |
128 | 128 |
129 // From the JSON parsed value, get the entries for the page setup | 129 // From the JSON parsed value, get the entries for the page setup |
130 // parameters. | 130 // parameters. |
131 bool GetPageSetupParameters(const std::string& json, | 131 bool GetPageSetupParameters(const std::string& json, |
132 PrintMsg_Print_Params& parameters) { | 132 PrintMsg_Print_Params& parameters) { |
133 scoped_ptr<Value> parsed_value(base::JSONReader::Read(json, false)); | 133 scoped_ptr<Value> parsed_value(base::JSONReader::Read(json)); |
134 DLOG_IF(ERROR, (!parsed_value.get() || | 134 DLOG_IF(ERROR, (!parsed_value.get() || |
135 !parsed_value->IsType(Value::TYPE_DICTIONARY))) | 135 !parsed_value->IsType(Value::TYPE_DICTIONARY))) |
136 << "PageSetup call didn't have expected contents"; | 136 << "PageSetup call didn't have expected contents"; |
137 if (!parsed_value.get() || !parsed_value->IsType(Value::TYPE_DICTIONARY)) | 137 if (!parsed_value.get() || !parsed_value->IsType(Value::TYPE_DICTIONARY)) |
138 return false; | 138 return false; |
139 | 139 |
140 bool result = true; | 140 bool result = true; |
141 DictionaryValue* params = static_cast<DictionaryValue*>(parsed_value.get()); | 141 DictionaryValue* params = static_cast<DictionaryValue*>(parsed_value.get()); |
142 result &= params->GetDouble("dpi", ¶meters.dpi); | 142 result &= params->GetDouble("dpi", ¶meters.dpi); |
143 result &= params->GetDouble("min_shrink", ¶meters.min_shrink); | 143 result &= params->GetDouble("min_shrink", ¶meters.min_shrink); |
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
835 file_type, | 835 file_type, |
836 false, | 836 false, |
837 delete_on_close); | 837 delete_on_close); |
838 return true; | 838 return true; |
839 } | 839 } |
840 } | 840 } |
841 return false; | 841 return false; |
842 } | 842 } |
843 | 843 |
844 } // end namespace | 844 } // end namespace |
OLD | NEW |