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" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "chrome/browser/extensions/app_notify_channel_ui.h" | 13 #include "chrome/browser/extensions/app_notify_channel_ui.h" |
14 #include "chrome/common/net/gaia/oauth2_access_token_consumer.h" | 14 #include "chrome/common/net/gaia/oauth2_access_token_consumer.h" |
15 #include "chrome/common/net/gaia/oauth2_access_token_fetcher.h" | 15 #include "chrome/common/net/gaia/oauth2_access_token_fetcher.h" |
16 #include "googleurl/src/gurl.h" | 16 #include "googleurl/src/gurl.h" |
17 #include "net/url_request/url_fetcher.h" | 17 #include "net/url_request/url_fetcher.h" |
18 #include "net/url_request/url_fetcher_delegate.h" | 18 #include "net/url_request/url_fetcher_delegate.h" |
19 | 19 |
| 20 class Profile; |
| 21 |
| 22 namespace extensions { |
20 class AppNotifyChannelSetupTest; | 23 class AppNotifyChannelSetupTest; |
21 class Profile; | |
22 | 24 |
23 // This class uses the browser login credentials to setup app notifications | 25 // This class uses the browser login credentials to setup app notifications |
24 // for a given app. | 26 // for a given app. |
25 // | 27 // |
26 // Performs the following steps when Start() is called: | 28 // Performs the following steps when Start() is called: |
27 // 1. If the user is not logged in, prompt the user to login. | 29 // 1. If the user is not logged in, prompt the user to login. |
28 // 2. OAuth2: Record a notifications grant for the user and the given app. | 30 // 2. OAuth2: Record a notifications grant for the user and the given app. |
29 // 3. Get notifications channel id for the current user. | 31 // 3. Get notifications channel id for the current user. |
30 // 4. Call the delegate passed in to the constructor with the results of | 32 // 4. Call the delegate passed in to the constructor with the results of |
31 // the above steps. | 33 // the above steps. |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 std::string oauth2_access_token_; | 168 std::string oauth2_access_token_; |
167 // Keeps track of whether we have encountered failure in OAuth2 access | 169 // Keeps track of whether we have encountered failure in OAuth2 access |
168 // token generation already. We use this to prevent us from doing an | 170 // token generation already. We use this to prevent us from doing an |
169 // infinite loop of trying to generate access token, if that fails, try | 171 // infinite loop of trying to generate access token, if that fails, try |
170 // to login the user and generate access token, etc. | 172 // to login the user and generate access token, etc. |
171 bool oauth2_access_token_failure_; | 173 bool oauth2_access_token_failure_; |
172 | 174 |
173 DISALLOW_COPY_AND_ASSIGN(AppNotifyChannelSetup); | 175 DISALLOW_COPY_AND_ASSIGN(AppNotifyChannelSetup); |
174 }; | 176 }; |
175 | 177 |
| 178 } // namespace extensions |
| 179 |
176 #endif // CHROME_BROWSER_EXTENSIONS_APP_NOTIFY_CHANNEL_SETUP_H_ | 180 #endif // CHROME_BROWSER_EXTENSIONS_APP_NOTIFY_CHANNEL_SETUP_H_ |
OLD | NEW |