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

Side by Side Diff: chrome/browser/local_discovery/cloud_print_account_manager.h

Issue 23530007: Move API flows for cloud print into common class CloudPrintBaseApiFlow (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: AppendQueryParameter Created 7 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/local_discovery/cloud_print_account_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_LOCAL_DISCOVERY_CLOUD_PRINT_ACCOUNT_MANAGER_H_ 5 #ifndef CHROME_BROWSER_LOCAL_DISCOVERY_CLOUD_PRINT_ACCOUNT_MANAGER_H_
6 #define CHROME_BROWSER_LOCAL_DISCOVERY_CLOUD_PRINT_ACCOUNT_MANAGER_H_ 6 #define CHROME_BROWSER_LOCAL_DISCOVERY_CLOUD_PRINT_ACCOUNT_MANAGER_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "net/url_request/url_fetcher.h" 13 #include "chrome/browser/local_discovery/cloud_print_base_api_flow.h"
14 #include "net/url_request/url_fetcher_delegate.h"
15 14
16 namespace local_discovery { 15 namespace local_discovery {
17 16
18 class CloudPrintAccountManager : public net::URLFetcherDelegate { 17 class CloudPrintAccountManager : public CloudPrintBaseApiFlow::Delegate {
19 public: 18 public:
20 typedef base::Callback<void( 19 typedef base::Callback<void(
21 const std::vector<std::string>& /*accounts*/, 20 const std::vector<std::string>& /*accounts*/,
22 const std::string& /*xsrf_token*/)> AccountsCallback; 21 const std::string& /*xsrf_token*/)> AccountsCallback;
23 22
24 CloudPrintAccountManager(net::URLRequestContextGetter* request_context, 23 CloudPrintAccountManager(net::URLRequestContextGetter* request_context,
25 const std::string& cloud_print_url, 24 const std::string& cloud_print_url,
26 int token_user_index, 25 int token_user_index,
27 const AccountsCallback& callback); 26 const AccountsCallback& callback);
28 virtual ~CloudPrintAccountManager(); 27 virtual ~CloudPrintAccountManager();
29 28
30 void Start(); 29 void Start();
31 30
32 // URLFetcher implementation: 31 // BaseCloudPrintApiFlow::Delegate implementation.
33 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; 32 virtual void OnCloudPrintAPIFlowError(
33 CloudPrintBaseApiFlow* flow,
34 CloudPrintBaseApiFlow::Status status) OVERRIDE;
35
36 virtual void OnCloudPrintAPIFlowComplete(
37 CloudPrintBaseApiFlow* flow,
38 const base::DictionaryValue* value) OVERRIDE;
34 39
35 private: 40 private:
36 void ReportEmptyUserList(); 41 void ReportEmptyUserList();
37 42
38 scoped_refptr<net::URLRequestContextGetter> request_context_; 43 CloudPrintBaseApiFlow flow_;
39 std::string cloud_print_url_;
40 int token_user_index_;
41 AccountsCallback callback_; 44 AccountsCallback callback_;
42 scoped_ptr<net::URLFetcher> url_fetcher_;
43 }; 45 };
44 46
45 } // namespace local_discovery 47 } // namespace local_discovery
46 48
47 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_CLOUD_PRINT_ACCOUNT_MANAGER_H_ 49 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_CLOUD_PRINT_ACCOUNT_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/local_discovery/cloud_print_account_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698