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

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_contacts_service.h

Issue 10823182: contacts: Rate-limit GData photo requests and handle 404s. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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_CHROMEOS_GDATA_GDATA_CONTACTS_SERVICE_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CONTACTS_SERVICE_H_
6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CONTACTS_SERVICE_H_ 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CONTACTS_SERVICE_H_
7 7
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 class GDataContactsService : public GDataContactsServiceInterface { 61 class GDataContactsService : public GDataContactsServiceInterface {
62 public: 62 public:
63 typedef base::Callback<std::string(const std::string&)> 63 typedef base::Callback<std::string(const std::string&)>
64 RewritePhotoUrlCallback; 64 RewritePhotoUrlCallback;
65 65
66 explicit GDataContactsService(Profile* profile); 66 explicit GDataContactsService(Profile* profile);
67 virtual ~GDataContactsService(); 67 virtual ~GDataContactsService();
68 68
69 GDataAuthService* auth_service_for_testing(); 69 GDataAuthService* auth_service_for_testing();
70 70
71 void set_max_simultaneous_photo_downloads_for_testing(int max_downloads) { 71 void set_max_photo_downloads_per_second_for_testing(int max_downloads) {
72 max_simultaneous_photo_downloads_ = max_downloads; 72 max_photo_downloads_per_second_ = max_downloads;
73 } 73 }
74 void set_feed_url_for_testing(const GURL& url) { 74 void set_feed_url_for_testing(const GURL& url) {
75 feed_url_for_testing_ = url; 75 feed_url_for_testing_ = url;
76 } 76 }
77 void set_rewrite_photo_url_callback_for_testing(RewritePhotoUrlCallback cb) { 77 void set_rewrite_photo_url_callback_for_testing(RewritePhotoUrlCallback cb) {
78 rewrite_photo_url_callback_for_testing_ = cb; 78 rewrite_photo_url_callback_for_testing_ = cb;
79 } 79 }
80 80
81 // Overridden from GDataContactsServiceInterface: 81 // Overridden from GDataContactsServiceInterface:
82 virtual void Initialize() OVERRIDE; 82 virtual void Initialize() OVERRIDE;
(...skipping 13 matching lines...) Expand all
96 scoped_ptr<GDataOperationRunner> runner_; 96 scoped_ptr<GDataOperationRunner> runner_;
97 97
98 // In-progress download requests. Pointers are owned by this class. 98 // In-progress download requests. Pointers are owned by this class.
99 std::set<DownloadContactsRequest*> requests_; 99 std::set<DownloadContactsRequest*> requests_;
100 100
101 // If non-empty, URL that will be used to fetch the feed. URLs contained 101 // If non-empty, URL that will be used to fetch the feed. URLs contained
102 // within the feed will also be modified to use the host and port from this 102 // within the feed will also be modified to use the host and port from this
103 // member. 103 // member.
104 GURL feed_url_for_testing_; 104 GURL feed_url_for_testing_;
105 105
106 // Maximum number of photos we'll try to download at once (per 106 // Maximum number of photos we'll try to download per second (per
107 // DownloadContacts() request). 107 // DownloadContacts() request).
108 int max_simultaneous_photo_downloads_; 108 int max_photo_downloads_per_second_;
109 109
110 // Callback that's invoked to rewrite photo URLs for tests. 110 // Callback that's invoked to rewrite photo URLs for tests.
111 // This is needed for tests that serve static feed data from a host/port 111 // This is needed for tests that serve static feed data from a host/port
112 // that's only known at runtime. 112 // that's only known at runtime.
113 RewritePhotoUrlCallback rewrite_photo_url_callback_for_testing_; 113 RewritePhotoUrlCallback rewrite_photo_url_callback_for_testing_;
114 114
115 DISALLOW_COPY_AND_ASSIGN(GDataContactsService); 115 DISALLOW_COPY_AND_ASSIGN(GDataContactsService);
116 }; 116 };
117 117
118 } // namespace gdata 118 } // namespace gdata
119 119
120 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CONTACTS_SERVICE_H_ 120 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CONTACTS_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698