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

Side by Side Diff: chrome/browser/ui/webui/print_preview/print_preview_handler.cc

Issue 189483006: [Print Preview] Re-add flags for register promos (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 10
(...skipping 1341 matching lines...) Expand 10 before | Expand all | Expand 10 after
1352 1352
1353 #endif 1353 #endif
1354 1354
1355 1355
1356 #if defined(ENABLE_MDNS) 1356 #if defined(ENABLE_MDNS)
1357 void PrintPreviewHandler::LocalPrinterChanged( 1357 void PrintPreviewHandler::LocalPrinterChanged(
1358 bool added, 1358 bool added,
1359 const std::string& name, 1359 const std::string& name,
1360 bool has_local_printing, 1360 bool has_local_printing,
1361 const local_discovery::DeviceDescription& description) { 1361 const local_discovery::DeviceDescription& description) {
1362 base::DictionaryValue info; 1362 CommandLine* command_line = CommandLine::ForCurrentProcess();
1363 FillPrinterDescription(name, description, has_local_printing, &info); 1363 if (has_local_printing ||
1364 web_ui()->CallJavascriptFunction("onPrivetPrinterChanged", info); 1364 command_line->HasSwitch(switches::kEnablePrintPreviewRegisterPromos)) {
1365 base::DictionaryValue info;
1366 FillPrinterDescription(name, description, has_local_printing, &info);
1367 web_ui()->CallJavascriptFunction("onPrivetPrinterChanged", info);
1368 }
1365 } 1369 }
1366 1370
1367 void PrintPreviewHandler::LocalPrinterRemoved(const std::string& name) { 1371 void PrintPreviewHandler::LocalPrinterRemoved(const std::string& name) {
1368 } 1372 }
1369 1373
1370 void PrintPreviewHandler::LocalPrinterCacheFlushed() { 1374 void PrintPreviewHandler::LocalPrinterCacheFlushed() {
1371 } 1375 }
1372 1376
1373 void PrintPreviewHandler::PrivetCapabilitiesUpdateClient( 1377 void PrintPreviewHandler::PrivetCapabilitiesUpdateClient(
1374 scoped_ptr<local_discovery::PrivetHTTPClient> http_client) { 1378 scoped_ptr<local_discovery::PrivetHTTPClient> http_client) {
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
1524 int http_code) { 1528 int http_code) {
1525 base::FundamentalValue http_code_value(http_code); 1529 base::FundamentalValue http_code_value(http_code);
1526 web_ui()->CallJavascriptFunction("onPrivetPrintFailed", http_code_value); 1530 web_ui()->CallJavascriptFunction("onPrivetPrintFailed", http_code_value);
1527 } 1531 }
1528 1532
1529 void PrintPreviewHandler::FillPrinterDescription( 1533 void PrintPreviewHandler::FillPrinterDescription(
1530 const std::string& name, 1534 const std::string& name,
1531 const local_discovery::DeviceDescription& description, 1535 const local_discovery::DeviceDescription& description,
1532 bool has_local_printing, 1536 bool has_local_printing,
1533 base::DictionaryValue* printer_value) { 1537 base::DictionaryValue* printer_value) {
1538 CommandLine* command_line = CommandLine::ForCurrentProcess();
1539
1534 printer_value->SetString("serviceName", name); 1540 printer_value->SetString("serviceName", name);
1535 printer_value->SetString("name", description.name); 1541 printer_value->SetString("name", description.name);
1536 printer_value->SetBoolean("hasLocalPrinting", has_local_printing); 1542 printer_value->SetBoolean("hasLocalPrinting", has_local_printing);
1537 printer_value->SetBoolean( 1543 printer_value->SetBoolean(
1538 "isUnregistered", 1544 "isUnregistered",
1539 description.id.empty()); 1545 description.id.empty() &&
1546 command_line->HasSwitch(switches::kEnablePrintPreviewRegisterPromos));
1540 printer_value->SetString("cloudID", description.id); 1547 printer_value->SetString("cloudID", description.id);
1541 } 1548 }
1542 1549
1543 #endif 1550 #endif
OLDNEW
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698