Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / common / cloud_print / cloud_print_constants.h
blob410d0893e35faaa56b2d6148c1c0c2c0244d9be5
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[];
19 // Values used to register or update a printer with the cloud print service.
20 extern const char kProxyIdValue[];
21 extern const char kPrinterNameValue[];
22 extern const char kPrinterDescValue[];
23 extern const char kPrinterCapsValue[];
24 extern const char kPrinterDisplayNameValue[];
25 extern const char kPrinterDefaultsValue[];
26 extern const char kPrinterStatusValue[];
27 extern const char kPrinterTagValue[];
28 extern const char kPrinterRemoveTagValue[];
29 extern const char kPrinterLocalSettingsValue[];
30 extern const char kMessageTextValue[];
31 extern const char kUseCDD[];
33 extern const char kContentTypeJSON[];
34 extern const char kContentTypePDF[];
35 extern const char kContentTypeXML[];
36 extern const char kContentTypeXPS[];
38 // Value of "code" parameter in cloud print "/message" requests.
39 extern const char kPrintSystemFailedMessageId[];
40 extern const char kGetPrinterCapsFailedMessageId[];
41 extern const char kEnumPrintersFailedMessageId[];
42 extern const char kZombiePrinterMessageId[];
44 // Values in the respone JSON from the cloud print server.
45 extern const char kSuccessValue[];
46 extern const char kNameValue[];
47 extern const char kDisplayNameValue[];
48 extern const char kIdValue[];
49 extern const char kTicketUrlValue[];
50 extern const char kFileUrlValue[];
51 extern const char kPrinterListValue[];
52 extern const char kJobListValue[];
53 extern const char kTitleValue[];
54 extern const char kOwnerValue[];
55 extern const char kPrinterCapsHashValue[];
56 extern const char kTagsValue[];
57 extern const char kXMPPJidValue[];
58 extern const char kOAuthCodeValue[];
59 extern const char kCreateTimeValue[];
60 extern const char kPrinterTypeValue[];
61 extern const char kUserValue[];
62 extern const char kUsersValue[];
63 extern const char kLocalSettingsPendingXmppValue[];
65 // Value in XMPP notification.
66 extern const char kNotificationUpdateSettings[];
68 // Printer tag names. Don't need prefixes. They will be added on submit.
69 extern const char kChromeVersionTagName[];
70 extern const char kSystemNameTagName[];
71 extern const char kSystemVersionTagName[];
73 // Tags for cloud print service.
74 extern const char kCloudPrintServiceProxyTagPrefix[];
75 extern const char kCloudPrintServiceTagsHashTagName[];
76 extern const char kCloudPrintServiceTagDryRunFlag[];
78 // Reasons for fetching print jobs.
79 // Job fetch on proxy startup.
80 extern const char kJobFetchReasonStartup[];
81 // Job fetch because we are polling.
82 extern const char kJobFetchReasonPoll[];
83 // Job fetch on being notified by the server.
84 extern const char kJobFetchReasonNotified[];
85 // Job fetch after a successful print to query for more jobs.
86 extern const char kJobFetchReasonQueryMore[];
87 // Job fetch after a job failure to query for more jobs.
88 extern const char kJobFetchReasonFailure[];
89 // Job fetch due to scheduled retry.
90 extern const char kJobFetchReasonRetry[];
92 // Format of the local settings containing only XMPP ping.
93 extern const char kCreateLocalSettingsXmppPingFormat[];
94 extern const char kUpdateLocalSettingsXmppPingFormat[];
96 // Max retry count for job data fetch requests.
97 const int kJobDataMaxRetryCount = 1;
98 // Max retry count (infinity) for API fetch requests.
99 const int kCloudPrintAPIMaxRetryCount = -1;
100 // Max retry count (infinity) for Registration requests.
101 const int kCloudPrintRegisterMaxRetryCount = -1;
102 // Max retry count (infinity) for authentication requests.
103 const int kCloudPrintAuthMaxRetryCount = -1;
105 // When we don't have XMPP notifications available, we resort to polling for
106 // print jobs. We choose a random interval in seconds between these 2 values.
107 const int kMinJobPollIntervalSecs = 5*60; // 5 minutes in seconds
108 const int kMaxJobPollIntervalSecs = 8*60; // 8 minutes in seconds
110 // When we have XMPP notifications available, we ping server to keep connection
111 // alive or check connection status.
112 const int kDefaultXmppPingTimeoutSecs = 5*60;
113 const int kMinXmppPingTimeoutSecs = 1*60;
114 const int kXmppPingCheckIntervalSecs = 60;
116 // Number of failed pings before we try to reinstablish XMPP connection.
117 const int kMaxFailedXmppPings = 2;
119 // The number of seconds before the OAuth2 access token is due to expire that
120 // we try and refresh it.
121 const int kTokenRefreshGracePeriodSecs = 5*60; // 5 minutes in seconds
123 // The number of retries before we abandon a print job in exponential backoff
124 const int kNumRetriesBeforeAbandonJob = 5;
126 // The wait time for the second (first with wait time) retry for a job that
127 // fails due to network errors
128 const int kJobFirstWaitTimeSecs = 1;
130 // The multiplier for the wait time for retrying a job that fails due to
131 // network errors
132 const int kJobWaitTimeExponentialMultiplier = 2;
134 } // namespace cloud_print
136 #endif // CHROME_COMMON_CLOUD_PRINT_CLOUD_PRINT_CONSTANTS_H_