Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / common / cloud_print / cloud_print_constants.h
blobf6a4db7f92bcdcb20b30f1cf41e239209c522538
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[];
34 // Value of "code" parameter in cloud print "/message" requests.
35 extern const char kPrintSystemFailedMessageId[];
36 extern const char kGetPrinterCapsFailedMessageId[];
37 extern const char kEnumPrintersFailedMessageId[];
38 extern const char kZombiePrinterMessageId[];
40 // Values in the respone JSON from the cloud print server.
41 extern const char kSuccessValue[];
42 extern const char kNameValue[];
43 extern const char kDisplayNameValue[];
44 extern const char kIdValue[];
45 extern const char kTicketUrlValue[];
46 extern const char kFileUrlValue[];
47 extern const char kPrinterListValue[];
48 extern const char kJobListValue[];
49 extern const char kTitleValue[];
50 extern const char kPrinterCapsHashValue[];
51 extern const char kTagsValue[];
52 extern const char kXMPPJidValue[];
53 extern const char kOAuthCodeValue[];
54 extern const char kCreateTimeValue[];
55 extern const char kPrinterTypeValue[];
56 extern const char kUserValue[];
57 extern const char kUsersValue[];
58 extern const char kLocalSettingsPendingXmppValue[];
60 // Value in XMPP notification.
61 extern const char kNotificationUpdateSettings[];
63 // Printer tag names. Don't need prefixes. They will be added on submit.
64 extern const char kChromeVersionTagName[];
65 extern const char kSystemNameTagName[];
66 extern const char kSystemVersionTagName[];
68 // Tags for cloud print service.
69 extern const char kCloudPrintServiceProxyTagPrefix[];
70 extern const char kCloudPrintServiceTagsHashTagName[];
71 extern const char kCloudPrintServiceTagDryRunFlag[];
73 // Reasons for fetching print jobs.
74 // Job fetch on proxy startup.
75 extern const char kJobFetchReasonStartup[];
76 // Job fetch because we are polling.
77 extern const char kJobFetchReasonPoll[];
78 // Job fetch on being notified by the server.
79 extern const char kJobFetchReasonNotified[];
80 // Job fetch after a successful print to query for more jobs.
81 extern const char kJobFetchReasonQueryMore[];
82 // Job fetch after a job failure to query for more jobs.
83 extern const char kJobFetchReasonFailure[];
84 // Job fetch due to scheduled retry.
85 extern const char kJobFetchReasonRetry[];
87 // Format of the local settings containing only XMPP ping.
88 extern const char kCreateLocalSettingsXmppPingFormat[];
89 extern const char kUpdateLocalSettingsXmppPingFormat[];
91 // Max retry count for job data fetch requests.
92 const int kJobDataMaxRetryCount = 1;
93 // Max retry count (infinity) for API fetch requests.
94 const int kCloudPrintAPIMaxRetryCount = -1;
95 // Max retry count (infinity) for Registration requests.
96 const int kCloudPrintRegisterMaxRetryCount = -1;
97 // Max retry count (infinity) for authentication requests.
98 const int kCloudPrintAuthMaxRetryCount = -1;
100 // When we don't have XMPP notifications available, we resort to polling for
101 // print jobs. We choose a random interval in seconds between these 2 values.
102 const int kMinJobPollIntervalSecs = 5*60; // 5 minutes in seconds
103 const int kMaxJobPollIntervalSecs = 8*60; // 8 minutes in seconds
105 // When we have XMPP notifications available, we ping server to keep connection
106 // alive or check connection status.
107 const int kDefaultXmppPingTimeoutSecs = 5*60;
108 const int kMinXmppPingTimeoutSecs = 1*60;
109 const int kXmppPingCheckIntervalSecs = 60;
111 // Number of failed pings before we try to reinstablish XMPP connection.
112 const int kMaxFailedXmppPings = 2;
114 // The number of seconds before the OAuth2 access token is due to expire that
115 // we try and refresh it.
116 const int kTokenRefreshGracePeriodSecs = 5*60; // 5 minutes in seconds
118 // The number of retries before we abandon a print job in exponential backoff
119 const int kNumRetriesBeforeAbandonJob = 5;
121 // The wait time for the second (first with wait time) retry for a job that
122 // fails due to network errors
123 const int kJobFirstWaitTimeSecs = 1;
125 // The multiplier for the wait time for retrying a job that fails due to
126 // network errors
127 const int kJobWaitTimeExponentialMultiplier = 2;
129 } // namespace cloud_print
131 #endif // CHROME_COMMON_CLOUD_PRINT_CLOUD_PRINT_CONSTANTS_H_