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

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

Issue 2956033002: Print Preview: Make useCloudPrint a WebUI event (Closed)
Patch Set: Created 3 years, 5 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
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 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 1419 matching lines...) Expand 10 before | Expand all | Expand 10 after
1430 1430
1431 void PrintPreviewHandler::SendCloudPrintEnabled() { 1431 void PrintPreviewHandler::SendCloudPrintEnabled() {
1432 Profile* profile = Profile::FromBrowserContext( 1432 Profile* profile = Profile::FromBrowserContext(
1433 preview_web_contents()->GetBrowserContext()); 1433 preview_web_contents()->GetBrowserContext());
1434 PrefService* prefs = profile->GetPrefs(); 1434 PrefService* prefs = profile->GetPrefs();
1435 if (prefs->GetBoolean(prefs::kCloudPrintSubmitEnabled)) { 1435 if (prefs->GetBoolean(prefs::kCloudPrintSubmitEnabled)) {
1436 base::DictionaryValue settings; 1436 base::DictionaryValue settings;
1437 settings.SetString(kCloudPrintUrl, 1437 settings.SetString(kCloudPrintUrl,
1438 GURL(cloud_devices::GetCloudPrintURL()).spec()); 1438 GURL(cloud_devices::GetCloudPrintURL()).spec());
1439 settings.SetBoolean(kAppKioskMode, chrome::IsRunningInForcedAppMode()); 1439 settings.SetBoolean(kAppKioskMode, chrome::IsRunningInForcedAppMode());
1440 web_ui()->CallJavascriptFunctionUnsafe("setUseCloudPrint", settings); 1440 FireWebUIListener("use-cloud-print", settings);
dpapad 2017/06/27 18:54:07 Do we need to package the string and the boolean t
rbpotter 2017/06/27 22:30:29 Done.
1441 } 1441 }
1442 } 1442 }
1443 1443
1444 void PrintPreviewHandler::SendCloudPrintJob(const std::string& callback_id, 1444 void PrintPreviewHandler::SendCloudPrintJob(const std::string& callback_id,
1445 const base::RefCountedBytes* data) { 1445 const base::RefCountedBytes* data) {
1446 // BASE64 encode the job data. 1446 // BASE64 encode the job data.
1447 const base::StringPiece raw_data(reinterpret_cast<const char*>(data->front()), 1447 const base::StringPiece raw_data(reinterpret_cast<const char*>(data->front()),
1448 data->size()); 1448 data->size());
1449 std::string base64_data; 1449 std::string base64_data;
1450 base::Base64Encode(raw_data, &base64_data); 1450 base::Base64Encode(raw_data, &base64_data);
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
1898 1898
1899 void PrintPreviewHandler::UnregisterForGaiaCookieChanges() { 1899 void PrintPreviewHandler::UnregisterForGaiaCookieChanges() {
1900 if (gaia_cookie_manager_service_) 1900 if (gaia_cookie_manager_service_)
1901 gaia_cookie_manager_service_->RemoveObserver(this); 1901 gaia_cookie_manager_service_->RemoveObserver(this);
1902 } 1902 }
1903 1903
1904 void PrintPreviewHandler::SetPdfSavedClosureForTesting( 1904 void PrintPreviewHandler::SetPdfSavedClosureForTesting(
1905 const base::Closure& closure) { 1905 const base::Closure& closure) {
1906 pdf_file_saved_closure_ = closure; 1906 pdf_file_saved_closure_ = closure;
1907 } 1907 }
OLDNEW
« no previous file with comments | « chrome/browser/resources/print_preview/print_preview.js ('k') | chrome/test/data/webui/print_preview/print_preview_tests.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698