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

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

Issue 2920153004: Print Preview: Change getPrivetPrinters to cr.sendWithPromise (Closed)
Patch Set: Change notation Created 3 years, 6 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 #ifndef CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ 6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/timer/timer.h"
16 #include "chrome/common/features.h" 17 #include "chrome/common/features.h"
17 #include "components/signin/core/browser/gaia_cookie_manager_service.h" 18 #include "components/signin/core/browser/gaia_cookie_manager_service.h"
18 #include "content/public/browser/web_ui_message_handler.h" 19 #include "content/public/browser/web_ui_message_handler.h"
19 #include "printing/backend/print_backend.h" 20 #include "printing/backend/print_backend.h"
20 #include "printing/features/features.h" 21 #include "printing/features/features.h"
21 #include "ui/shell_dialogs/select_file_dialog.h" 22 #include "ui/shell_dialogs/select_file_dialog.h"
22 23
23 #if BUILDFLAG(ENABLE_SERVICE_DISCOVERY) 24 #if BUILDFLAG(ENABLE_SERVICE_DISCOVERY)
24 #include "chrome/browser/local_discovery/service_discovery_shared_client.h" 25 #include "chrome/browser/local_discovery/service_discovery_shared_client.h"
25 #include "chrome/browser/printing/cloud_print/privet_local_printer_lister.h" 26 #include "chrome/browser/printing/cloud_print/privet_local_printer_lister.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 // Starts getting all local privet printers. |args| is unused. 136 // Starts getting all local privet printers. |args| is unused.
136 void HandleGetPrivetPrinters(const base::ListValue* args); 137 void HandleGetPrivetPrinters(const base::ListValue* args);
137 138
138 // Starts getting all local extension managed printers. |args| is unused. 139 // Starts getting all local extension managed printers. |args| is unused.
139 void HandleGetExtensionPrinters(const base::ListValue* args); 140 void HandleGetExtensionPrinters(const base::ListValue* args);
140 141
141 // Grants an extension access to a provisional printer. First element of 142 // Grants an extension access to a provisional printer. First element of
142 // |args| is the provisional printer ID. 143 // |args| is the provisional printer ID.
143 void HandleGrantExtensionPrinterAccess(const base::ListValue* args); 144 void HandleGrantExtensionPrinterAccess(const base::ListValue* args);
144 145
145 // Stops getting all local privet printers. |arg| is unused.
146 void HandleStopGetPrivetPrinters(const base::ListValue* args);
147
148 // Asks the initiator renderer to generate a preview. First element of |args| 146 // Asks the initiator renderer to generate a preview. First element of |args|
149 // is a job settings JSON string. 147 // is a job settings JSON string.
150 void HandleGetPreview(const base::ListValue* args); 148 void HandleGetPreview(const base::ListValue* args);
151 149
152 // Gets the job settings from Web UI and initiate printing. First element of 150 // Gets the job settings from Web UI and initiate printing. First element of
153 // |args| is a job settings JSON string. 151 // |args| is a job settings JSON string.
154 void HandlePrint(const base::ListValue* args); 152 void HandlePrint(const base::ListValue* args);
155 153
156 // Handles the request to hide the preview dialog for printing. 154 // Handles the request to hide the preview dialog for printing.
157 // |args| is unused. 155 // |args| is unused.
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 #if defined(USE_CUPS) 277 #if defined(USE_CUPS)
280 void SaveCUPSColorSetting(const base::DictionaryValue* settings); 278 void SaveCUPSColorSetting(const base::DictionaryValue* settings);
281 279
282 void ConvertColorSettingToCUPSColorModel( 280 void ConvertColorSettingToCUPSColorModel(
283 base::DictionaryValue* settings) const; 281 base::DictionaryValue* settings) const;
284 #endif 282 #endif
285 283
286 #if BUILDFLAG(ENABLE_SERVICE_DISCOVERY) 284 #if BUILDFLAG(ENABLE_SERVICE_DISCOVERY)
287 void StartPrivetLister(const scoped_refptr< 285 void StartPrivetLister(const scoped_refptr<
288 local_discovery::ServiceDiscoverySharedClient>& client); 286 local_discovery::ServiceDiscoverySharedClient>& client);
287 void StopPrivetLister();
289 void OnPrivetCapabilities(const base::DictionaryValue* capabilities); 288 void OnPrivetCapabilities(const base::DictionaryValue* capabilities);
290 void PrivetCapabilitiesUpdateClient( 289 void PrivetCapabilitiesUpdateClient(
291 std::unique_ptr<cloud_print::PrivetHTTPClient> http_client); 290 std::unique_ptr<cloud_print::PrivetHTTPClient> http_client);
292 void PrivetLocalPrintUpdateClient( 291 void PrivetLocalPrintUpdateClient(
293 std::string print_ticket, 292 std::string print_ticket,
294 std::string capabilities, 293 std::string capabilities,
295 gfx::Size page_size, 294 gfx::Size page_size,
296 std::unique_ptr<cloud_print::PrivetHTTPClient> http_client); 295 std::unique_ptr<cloud_print::PrivetHTTPClient> http_client);
297 bool PrivetUpdateClient( 296 bool PrivetUpdateClient(
298 std::unique_ptr<cloud_print::PrivetHTTPClient> http_client); 297 std::unique_ptr<cloud_print::PrivetHTTPClient> http_client);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 std::unique_ptr<AccessTokenService> token_service_; 376 std::unique_ptr<AccessTokenService> token_service_;
378 377
379 // Pointer to cookie manager service so that print preview can listen for GAIA 378 // Pointer to cookie manager service so that print preview can listen for GAIA
380 // cookie changes. 379 // cookie changes.
381 GaiaCookieManagerService* gaia_cookie_manager_service_; 380 GaiaCookieManagerService* gaia_cookie_manager_service_;
382 381
383 #if BUILDFLAG(ENABLE_SERVICE_DISCOVERY) 382 #if BUILDFLAG(ENABLE_SERVICE_DISCOVERY)
384 scoped_refptr<local_discovery::ServiceDiscoverySharedClient> 383 scoped_refptr<local_discovery::ServiceDiscoverySharedClient>
385 service_discovery_client_; 384 service_discovery_client_;
386 std::unique_ptr<cloud_print::PrivetLocalPrinterLister> printer_lister_; 385 std::unique_ptr<cloud_print::PrivetLocalPrinterLister> printer_lister_;
387 386 std::unique_ptr<base::OneShotTimer> privet_lister_timer_;
388 std::unique_ptr<cloud_print::PrivetHTTPAsynchronousFactory> 387 std::unique_ptr<cloud_print::PrivetHTTPAsynchronousFactory>
389 privet_http_factory_; 388 privet_http_factory_;
390 std::unique_ptr<cloud_print::PrivetHTTPResolution> privet_http_resolution_; 389 std::unique_ptr<cloud_print::PrivetHTTPResolution> privet_http_resolution_;
391 std::unique_ptr<cloud_print::PrivetV1HTTPClient> privet_http_client_; 390 std::unique_ptr<cloud_print::PrivetV1HTTPClient> privet_http_client_;
392 std::unique_ptr<cloud_print::PrivetJSONOperation> 391 std::unique_ptr<cloud_print::PrivetJSONOperation>
393 privet_capabilities_operation_; 392 privet_capabilities_operation_;
394 std::unique_ptr<cloud_print::PrivetLocalPrintOperation> 393 std::unique_ptr<cloud_print::PrivetLocalPrintOperation>
395 privet_local_print_operation_; 394 privet_local_print_operation_;
396 #endif 395 #endif
397 396
398 // Handles requests for extension printers. Created lazily by calling 397 // Handles requests for extension printers. Created lazily by calling
399 // |EnsureExtensionPrinterHandlerSet|. 398 // |EnsureExtensionPrinterHandlerSet|.
400 std::unique_ptr<PrinterHandler> extension_printer_handler_; 399 std::unique_ptr<PrinterHandler> extension_printer_handler_;
401 400
402 // Notifies tests that want to know if the PDF has been saved. This doesn't 401 // Notifies tests that want to know if the PDF has been saved. This doesn't
403 // notify the test if it was a successful save, only that it was attempted. 402 // notify the test if it was a successful save, only that it was attempted.
404 base::Closure pdf_file_saved_closure_; 403 base::Closure pdf_file_saved_closure_;
405 404
405 // Callback ID to be used to notify UI that privet search is finished.
406 std::string privet_callback_id_ = "";
407
406 // Proxy for calls to the print backend. Lazily initialized since web_ui() is 408 // Proxy for calls to the print backend. Lazily initialized since web_ui() is
407 // not available at construction time. 409 // not available at construction time.
408 std::unique_ptr<printing::PrinterBackendProxy> printer_backend_proxy_; 410 std::unique_ptr<printing::PrinterBackendProxy> printer_backend_proxy_;
409 411
410 base::WeakPtrFactory<PrintPreviewHandler> weak_factory_; 412 base::WeakPtrFactory<PrintPreviewHandler> weak_factory_;
411 413
412 DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler); 414 DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler);
413 }; 415 };
414 416
415 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ 417 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/resources/print_preview/native_layer.js ('k') | chrome/browser/ui/webui/print_preview/print_preview_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698