1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_HELPERS_H_
#define CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_HELPERS_H_
#include <map>
#include <string>
#include <vector>
#include "chrome/service/cloud_print/print_system.h"
#include "googleurl/src/gurl.h"
namespace base {
class DictionaryValue;
}
// Helper methods for the cloud print proxy code.
class CloudPrintHelpers {
public:
static GURL GetUrlForPrinterRegistration(const GURL& cloud_print_server_url);
static GURL GetUrlForPrinterUpdate(const GURL& cloud_print_server_url,
const std::string& printer_id);
static GURL GetUrlForPrinterDelete(const GURL& cloud_print_server_url,
const std::string& printer_id,
const std::string& reason);
static GURL GetUrlForPrinterList(const GURL& cloud_print_server_url,
const std::string& proxy_id);
static GURL GetUrlForJobFetch(const GURL& cloud_print_server_url,
const std::string& printer_id,
const std::string& reason);
static GURL GetUrlForJobStatusUpdate(const GURL& cloud_print_server_url,
const std::string& job_id,
cloud_print::PrintJobStatus status);
static GURL GetUrlForJobStatusUpdate(
const GURL& cloud_print_server_url,
const std::string& job_id,
const cloud_print::PrintJobDetails& details);
static GURL GetUrlForUserMessage(const GURL& cloud_print_server_url,
const std::string& message_id);
static GURL GetUrlForGetAuthCode(const GURL& cloud_print_server_url,
const std::string& oauth_client_id,
const std::string& proxy_id);
// Returns an MD5 hash for printer tags.
static std::string GetHashOfPrinterTags(
const printing::PrinterBasicInfo& printer);
// Returns an post data for printer tags.
static std::string GetPostDataForPrinterTags(
const printing::PrinterBasicInfo& printer_info,
const std::string& mime_boundary);
// Returns true is tags indicate a dry run (test) job.
static bool IsDryRunJob(const std::vector<std::string>& tags);
// Created CloudPrint auth header from the auth token stored in the store.
static std::string GetCloudPrintAuthHeaderFromStore();
// Created CloudPrint auth header from the auth token.
static std::string GetCloudPrintAuthHeader(const std::string& auth_token);
private:
CloudPrintHelpers() {}
};
#endif // CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_HELPERS_H_
|