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

Side by Side Diff: chrome/browser/sync_file_system/drive_file_sync_service.cc

Issue 15984016: Call scoped_refptr<T>::get() rather than relying on implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 6 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/sync_file_system/drive_file_sync_service.h" 5 #include "chrome/browser/sync_file_system/drive_file_sync_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 ? kSyncFileSystemDirDev : kSyncFileSystemDir; 63 ? kSyncFileSystemDirDev : kSyncFileSystemDir;
64 } 64 }
65 65
66 bool CreateTemporaryFile(const base::FilePath& dir_path, 66 bool CreateTemporaryFile(const base::FilePath& dir_path,
67 webkit_blob::ScopedFile* temp_file) { 67 webkit_blob::ScopedFile* temp_file) {
68 base::FilePath temp_file_path; 68 base::FilePath temp_file_path;
69 const bool success = file_util::CreateDirectory(dir_path) && 69 const bool success = file_util::CreateDirectory(dir_path) &&
70 file_util::CreateTemporaryFileInDir(dir_path, &temp_file_path); 70 file_util::CreateTemporaryFileInDir(dir_path, &temp_file_path);
71 if (!success) 71 if (!success)
72 return success; 72 return success;
73 *temp_file = webkit_blob::ScopedFile( 73 *temp_file =
74 temp_file_path, 74 webkit_blob::ScopedFile(temp_file_path,
75 webkit_blob::ScopedFile::DELETE_ON_SCOPE_OUT, 75 webkit_blob::ScopedFile::DELETE_ON_SCOPE_OUT,
76 base::MessageLoopProxy::current()); 76 base::MessageLoopProxy::current().get());
77 return success; 77 return success;
78 } 78 }
79 79
80 void EmptyStatusCallback(SyncStatusCode status) {} 80 void EmptyStatusCallback(SyncStatusCode status) {}
81 81
82 void SyncFileCallbackAdapter( 82 void SyncFileCallbackAdapter(
83 const SyncStatusCallback& status_callback, 83 const SyncStatusCallback& status_callback,
84 const SyncFileCallback& callback, 84 const SyncFileCallback& callback,
85 SyncStatusCode status, 85 SyncStatusCode status,
86 const FileSystemURL& url) { 86 const FileSystemURL& url) {
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 355
356 temporary_file_dir_ = 356 temporary_file_dir_ =
357 profile_->GetPath().Append(GetSyncFileSystemDir()).Append(kTempDirName); 357 profile_->GetPath().Append(GetSyncFileSystemDir()).Append(kTempDirName);
358 358
359 api_util_.reset(new drive::APIUtil(profile_)); 359 api_util_.reset(new drive::APIUtil(profile_));
360 api_util_->AddObserver(this); 360 api_util_->AddObserver(this);
361 361
362 metadata_store_.reset(new DriveMetadataStore( 362 metadata_store_.reset(new DriveMetadataStore(
363 profile_->GetPath().Append(GetSyncFileSystemDir()), 363 profile_->GetPath().Append(GetSyncFileSystemDir()),
364 content::BrowserThread::GetMessageLoopProxyForThread( 364 content::BrowserThread::GetMessageLoopProxyForThread(
365 content::BrowserThread::FILE))); 365 content::BrowserThread::FILE).get()));
366 366
367 metadata_store_->Initialize( 367 metadata_store_->Initialize(
368 base::Bind(&DriveFileSyncService::DidInitializeMetadataStore, 368 base::Bind(&DriveFileSyncService::DidInitializeMetadataStore,
369 AsWeakPtr(), callback)); 369 AsWeakPtr(), callback));
370 } 370 }
371 371
372 void DriveFileSyncService::InitializeForTesting( 372 void DriveFileSyncService::InitializeForTesting(
373 scoped_ptr<DriveFileSyncTaskManager> task_manager, 373 scoped_ptr<DriveFileSyncTaskManager> task_manager,
374 const base::FilePath& base_dir, 374 const base::FilePath& base_dir,
375 scoped_ptr<drive::APIUtilInterface> api_util, 375 scoped_ptr<drive::APIUtilInterface> api_util,
(...skipping 1388 matching lines...) Expand 10 before | Expand all | Expand 10 after
1764 metadata_store_->SetOriginRootDirectory(origin, resource_id); 1764 metadata_store_->SetOriginRootDirectory(origin, resource_id);
1765 } 1765 }
1766 callback.Run(status, resource_id); 1766 callback.Run(status, resource_id);
1767 } 1767 }
1768 1768
1769 std::string DriveFileSyncService::sync_root_resource_id() { 1769 std::string DriveFileSyncService::sync_root_resource_id() {
1770 return metadata_store_->sync_root_directory(); 1770 return metadata_store_->sync_root_directory();
1771 } 1771 }
1772 1772
1773 } // namespace sync_file_system 1773 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698