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

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

Issue 10198003: gdata: Get rid of GetGDataCacheTmpDirectory() and friends (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 8 years, 8 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_util.h" 5 #include "chrome/browser/chromeos/gdata/gdata_util.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 137
138 void ModifyGDataFileResourceUrl(Profile* profile, 138 void ModifyGDataFileResourceUrl(Profile* profile,
139 const FilePath& gdata_cache_path, 139 const FilePath& gdata_cache_path,
140 GURL* url) { 140 GURL* url) {
141 GDataFileSystem* file_system = GetGDataFileSystem(profile); 141 GDataFileSystem* file_system = GetGDataFileSystem(profile);
142 if (!file_system) 142 if (!file_system)
143 return; 143 return;
144 144
145 // Handle hosted documents. The edit url is in the temporary file, so we 145 // Handle hosted documents. The edit url is in the temporary file, so we
146 // read it on a blocking thread. 146 // read it on a blocking thread.
147 if (file_system->GetGDataTempDocumentFolderPath().IsParent( 147 if (file_system->GetCacheDirectoryPath(
148 GDataRootDirectory::CACHE_TYPE_TMP_DOCUMENTS).IsParent(
148 gdata_cache_path)) { 149 gdata_cache_path)) {
149 GURL* edit_url = new GURL(); 150 GURL* edit_url = new GURL();
150 content::BrowserThread::GetBlockingPool()->PostTaskAndReply(FROM_HERE, 151 content::BrowserThread::GetBlockingPool()->PostTaskAndReply(FROM_HERE,
151 base::Bind(&GetHostedDocumentURLBlockingThread, 152 base::Bind(&GetHostedDocumentURLBlockingThread,
152 gdata_cache_path, edit_url), 153 gdata_cache_path, edit_url),
153 base::Bind(&OpenEditURLUIThread, profile, base::Owned(edit_url))); 154 base::Bind(&OpenEditURLUIThread, profile, base::Owned(edit_url)));
154 *url = GURL(); 155 *url = GURL();
155 return; 156 return;
156 } 157 }
157 158
158 // Handle all other gdata files. 159 // Handle all other gdata files.
159 if (file_system->GetGDataCacheTmpDirectory().IsParent(gdata_cache_path)) { 160 if (file_system->GetCacheDirectoryPath(
161 GDataRootDirectory::CACHE_TYPE_TMP).IsParent(gdata_cache_path)) {
160 const std::string resource_id = 162 const std::string resource_id =
161 gdata_cache_path.BaseName().RemoveExtension().AsUTF8Unsafe(); 163 gdata_cache_path.BaseName().RemoveExtension().AsUTF8Unsafe();
162 GetFileNameDelegate delegate; 164 GetFileNameDelegate delegate;
163 file_system->FindEntryByResourceIdSync(resource_id, &delegate); 165 file_system->FindEntryByResourceIdSync(resource_id, &delegate);
164 *url = gdata::util::GetFileResourceUrl(resource_id, delegate.file_name()); 166 *url = gdata::util::GetFileResourceUrl(resource_id, delegate.file_name());
165 DVLOG(1) << "ModifyGDataFileResourceUrl " << *url; 167 DVLOG(1) << "ModifyGDataFileResourceUrl " << *url;
166 } 168 }
167 } 169 }
168 170
169 bool IsUnderGDataMountPoint(const FilePath& path) { 171 bool IsUnderGDataMountPoint(const FilePath& path) {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 // --disable-gdata or enterprise policy, or probably with user settings too 256 // --disable-gdata or enterprise policy, or probably with user settings too
255 // in the future. 257 // in the future.
256 if (profile->GetPrefs()->GetBoolean(prefs::kDisableGData)) 258 if (profile->GetPrefs()->GetBoolean(prefs::kDisableGData))
257 return false; 259 return false;
258 260
259 return true; 261 return true;
260 } 262 }
261 263
262 } // namespace util 264 } // namespace util
263 } // namespace gdata 265 } // namespace gdata
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698