Upstream version 5.34.98.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / local_discovery / cloud_print_account_manager.h
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_LOCAL_DISCOVERY_CLOUD_PRINT_ACCOUNT_MANAGER_H_
6 #define CHROME_BROWSER_LOCAL_DISCOVERY_CLOUD_PRINT_ACCOUNT_MANAGER_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/callback.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "chrome/browser/local_discovery/cloud_print_base_api_flow.h"
14
15 namespace local_discovery {
16
17 class CloudPrintAccountManager : public CloudPrintBaseApiFlow::Delegate {
18  public:
19   typedef base::Callback<void(
20       const std::vector<std::string>& /*accounts*/,
21       const std::string& /*xsrf_token*/)> AccountsCallback;
22
23   CloudPrintAccountManager(net::URLRequestContextGetter* request_context,
24                            const std::string& cloud_print_url,
25                            int token_user_index,
26                            const AccountsCallback& callback);
27   virtual ~CloudPrintAccountManager();
28
29   void Start();
30
31   // BaseCloudPrintApiFlow::Delegate implementation.
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;
39
40  private:
41   void ReportEmptyUserList();
42
43   CloudPrintBaseApiFlow flow_;
44   AccountsCallback callback_;
45 };
46
47 }  // namespace local_discovery
48
49 #endif  // CHROME_BROWSER_LOCAL_DISCOVERY_CLOUD_PRINT_ACCOUNT_MANAGER_H_