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/ui/webui/print_preview/print_preview_handler.h" | 5 #include "chrome/browser/ui/webui/print_preview/print_preview_handler.h" |
6 | 6 |
7 #include <ctype.h> | 7 #include <ctype.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 std::string json_str; | 125 std::string json_str; |
126 if (!args->GetString(0, &json_str)) { | 126 if (!args->GetString(0, &json_str)) { |
127 NOTREACHED() << "Could not read JSON argument"; | 127 NOTREACHED() << "Could not read JSON argument"; |
128 return NULL; | 128 return NULL; |
129 } | 129 } |
130 if (json_str.empty()) { | 130 if (json_str.empty()) { |
131 NOTREACHED() << "Empty print job settings"; | 131 NOTREACHED() << "Empty print job settings"; |
132 return NULL; | 132 return NULL; |
133 } | 133 } |
134 scoped_ptr<DictionaryValue> settings(static_cast<DictionaryValue*>( | 134 scoped_ptr<DictionaryValue> settings(static_cast<DictionaryValue*>( |
135 base::JSONReader::Read(json_str, false))); | 135 base::JSONReader::Read(json_str))); |
136 if (!settings.get() || !settings->IsType(Value::TYPE_DICTIONARY)) { | 136 if (!settings.get() || !settings->IsType(Value::TYPE_DICTIONARY)) { |
137 NOTREACHED() << "Print job settings must be a dictionary."; | 137 NOTREACHED() << "Print job settings must be a dictionary."; |
138 return NULL; | 138 return NULL; |
139 } | 139 } |
140 | 140 |
141 if (settings->empty()) { | 141 if (settings->empty()) { |
142 NOTREACHED() << "Print job settings dictionary is empty"; | 142 NOTREACHED() << "Print job settings dictionary is empty"; |
143 return NULL; | 143 return NULL; |
144 } | 144 } |
145 | 145 |
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
868 return; | 868 return; |
869 | 869 |
870 // We no longer require the initiator tab details. Remove those details | 870 // We no longer require the initiator tab details. Remove those details |
871 // associated with the preview tab to allow the initiator tab to create | 871 // associated with the preview tab to allow the initiator tab to create |
872 // another preview tab. | 872 // another preview tab. |
873 printing::PrintPreviewTabController* tab_controller = | 873 printing::PrintPreviewTabController* tab_controller = |
874 printing::PrintPreviewTabController::GetInstance(); | 874 printing::PrintPreviewTabController::GetInstance(); |
875 if (tab_controller) | 875 if (tab_controller) |
876 tab_controller->EraseInitiatorTabInfo(preview_tab_wrapper()); | 876 tab_controller->EraseInitiatorTabInfo(preview_tab_wrapper()); |
877 } | 877 } |
OLD | NEW |