• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
4 
5 #ifndef CHROME_COMMON_CLOUD_PRINT_CLOUD_PRINT_CONSTANTS_H_
6 #define CHROME_COMMON_CLOUD_PRINT_CLOUD_PRINT_CONSTANTS_H_
7 
8 #include "base/basictypes.h"
9 
10 namespace cloud_print {
11 
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 
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[];
32 
33 extern const char kContentTypeJSON[];
34 extern const char kContentTypePDF[];
35 extern const char kContentTypeXML[];
36 extern const char kContentTypeXPS[];
37 
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[];
43 
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 kPrinterCapsHashValue[];
55 extern const char kTagsValue[];
56 extern const char kXMPPJidValue[];
57 extern const char kOAuthCodeValue[];
58 extern const char kCreateTimeValue[];
59 extern const char kPrinterTypeValue[];
60 extern const char kUserValue[];
61 extern const char kUsersValue[];
62 extern const char kLocalSettingsPendingXmppValue[];
63 
64 // Value in XMPP notification.
65 extern const char kNotificationUpdateSettings[];
66 
67 // Printer tag names. Don't need prefixes. They will be added on submit.
68 extern const char kChromeVersionTagName[];
69 extern const char kSystemNameTagName[];
70 extern const char kSystemVersionTagName[];
71 
72 // Tags for cloud print service.
73 extern const char kCloudPrintServiceProxyTagPrefix[];
74 extern const char kCloudPrintServiceTagsHashTagName[];
75 extern const char kCloudPrintServiceTagDryRunFlag[];
76 
77 // Reasons for fetching print jobs.
78 // Job fetch on proxy startup.
79 extern const char kJobFetchReasonStartup[];
80 // Job fetch because we are polling.
81 extern const char kJobFetchReasonPoll[];
82 // Job fetch on being notified by the server.
83 extern const char kJobFetchReasonNotified[];
84 // Job fetch after a successful print to query for more jobs.
85 extern const char kJobFetchReasonQueryMore[];
86 // Job fetch after a job failure to query for more jobs.
87 extern const char kJobFetchReasonFailure[];
88 // Job fetch due to scheduled retry.
89 extern const char kJobFetchReasonRetry[];
90 
91 // Format of the local settings containing only XMPP ping.
92 extern const char kCreateLocalSettingsXmppPingFormat[];
93 extern const char kUpdateLocalSettingsXmppPingFormat[];
94 
95 // Max retry count for job data fetch requests.
96 const int kJobDataMaxRetryCount = 1;
97 // Max retry count (infinity) for API fetch requests.
98 const int kCloudPrintAPIMaxRetryCount = -1;
99 // Max retry count (infinity) for Registration requests.
100 const int kCloudPrintRegisterMaxRetryCount = -1;
101 // Max retry count (infinity) for authentication requests.
102 const int kCloudPrintAuthMaxRetryCount = -1;
103 
104 // When we don't have XMPP notifications available, we resort to polling for
105 // print jobs. We choose a random interval in seconds between these 2 values.
106 const int kMinJobPollIntervalSecs = 5*60;  // 5 minutes in seconds
107 const int kMaxJobPollIntervalSecs = 8*60;  // 8 minutes in seconds
108 
109 // When we have XMPP notifications available, we ping server to keep connection
110 // alive or check connection status.
111 const int kDefaultXmppPingTimeoutSecs = 5*60;
112 const int kMinXmppPingTimeoutSecs = 1*60;
113 const int kXmppPingCheckIntervalSecs = 60;
114 
115 // Number of failed pings before we try to reinstablish XMPP connection.
116 const int kMaxFailedXmppPings = 2;
117 
118 // The number of seconds before the OAuth2 access token is due to expire that
119 // we try and refresh it.
120 const int kTokenRefreshGracePeriodSecs = 5*60;  // 5 minutes in seconds
121 
122 // The number of retries before we abandon a print job in exponential backoff
123 const int kNumRetriesBeforeAbandonJob = 5;
124 
125 // The wait time for the second (first with wait time) retry for a job that
126 // fails due to network errors
127 const int kJobFirstWaitTimeSecs = 1;
128 
129 // The multiplier for the wait time for retrying a job that fails due to
130 // network errors
131 const int kJobWaitTimeExponentialMultiplier = 2;
132 
133 }  // namespace cloud_print
134 
135 #endif  // CHROME_COMMON_CLOUD_PRINT_CLOUD_PRINT_CONSTANTS_H_
136