Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / cacheinvalidation / src / java / com / google / ipc / invalidation / ticl / android2 / channel / AndroidChannelConstants.java
1 /*
2  * Copyright 2011 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package com.google.ipc.invalidation.ticl.android2.channel;
17
18 import com.google.ipc.invalidation.ticl.proto.AndroidChannel.MajorVersion;
19 import com.google.ipc.invalidation.ticl.proto.ClientProtocol.Version;
20
21 /**
22  * Constants used by the network channel.
23  *
24  */
25 public final class AndroidChannelConstants {
26
27   /** Constants used in Intents sent to retrieve auth tokens from the application. */
28   public static class AuthTokenConstants {
29     /**
30      * Action requesting that an auth token to send a message be provided. This is the action
31      * used in the intent to the application.
32      */
33     public static final String ACTION_REQUEST_AUTH_TOKEN =
34         "com.google.ipc.invalidation.AUTH_TOKEN_REQUEST";
35
36     /** Extra in an auth token request response providing the pending intent. */
37     public static final String EXTRA_PENDING_INTENT =
38         "com.google.ipc.invalidation.AUTH_TOKEN_PENDING_INTENT";
39
40     /**
41      * Extra in an auth token request message indicating that the token provided as the value
42      * was invalid when last used. This may be set on the intent to the application.
43      */
44     public static final String EXTRA_INVALIDATE_AUTH_TOKEN =
45         "com.google.ipc.invalidaton.AUTH_TOKEN_INVALIDATE";
46
47     /** Extra in the intent from the application that provides the auth token string. */
48     public static final String EXTRA_AUTH_TOKEN = "com.google.ipc.invalidation.AUTH_TOKEN";
49
50     /**
51      * Extra in the intent from the application that provides the so-called "auth token type". If
52      * the auth token is a GoogleLogin token, then this value must name the Gaia service (e.g.,
53      * "chromiumsync") for which the token was generated. If the auth token is a Gaia OAuth2 token,
54      * then this value must have the form "oauth2:{scope}", where {scope} is a Google API
55      * authentication scope such as "https://www.googleapis.com/auth/chromesync".
56      */
57     public static final String EXTRA_AUTH_TOKEN_TYPE =
58         "com.google.ipc.invalidation.AUTH_TOKEN_TYPE";
59
60     /**
61      * Extra in the intent from the application that provides the message to send. We store this
62      * ourselves in the intent inside the pending intent that we give to the application.
63      */
64     static final String EXTRA_STORED_MESSAGE = "com.google.ipc.invalidation.AUTH_TOKEN_MSG";
65
66     /**
67      * Extra in the intent from the application that indicates whether the intent is for a retry
68      * after a failed authentication. If we find that an auth token no longer works, we will tell
69      * the application to invalidate it, retrieve a new one, and send us back the message and the
70      * new token, but we do not want to go into an infinite loop if authentication never succeeds.
71      */
72     static final String EXTRA_IS_RETRY = "com.google.ipc.invalidation.AUTH_TOKEN_IS_RETRY";
73   }
74
75   /** Constants used in HTTP requests to the data center. */
76   public static class HttpConstants {
77     /** The URL of the invalidation channel service */
78     public static final String CHANNEL_URL = "https://clients4.google.com/";
79
80     /** The MIME content type to use for requests that contain binary protobuf */
81     public static final String PROTO_CONTENT_TYPE = "application/x-protobuffer";
82
83     /** The relative URL to use to send inbound client requests to the Android frontend */
84     public static final String REQUEST_URL = "/invalidation/android/request/";
85
86     /**
87      * The name of the query parameter that contains the service name that should be used to
88      * validate the authentication token provided with the request.
89      */
90     public static final String SERVICE_PARAMETER = "service";
91
92     /**
93      * The name of the header that contains the echoed token. This token is included in all C2DM
94      * messages to the client and is echoed back under this header on all client HTTP requests.
95      */
96     public static final String ECHO_HEADER = "echo-token";
97   }
98
99   /** Constants used in C2DM messages. */
100    public static class C2dmConstants {
101     /**
102      * Name of C2DM parameter containing message content.  If not set, data is retrieved via
103      * the mailbox frontend
104      */
105     public static final String CONTENT_PARAM = "content";
106
107     /** Name of the C2DM parameter containing an opaque token to be echoed on HTTP requests. */
108     public static final String ECHO_PARAM = "echo-token";
109   }
110
111   /** The channel version expected by this channel implementation. */
112   public static final Version CHANNEL_VERSION = Version.create(MajorVersion.INITIAL, 0);
113
114   /**
115    * An extra set on an intent to the AndroidMessageSenderService to inform it that a GCM
116    * registration id change has occurred. This is sent by the AndroidMessageReceiverService
117    * to trigger the sender service to send any buffered messages when a GCM registration id first
118    * becomes available.
119    * <p>
120    * The value associated with this extra is ignored.
121    */
122   static final String MESSAGE_SENDER_SVC_GCM_REGID_CHANGE =
123       "com.google.ipc.invalidation.channel.sender.gcm_regid_change";
124
125   private AndroidChannelConstants() {
126     // Disallow instantiation.
127   }
128 }