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
3 // found in the LICENSE file.
5 #ifndef CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_WIPEOUT_H_
6 #define CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_WIPEOUT_H_
11 #include "base/basictypes.h"
12 #include "chrome/service/cloud_print/cloud_print_url_fetcher.h"
15 namespace cloud_print
{
17 // CloudPrintWipeout unregisters list of printers from the cloudprint service.
18 class CloudPrintWipeout
: public CloudPrintURLFetcherDelegate
{
22 virtual void OnUnregisterPrintersComplete() = 0;
27 CloudPrintWipeout(Client
* client
, const GURL
& cloud_print_server_url
);
28 ~CloudPrintWipeout() override
;
30 void UnregisterPrinters(const std::string
& auth_token
,
31 const std::list
<std::string
>& printer_ids
);
33 // CloudPrintURLFetcher::Delegate implementation.
34 CloudPrintURLFetcher::ResponseAction
HandleJSONData(
35 const net::URLFetcher
* source
,
37 base::DictionaryValue
* json_data
,
38 bool succeeded
) override
;
39 void OnRequestGiveUp() override
;
40 CloudPrintURLFetcher::ResponseAction
OnRequestAuthError() override
;
41 std::string
GetAuthHeader() override
;
44 void UnregisterNextPrinter();
46 // CloudPrintWipeout client.
48 // Cloud Print server url.
49 GURL cloud_print_server_url_
;
50 // The CloudPrintURLFetcher instance for the current request.
51 scoped_refptr
<CloudPrintURLFetcher
> request_
;
53 std::string auth_token_
;
54 // List of printer to unregister
55 std::list
<std::string
> printer_ids_
;
57 DISALLOW_COPY_AND_ASSIGN(CloudPrintWipeout
);
60 } // namespace cloud_print
62 #endif // CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_WIPEOUT_H_