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

Side by Side Diff: sync/api/attachments/attachment_downloader.h

Issue 436373002: Move non-API code out of sync/api/attachments/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Apply CR feedback. Created 6 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
« no previous file with comments | « sync/api/attachments/README ('k') | sync/api/attachments/attachment_downloader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 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 SYNC_API_ATTACHMENTS_ATTACHMENT_DOWNLOADER_H_
6 #define SYNC_API_ATTACHMENTS_ATTACHMENT_DOWNLOADER_H_
7
8 #include "base/callback.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "google_apis/gaia/oauth2_token_service_request.h"
11 #include "sync/api/attachments/attachment.h"
12 #include "sync/base/sync_export.h"
13
14 namespace net {
15 class URLRequestContextGetter;
16 } // namespace net
17
18 namespace syncer {
19
20 // AttachmentDownloader is responsible for downloading attachments from server.
21 class SYNC_EXPORT AttachmentDownloader {
22 public:
23 // The result of a DownloadAttachment operation.
24 enum DownloadResult {
25 DOWNLOAD_SUCCESS, // No error, attachment was downloaded
26 // successfully.
27 DOWNLOAD_UNSPECIFIED_ERROR, // An unspecified error occurred.
28 };
29
30 typedef base::Callback<void(const DownloadResult&, scoped_ptr<Attachment>)>
31 DownloadCallback;
32
33 virtual ~AttachmentDownloader();
34
35 // Download attachment referred by |attachment_id| and invoke |callback| when
36 // done.
37 //
38 // |callback| will receive a DownloadResult code and an Attachment object. If
39 // DownloadResult is not DOWNLOAD_SUCCESS then attachment pointer is NULL.
40 virtual void DownloadAttachment(const AttachmentId& attachment_id,
41 const DownloadCallback& callback) = 0;
42
43 // Create instance of AttachmentDownloaderImpl.
44 // |sync_service_url| is the URL of the sync service.
45 //
46 // |url_request_context_getter| provides a URLRequestContext.
47 //
48 // |account_id| is the account id to use for downloads.
49 //
50 // |scopes| is the set of scopes to use for downloads.
51 //
52 // |token_service_provider| provides an OAuth2 token service.
53 static scoped_ptr<AttachmentDownloader> Create(
54 const GURL& sync_service_url,
55 const scoped_refptr<net::URLRequestContextGetter>&
56 url_request_context_getter,
57 const std::string& account_id,
58 const OAuth2TokenService::ScopeSet scopes,
59 scoped_ptr<OAuth2TokenServiceRequest::TokenServiceProvider>
60 token_service_provider);
61 };
62
63 } // namespace syncer
64
65 #endif // SYNC_API_ATTACHMENTS_ATTACHMENT_DOWNLOADER_H_
OLDNEW
« no previous file with comments | « sync/api/attachments/README ('k') | sync/api/attachments/attachment_downloader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698