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

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_documents_service.cc

Issue 10693109: Use Drive v2 API: enable behind --enable-drive-api flag (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 5 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 #include "chrome/browser/chromeos/gdata/gdata_documents_service.h" 5 #include "chrome/browser/chromeos/gdata/gdata_documents_service.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/message_loop_proxy.h" 10 #include "base/message_loop_proxy.h"
11 #include "chrome/browser/chromeos/gdata/gdata_file_system.h"
12 #include "chrome/browser/chromeos/gdata/gdata_operation_runner.h" 11 #include "chrome/browser/chromeos/gdata/gdata_operation_runner.h"
13 #include "chrome/browser/chromeos/gdata/gdata_operations.h" 12 #include "chrome/browser/chromeos/gdata/gdata_operations.h"
14 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/common/net/url_util.h" 14 #include "chrome/common/net/url_util.h"
16 #include "content/public/browser/browser_thread.h" 15 #include "content/public/browser/browser_thread.h"
17 16
18 using content::BrowserThread; 17 using content::BrowserThread;
19 18
20 namespace gdata { 19 namespace gdata {
21 20
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 const std::string& directory_resource_id) 63 const std::string& directory_resource_id)
65 : start_changestamp(start_changestamp), 64 : start_changestamp(start_changestamp),
66 search_query(search_query), 65 search_query(search_query),
67 directory_resource_id(directory_resource_id) { 66 directory_resource_id(directory_resource_id) {
68 } 67 }
69 68
70 DocumentsServiceInterface::GetDocumentsOptions::~GetDocumentsOptions() {} 69 DocumentsServiceInterface::GetDocumentsOptions::~GetDocumentsOptions() {}
71 70
72 DocumentsService::DocumentsService() 71 DocumentsService::DocumentsService()
73 : profile_(NULL), 72 : profile_(NULL),
74 runner_(NULL) { 73 runner_(NULL),
74 use_drive_api_(false) {
75 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 75 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
76 } 76 }
77 77
78 DocumentsService::~DocumentsService() { 78 DocumentsService::~DocumentsService() {
79 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 79 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
80 } 80 }
81 81
82 GDataAuthService* DocumentsService::auth_service_for_testing() { 82 GDataAuthService* DocumentsService::auth_service_for_testing() {
83 return runner_->auth_service(); 83 return runner_->auth_service();
84 } 84 }
85 85
86 void DocumentsService::Initialize(Profile* profile) { 86 void DocumentsService::Initialize(Profile* profile, bool use_drive_api) {
87 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 87 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
88 use_drive_api_ = use_drive_api;
88 profile_ = profile; 89 profile_ = profile;
89 runner_.reset(new GDataOperationRunner(profile)); 90 runner_.reset(new GDataOperationRunner(profile));
90 runner_->Initialize(); 91 runner_->Initialize();
91 } 92 }
92 93
93 GDataOperationRegistry* DocumentsService::operation_registry() const { 94 GDataOperationRegistry* DocumentsService::operation_registry() const {
94 return runner_->operation_registry(); 95 return runner_->operation_registry();
95 } 96 }
96 97
97 void DocumentsService::CancelAll() { 98 void DocumentsService::CancelAll() {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 callback); 133 callback);
133 runner_->StartOperationWithRetry(operation); 134 runner_->StartOperationWithRetry(operation);
134 } 135 }
135 136
136 void DocumentsService::GetAccountMetadata(const GetDataCallback& callback) { 137 void DocumentsService::GetAccountMetadata(const GetDataCallback& callback) {
137 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 138 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
138 139
139 GetAccountMetadataOperation* operation = 140 GetAccountMetadataOperation* operation =
140 new GetAccountMetadataOperation(operation_registry(), 141 new GetAccountMetadataOperation(operation_registry(),
141 profile_, 142 profile_,
142 callback); 143 callback,
144 use_drive_api_);
143 runner_->StartOperationWithRetry(operation); 145 runner_->StartOperationWithRetry(operation);
144 } 146 }
145 147
146 void DocumentsService::DownloadDocument( 148 void DocumentsService::DownloadDocument(
147 const FilePath& virtual_path, 149 const FilePath& virtual_path,
148 const FilePath& local_cache_path, 150 const FilePath& local_cache_path,
149 const GURL& document_url, 151 const GURL& document_url,
150 DocumentExportFormat format, 152 DocumentExportFormat format,
151 const DownloadActionCallback& callback) { 153 const DownloadActionCallback& callback) {
152 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 154 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 const std::string& app_ids, 277 const std::string& app_ids,
276 const GetDataCallback& callback) { 278 const GetDataCallback& callback) {
277 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 279 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
278 280
279 runner_->StartOperationWithRetry( 281 runner_->StartOperationWithRetry(
280 new AuthorizeAppsOperation(operation_registry(), profile_, callback, 282 new AuthorizeAppsOperation(operation_registry(), profile_, callback,
281 resource_url, app_ids)); 283 resource_url, app_ids));
282 } 284 }
283 285
284 } // namespace gdata 286 } // namespace gdata
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698