Fix build break
[chromium-blink-merge.git] / chrome / browser / google_apis / gdata_contacts_operations.h
blob76baf6e9a2a8b19a575d403184cfb644b89a0bd6
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_GOOGLE_APIS_GDATA_CONTACTS_OPERATIONS_H_
6 #define CHROME_BROWSER_GOOGLE_APIS_GDATA_CONTACTS_OPERATIONS_H_
8 #include <string>
10 #include "chrome/browser/google_apis/base_operations.h"
12 namespace net {
13 class URLRequestContextGetter;
14 } // namespace net
16 namespace google_apis {
18 //========================== GetContactGroupsOperation =========================
20 // This class fetches a JSON feed containing a user's contact groups.
21 class GetContactGroupsOperation : public GetDataOperation {
22 public:
23 GetContactGroupsOperation(
24 OperationRegistry* registry,
25 net::URLRequestContextGetter* url_request_context_getter,
26 const GetDataCallback& callback);
27 virtual ~GetContactGroupsOperation();
29 void set_feed_url_for_testing(const GURL& url) {
30 feed_url_for_testing_ = url;
33 protected:
34 // Overridden from GetDataOperation.
35 virtual GURL GetURL() const OVERRIDE;
37 private:
38 // If non-empty, URL of the feed to fetch.
39 GURL feed_url_for_testing_;
41 DISALLOW_COPY_AND_ASSIGN(GetContactGroupsOperation);
44 //============================ GetContactsOperation ============================
46 // This class fetches a JSON feed containing a user's contacts.
47 class GetContactsOperation : public GetDataOperation {
48 public:
49 GetContactsOperation(
50 OperationRegistry* registry,
51 net::URLRequestContextGetter* url_request_context_getter,
52 const std::string& group_id,
53 const base::Time& min_update_time,
54 const GetDataCallback& callback);
55 virtual ~GetContactsOperation();
57 void set_feed_url_for_testing(const GURL& url) {
58 feed_url_for_testing_ = url;
61 protected:
62 // Overridden from GetDataOperation.
63 virtual GURL GetURL() const OVERRIDE;
65 private:
66 // If non-empty, URL of the feed to fetch.
67 GURL feed_url_for_testing_;
69 // If non-empty, contains the ID of the group whose contacts should be
70 // returned. Group IDs generally look like this:
71 // http://www.google.com/m8/feeds/groups/user%40gmail.com/base/6
72 std::string group_id_;
74 // If is_null() is false, contains a minimum last-updated time that will be
75 // used to filter contacts.
76 base::Time min_update_time_;
78 DISALLOW_COPY_AND_ASSIGN(GetContactsOperation);
81 //========================== GetContactPhotoOperation ==========================
83 // This class fetches a contact's photo.
84 class GetContactPhotoOperation : public UrlFetchOperationBase {
85 public:
86 GetContactPhotoOperation(
87 OperationRegistry* registry,
88 net::URLRequestContextGetter* url_request_context_getter,
89 const GURL& photo_url,
90 const GetContentCallback& callback);
91 virtual ~GetContactPhotoOperation();
93 protected:
94 // Overridden from UrlFetchOperationBase.
95 virtual GURL GetURL() const OVERRIDE;
96 virtual void ProcessURLFetchResults(const net::URLFetcher* source) OVERRIDE;
97 virtual void RunCallbackOnPrematureFailure(GDataErrorCode code) OVERRIDE;
99 private:
100 // Location of the photo to fetch.
101 GURL photo_url_;
103 // Callback to which the photo data is passed.
104 GetContentCallback callback_;
106 DISALLOW_COPY_AND_ASSIGN(GetContactPhotoOperation);
109 } // namespace google_apis
111 #endif // CHROME_BROWSER_GOOGLE_APIS_GDATA_CONTACTS_OPERATIONS_H_