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