| 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/ui/webui/print_preview_handler.h" | 5 #include "chrome/browser/ui/webui/print_preview_handler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #if !defined(OS_CHROMEOS) | 10 #if !defined(OS_CHROMEOS) |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 if (!args->GetString(0, &json_str)) { | 106 if (!args->GetString(0, &json_str)) { |
| 107 NOTREACHED() << "Could not read JSON argument"; | 107 NOTREACHED() << "Could not read JSON argument"; |
| 108 return NULL; | 108 return NULL; |
| 109 } | 109 } |
| 110 if (json_str.empty()) { | 110 if (json_str.empty()) { |
| 111 NOTREACHED() << "Empty print job settings"; | 111 NOTREACHED() << "Empty print job settings"; |
| 112 return NULL; | 112 return NULL; |
| 113 } | 113 } |
| 114 scoped_ptr<DictionaryValue> settings(static_cast<DictionaryValue*>( | 114 scoped_ptr<DictionaryValue> settings(static_cast<DictionaryValue*>( |
| 115 base::JSONReader::Read(json_str, false))); | 115 base::JSONReader::Read(json_str, false))); |
| 116 if (!settings.get() || !settings->IsType(Value::TYPE_DICTIONARY)) { | 116 if (!settings.get() || !settings->IsDictionary()) { |
| 117 NOTREACHED() << "Print job settings must be a dictionary."; | 117 NOTREACHED() << "Print job settings must be a dictionary."; |
| 118 return NULL; | 118 return NULL; |
| 119 } | 119 } |
| 120 | 120 |
| 121 if (settings->empty()) { | 121 if (settings->empty()) { |
| 122 NOTREACHED() << "Print job settings dictionary is empty"; | 122 NOTREACHED() << "Print job settings dictionary is empty"; |
| 123 return NULL; | 123 return NULL; |
| 124 } | 124 } |
| 125 | 125 |
| 126 return settings.release(); | 126 return settings.release(); |
| (...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 923 return; | 923 return; |
| 924 | 924 |
| 925 // We no longer require the initiator tab details. Remove those details | 925 // We no longer require the initiator tab details. Remove those details |
| 926 // associated with the preview tab to allow the initiator tab to create | 926 // associated with the preview tab to allow the initiator tab to create |
| 927 // another preview tab. | 927 // another preview tab. |
| 928 printing::PrintPreviewTabController* tab_controller = | 928 printing::PrintPreviewTabController* tab_controller = |
| 929 printing::PrintPreviewTabController::GetInstance(); | 929 printing::PrintPreviewTabController::GetInstance(); |
| 930 if (tab_controller) | 930 if (tab_controller) |
| 931 tab_controller->EraseInitiatorTabInfo(preview_tab()); | 931 tab_controller->EraseInitiatorTabInfo(preview_tab()); |
| 932 } | 932 } |
| OLD | NEW |