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

Side by Side Diff: chrome/browser/chromeos/extensions/file_browser_private_api.cc

Issue 10690149: gdata: Move GDataCache::CacheEntry out of GDataCache (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: removing the existing test 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/extensions/file_browser_private_api.h" 5 #include "chrome/browser/chromeos/extensions/file_browser_private_api.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 const std::vector<FilePath>& file_paths, 253 const std::vector<FilePath>& file_paths,
254 WebAppInfoMap* app_info, 254 WebAppInfoMap* app_info,
255 std::set<std::string>* available_apps) { 255 std::set<std::string>* available_apps) {
256 for (std::vector<FilePath>::const_iterator iter = file_paths.begin(); 256 for (std::vector<FilePath>::const_iterator iter = file_paths.begin();
257 iter != file_paths.end(); ++iter) { 257 iter != file_paths.end(); ++iter) {
258 if (iter->empty()) 258 if (iter->empty())
259 continue; 259 continue;
260 ScopedVector<gdata::DriveWebAppInfo> info; 260 ScopedVector<gdata::DriveWebAppInfo> info;
261 registry->GetWebAppsForFile(*iter, std::string(""), &info); 261 registry->GetWebAppsForFile(*iter, std::string(""), &info);
262 std::vector<gdata::DriveWebAppInfo*> info_ptrs; 262 std::vector<gdata::DriveWebAppInfo*> info_ptrs;
263 info.release(&info_ptrs); // so they don't go away prematurely. 263 info.release(&info_ptrs); // so they don't go away prematurely.
264 std::set<std::string> apps_for_this_file; 264 std::set<std::string> apps_for_this_file;
265 for (std::vector<gdata::DriveWebAppInfo*>::iterator 265 for (std::vector<gdata::DriveWebAppInfo*>::iterator
266 apps = info_ptrs.begin(); apps != info_ptrs.end(); ++apps) { 266 apps = info_ptrs.begin(); apps != info_ptrs.end(); ++apps) {
267 std::pair<WebAppInfoMap::iterator, bool> insert_result = 267 std::pair<WebAppInfoMap::iterator, bool> insert_result =
268 app_info->insert(std::make_pair((*apps)->app_id, *apps)); 268 app_info->insert(std::make_pair((*apps)->app_id, *apps));
269 apps_for_this_file.insert((*apps)->app_id); 269 apps_for_this_file.insert((*apps)->app_id);
270 // If we failed to insert an app_id because there was a duplicate, then we 270 // If we failed to insert an app_id because there was a duplicate, then we
271 // must delete it (since we own it). 271 // must delete it (since we own it).
272 if (!insert_result.second) 272 if (!insert_result.second)
273 delete *apps; 273 delete *apps;
(...skipping 1596 matching lines...) Expand 10 before | Expand all | Expand 10 after
1870 file_proto->gdata_entry().resource_id(), 1870 file_proto->gdata_entry().resource_id(),
1871 file_proto->file_md5(), 1871 file_proto->file_md5(),
1872 base::Bind( 1872 base::Bind(
1873 &GetGDataFilePropertiesFunction::CacheStateReceived, 1873 &GetGDataFilePropertiesFunction::CacheStateReceived,
1874 this, property_dict)); 1874 this, property_dict));
1875 } 1875 }
1876 1876
1877 void GetGDataFilePropertiesFunction::CacheStateReceived( 1877 void GetGDataFilePropertiesFunction::CacheStateReceived(
1878 base::DictionaryValue* property_dict, 1878 base::DictionaryValue* property_dict,
1879 bool /* success */, 1879 bool /* success */,
1880 const gdata::GDataCache::CacheEntry& cache_entry) { 1880 const gdata::GDataCacheEntry& cache_entry) {
1881 // In case of an error (i.e. success is false), cache_entry.cache_state is 1881 // In case of an error (i.e. success is false), cache_entry.cache_state is
1882 // set to CACHE_STATE_NONE. 1882 // set to CACHE_STATE_NONE.
1883 property_dict->SetBoolean("isPinned", cache_entry.IsPinned()); 1883 property_dict->SetBoolean("isPinned", cache_entry.IsPinned());
1884 property_dict->SetBoolean("isPresent", cache_entry.IsPresent()); 1884 property_dict->SetBoolean("isPresent", cache_entry.IsPresent());
1885 property_dict->SetBoolean("isDirty", cache_entry.IsDirty()); 1885 property_dict->SetBoolean("isDirty", cache_entry.IsDirty());
1886 1886
1887 CompleteGetFileProperties(); 1887 CompleteGetFileProperties();
1888 } 1888 }
1889 1889
1890 PinGDataFileFunction::PinGDataFileFunction() { 1890 PinGDataFileFunction::PinGDataFileFunction() {
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
2414 gdata::GDataSystemService* system_service = 2414 gdata::GDataSystemService* system_service =
2415 gdata::GDataSystemServiceFactory::GetForProfile(profile_); 2415 gdata::GDataSystemServiceFactory::GetForProfile(profile_);
2416 if (!system_service || !system_service->file_system()) 2416 if (!system_service || !system_service->file_system())
2417 return false; 2417 return false;
2418 2418
2419 FilePath directory_path = GetVirtualPathFromURL(GURL(file_url_as_string)); 2419 FilePath directory_path = GetVirtualPathFromURL(GURL(file_url_as_string));
2420 system_service->file_system()->RequestDirectoryRefresh(directory_path); 2420 system_service->file_system()->RequestDirectoryRefresh(directory_path);
2421 2421
2422 return true; 2422 return true;
2423 } 2423 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698