1 // Copyright 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_COMMON_CLOUD_PRINT_CLOUD_PRINT_CONSTANTS_H_
6 #define CHROME_COMMON_CLOUD_PRINT_CLOUD_PRINT_CONSTANTS_H_
8 #include "base/basictypes.h"
10 namespace cloud_print
{
12 // The string to be appended to the user-agent for cloud print requests.
13 extern const char kCloudPrintUserAgent
[];
14 // The proxy header required by cloud print server.
15 extern const char kChromeCloudPrintProxyHeader
[];
16 // The source of cloud print notifications.
17 extern const char kCloudPrintPushNotificationsSource
[];
18 // The cloud print OAuth2 scope.
19 extern const char kCloudPrintAuth
[];
21 // Values used to register or update a printer with the cloud print service.
22 extern const char kProxyIdValue
[];
23 extern const char kPrinterNameValue
[];
24 extern const char kPrinterDescValue
[];
25 extern const char kPrinterCapsValue
[];
26 extern const char kPrinterDisplayNameValue
[];
27 extern const char kPrinterDefaultsValue
[];
28 extern const char kPrinterStatusValue
[];
29 extern const char kPrinterTagValue
[];
30 extern const char kPrinterRemoveTagValue
[];
31 extern const char kPrinterLocalSettingsValue
[];
32 extern const char kMessageTextValue
[];
33 extern const char kUseCDD
[];
35 extern const char kContentTypeJSON
[];
36 extern const char kContentTypePDF
[];
37 extern const char kContentTypeXML
[];
38 extern const char kContentTypeXPS
[];
40 // Value of "code" parameter in cloud print "/message" requests.
41 extern const char kPrintSystemFailedMessageId
[];
42 extern const char kGetPrinterCapsFailedMessageId
[];
43 extern const char kEnumPrintersFailedMessageId
[];
44 extern const char kZombiePrinterMessageId
[];
46 // Values in the respone JSON from the cloud print server.
47 extern const char kSuccessValue
[];
48 extern const char kNameValue
[];
49 extern const char kDisplayNameValue
[];
50 extern const char kIdValue
[];
51 extern const char kTicketUrlValue
[];
52 extern const char kFileUrlValue
[];
53 extern const char kPrinterListValue
[];
54 extern const char kJobListValue
[];
55 extern const char kTitleValue
[];
56 extern const char kPrinterCapsHashValue
[];
57 extern const char kTagsValue
[];
58 extern const char kXMPPJidValue
[];
59 extern const char kOAuthCodeValue
[];
60 extern const char kCreateTimeValue
[];
61 extern const char kPrinterTypeValue
[];
62 extern const char kUserValue
[];
63 extern const char kUsersValue
[];
64 extern const char kLocalSettingsPendingXmppValue
[];
66 // Value in XMPP notification.
67 extern const char kNotificationUpdateSettings
[];
69 // Printer tag names. Don't need prefixes. They will be added on submit.
70 extern const char kChromeVersionTagName
[];
71 extern const char kSystemNameTagName
[];
72 extern const char kSystemVersionTagName
[];
74 // Tags for cloud print service.
75 extern const char kCloudPrintServiceProxyTagPrefix
[];
76 extern const char kCloudPrintServiceTagsHashTagName
[];
77 extern const char kCloudPrintServiceTagDryRunFlag
[];
79 // Reasons for fetching print jobs.
80 // Job fetch on proxy startup.
81 extern const char kJobFetchReasonStartup
[];
82 // Job fetch because we are polling.
83 extern const char kJobFetchReasonPoll
[];
84 // Job fetch on being notified by the server.
85 extern const char kJobFetchReasonNotified
[];
86 // Job fetch after a successful print to query for more jobs.
87 extern const char kJobFetchReasonQueryMore
[];
88 // Job fetch after a job failure to query for more jobs.
89 extern const char kJobFetchReasonFailure
[];
90 // Job fetch due to scheduled retry.
91 extern const char kJobFetchReasonRetry
[];
93 // Format of the local settings containing only XMPP ping.
94 extern const char kCreateLocalSettingsXmppPingFormat
[];
95 extern const char kUpdateLocalSettingsXmppPingFormat
[];
97 // Max retry count for job data fetch requests.
98 const int kJobDataMaxRetryCount
= 1;
99 // Max retry count (infinity) for API fetch requests.
100 const int kCloudPrintAPIMaxRetryCount
= -1;
101 // Max retry count (infinity) for Registration requests.
102 const int kCloudPrintRegisterMaxRetryCount
= -1;
103 // Max retry count (infinity) for authentication requests.
104 const int kCloudPrintAuthMaxRetryCount
= -1;
106 // When we don't have XMPP notifications available, we resort to polling for
107 // print jobs. We choose a random interval in seconds between these 2 values.
108 const int kMinJobPollIntervalSecs
= 5*60; // 5 minutes in seconds
109 const int kMaxJobPollIntervalSecs
= 8*60; // 8 minutes in seconds
111 // When we have XMPP notifications available, we ping server to keep connection
112 // alive or check connection status.
113 const int kDefaultXmppPingTimeoutSecs
= 5*60;
114 const int kMinXmppPingTimeoutSecs
= 1*60;
115 const int kXmppPingCheckIntervalSecs
= 60;
117 // Number of failed pings before we try to reinstablish XMPP connection.
118 const int kMaxFailedXmppPings
= 2;
120 // The number of seconds before the OAuth2 access token is due to expire that
121 // we try and refresh it.
122 const int kTokenRefreshGracePeriodSecs
= 5*60; // 5 minutes in seconds
124 // The number of retries before we abandon a print job in exponential backoff
125 const int kNumRetriesBeforeAbandonJob
= 5;
127 // The wait time for the second (first with wait time) retry for a job that
128 // fails due to network errors
129 const int kJobFirstWaitTimeSecs
= 1;
131 // The multiplier for the wait time for retrying a job that fails due to
133 const int kJobWaitTimeExponentialMultiplier
= 2;
135 } // namespace cloud_print
137 #endif // CHROME_COMMON_CLOUD_PRINT_CLOUD_PRINT_CONSTANTS_H_