OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_EXTENSIONS_APP_NOTIFY_CHANNEL_SETUP_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_APP_NOTIFY_CHANNEL_SETUP_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_APP_NOTIFY_CHANNEL_SETUP_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_APP_NOTIFY_CHANNEL_SETUP_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 }; | 118 }; |
119 | 119 |
120 friend class base::RefCountedThreadSafe<AppNotifyChannelSetup>; | 120 friend class base::RefCountedThreadSafe<AppNotifyChannelSetup>; |
121 friend class AppNotifyChannelSetupTest; | 121 friend class AppNotifyChannelSetupTest; |
122 | 122 |
123 virtual ~AppNotifyChannelSetup(); | 123 virtual ~AppNotifyChannelSetup(); |
124 | 124 |
125 // Creates an instance of URLFetcher that does not send or save cookies. | 125 // Creates an instance of URLFetcher that does not send or save cookies. |
126 // The URLFether's method will be GET if body is empty, POST otherwise. | 126 // The URLFether's method will be GET if body is empty, POST otherwise. |
127 // Caller owns the returned instance. | 127 // Caller owns the returned instance. |
128 content::URLFetcher* CreateURLFetcher( | 128 net::URLFetcher* CreateURLFetcher( |
129 const GURL& url, const std::string& body, const std::string& auth_token); | 129 const GURL& url, const std::string& body, const std::string& auth_token); |
130 void BeginLogin(); | 130 void BeginLogin(); |
131 void EndLogin(bool success); | 131 void EndLogin(bool success); |
132 void BeginGetAccessToken(); | 132 void BeginGetAccessToken(); |
133 void EndGetAccessToken(bool success); | 133 void EndGetAccessToken(bool success); |
134 void BeginRecordGrant(); | 134 void BeginRecordGrant(); |
135 void EndRecordGrant(const net::URLFetcher* source); | 135 void EndRecordGrant(const net::URLFetcher* source); |
136 void BeginGetChannelId(); | 136 void BeginGetChannelId(); |
137 void EndGetChannelId(const net::URLFetcher* source); | 137 void EndGetChannelId(const net::URLFetcher* source); |
138 | 138 |
(...skipping 12 matching lines...) Expand all Loading... |
151 void RegisterForTokenServiceNotifications(); | 151 void RegisterForTokenServiceNotifications(); |
152 void UnregisterForTokenServiceNotifications(); | 152 void UnregisterForTokenServiceNotifications(); |
153 | 153 |
154 Profile* profile_; | 154 Profile* profile_; |
155 std::string extension_id_; | 155 std::string extension_id_; |
156 std::string client_id_; | 156 std::string client_id_; |
157 GURL requestor_url_; | 157 GURL requestor_url_; |
158 int return_route_id_; | 158 int return_route_id_; |
159 int callback_id_; | 159 int callback_id_; |
160 base::WeakPtr<Delegate> delegate_; | 160 base::WeakPtr<Delegate> delegate_; |
161 scoped_ptr<content::URLFetcher> url_fetcher_; | 161 scoped_ptr<net::URLFetcher> url_fetcher_; |
162 scoped_ptr<OAuth2AccessTokenFetcher> oauth2_fetcher_; | 162 scoped_ptr<OAuth2AccessTokenFetcher> oauth2_fetcher_; |
163 scoped_ptr<AppNotifyChannelUI> ui_; | 163 scoped_ptr<AppNotifyChannelUI> ui_; |
164 State state_; | 164 State state_; |
165 std::string oauth2_access_token_; | 165 std::string oauth2_access_token_; |
166 // Keeps track of whether we have encountered failure in OAuth2 access | 166 // Keeps track of whether we have encountered failure in OAuth2 access |
167 // token generation already. We use this to prevent us from doing an | 167 // token generation already. We use this to prevent us from doing an |
168 // infinite loop of trying to generate access token, if that fails, try | 168 // infinite loop of trying to generate access token, if that fails, try |
169 // to login the user and generate access token, etc. | 169 // to login the user and generate access token, etc. |
170 bool oauth2_access_token_failure_; | 170 bool oauth2_access_token_failure_; |
171 | 171 |
172 DISALLOW_COPY_AND_ASSIGN(AppNotifyChannelSetup); | 172 DISALLOW_COPY_AND_ASSIGN(AppNotifyChannelSetup); |
173 }; | 173 }; |
174 | 174 |
175 #endif // CHROME_BROWSER_EXTENSIONS_APP_NOTIFY_CHANNEL_SETUP_H_ | 175 #endif // CHROME_BROWSER_EXTENSIONS_APP_NOTIFY_CHANNEL_SETUP_H_ |
OLD | NEW |