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

Unified Diff: chrome/browser/ui/webui/print_preview/print_preview_handler.cc

Issue 2848093002: Process null capabilities as a capability fetch failure. (Closed)
Patch Set: address comments Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/print_preview/print_preview_handler.cc
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc
index 77e357e1438c3b47daa4cf3af53af4bca52128d8..f258efb22f74658971a01d18ae1478079fb42fd4 100644
--- a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc
+++ b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc
@@ -1278,15 +1278,17 @@ void PrintPreviewHandler::SendAccessToken(const std::string& type,
void PrintPreviewHandler::SendPrinterCapabilities(
const std::string& printer_name,
std::unique_ptr<base::DictionaryValue> settings_info) {
- if (!settings_info) {
- VLOG(1) << "Get printer capabilities failed";
- web_ui()->CallJavascriptFunctionUnsafe("failedToGetPrinterCapabilities",
- base::Value(printer_name));
+ // Check that |settings_info| is valid.
+ if (settings_info && settings_info->Get("capabilities", nullptr)) {
+ VLOG(1) << "Get printer capabilities finished";
+ web_ui()->CallJavascriptFunctionUnsafe("updateWithPrinterCapabilities",
+ *settings_info);
return;
}
- VLOG(1) << "Get printer capabilities finished";
- web_ui()->CallJavascriptFunctionUnsafe("updateWithPrinterCapabilities",
- *settings_info);
+
+ VLOG(1) << "Get printer capabilities failed";
+ web_ui()->CallJavascriptFunctionUnsafe("failedToGetPrinterCapabilities",
+ base::Value(printer_name));
}
void PrintPreviewHandler::SendPrinterSetup(

Powered by Google App Engine
This is Rietveld 408576698