Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(702)

Side by Side Diff: chrome/browser/extensions/app_notify_channel_setup.h

Issue 10392192: Remove content::URLFetcherDelegate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More cleanup Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "content/public/common/url_fetcher.h" 16 #include "content/public/common/url_fetcher.h"
17 #include "content/public/common/url_fetcher_delegate.h"
18 #include "googleurl/src/gurl.h" 17 #include "googleurl/src/gurl.h"
18 #include "net/url_request/url_fetcher_delegate.h"
19 19
20 class AppNotifyChannelSetupTest; 20 class AppNotifyChannelSetupTest;
21 class Profile; 21 class Profile;
22 22
23 // This class uses the browser login credentials to setup app notifications 23 // This class uses the browser login credentials to setup app notifications
24 // for a given app. 24 // for a given app.
25 // 25 //
26 // Performs the following steps when Start() is called: 26 // Performs the following steps when Start() is called:
27 // 1. If the user is not logged in, prompt the user to login. 27 // 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. 28 // 2. OAuth2: Record a notifications grant for the user and the given app.
29 // 3. Get notifications channel id for the current user. 29 // 3. Get notifications channel id for the current user.
30 // 4. Call the delegate passed in to the constructor with the results of 30 // 4. Call the delegate passed in to the constructor with the results of
31 // the above steps. 31 // the above steps.
32 class AppNotifyChannelSetup 32 class AppNotifyChannelSetup
33 : public content::URLFetcherDelegate, 33 : public net::URLFetcherDelegate,
34 public AppNotifyChannelUI::Delegate, 34 public AppNotifyChannelUI::Delegate,
35 public OAuth2AccessTokenConsumer, 35 public OAuth2AccessTokenConsumer,
36 public base::RefCountedThreadSafe<AppNotifyChannelSetup> { 36 public base::RefCountedThreadSafe<AppNotifyChannelSetup> {
37 public: 37 public:
38 // These are the various error conditions, made public for use by the test 38 // These are the various error conditions, made public for use by the test
39 // interceptor. 39 // interceptor.
40 enum SetupError { 40 enum SetupError {
41 NONE, 41 NONE,
42 AUTH_ERROR, 42 AUTH_ERROR,
43 INTERNAL_ERROR, 43 INTERNAL_ERROR,
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 virtual void OnGetTokenFailure(const GoogleServiceAuthError& error) OVERRIDE; 90 virtual void OnGetTokenFailure(const GoogleServiceAuthError& error) OVERRIDE;
91 91
92 92
93 // Getters for various members. 93 // Getters for various members.
94 const std::string& extension_id() const { return extension_id_; } 94 const std::string& extension_id() const { return extension_id_; }
95 const std::string& client_id() const { return client_id_; } 95 const std::string& client_id() const { return client_id_; }
96 int return_route_id() const { return return_route_id_; } 96 int return_route_id() const { return return_route_id_; }
97 int callback_id() const { return callback_id_; } 97 int callback_id() const { return callback_id_; }
98 98
99 protected: 99 protected:
100 // content::URLFetcherDelegate. 100 // net::URLFetcherDelegate.
101 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; 101 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
102 102
103 // AppNotifyChannelUI::Delegate. 103 // AppNotifyChannelUI::Delegate.
104 virtual void OnSyncSetupResult(bool enabled) OVERRIDE; 104 virtual void OnSyncSetupResult(bool enabled) OVERRIDE;
105 105
106 private: 106 private:
107 enum State { 107 enum State {
108 INITIAL, 108 INITIAL,
109 LOGIN_STARTED, 109 LOGIN_STARTED,
110 LOGIN_DONE, 110 LOGIN_DONE,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_
OLDNEW
« no previous file with comments | « chrome/browser/component_updater/component_updater_service.cc ('k') | chrome/browser/extensions/apps_promo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698