OLD | NEW |
---|---|
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_file_system.h" | 5 #include "chrome/browser/chromeos/gdata/gdata_file_system.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
181 if (self_link) | 181 if (self_link) |
182 file->self_url_ = self_link->href(); | 182 file->self_url_ = self_link->href(); |
183 file->content_url_ = doc->content_url(); | 183 file->content_url_ = doc->content_url(); |
184 file->content_mime_type_ = doc->content_mime_type(); | 184 file->content_mime_type_ = doc->content_mime_type(); |
185 file->etag_ = doc->etag(); | 185 file->etag_ = doc->etag(); |
186 file->resource_id_ = doc->resource_id(); | 186 file->resource_id_ = doc->resource_id(); |
187 file->id_ = doc->id(); | 187 file->id_ = doc->id(); |
188 file->file_info_.last_modified = doc->updated_time(); | 188 file->file_info_.last_modified = doc->updated_time(); |
189 file->file_info_.last_accessed = doc->updated_time(); | 189 file->file_info_.last_accessed = doc->updated_time(); |
190 file->file_info_.creation_time = doc->published_time(); | 190 file->file_info_.creation_time = doc->published_time(); |
191 | |
192 // Fetch the list of authors and their emails. | |
193 const ScopedVector<Author>& authors = doc->authors(); | |
zel
2012/02/29 23:46:38
kill authors, sorry for the confusion
| |
194 file->authors_.resize(authors.size()); | |
195 for (ScopedVector<Author>::const_iterator iter = authors.begin(); | |
196 iter != authors.end(); ++iter) { | |
197 std::string name = UTF16ToUTF8((*iter)->name()); | |
198 file->authors_.push_back(std::make_pair(name, (*iter)->email())); | |
199 } | |
200 const Link* thumbnail_link = doc->GetLinkByType(Link::THUMBNAIL); | |
201 if (thumbnail_link) | |
202 file->thumbnail_url_ = thumbnail_link->href(); | |
203 | |
204 // TODO(gspencer): Add support for reading pinned state from the cache, | |
205 // when the cache code is done. | |
206 | |
191 return file; | 207 return file; |
192 } | 208 } |
193 | 209 |
194 // GDataFile class implementation. | 210 // GDataFile class implementation. |
195 | 211 |
196 GDataFile::GDataFile(GDataDirectory* parent) | 212 GDataFile::GDataFile(GDataDirectory* parent) |
197 : GDataFileBase(parent), kind_(gdata::DocumentEntry::UNKNOWN) { | 213 : GDataFileBase(parent), |
214 kind_(gdata::DocumentEntry::UNKNOWN), | |
215 pinned_state_(PINNED_STATE_NONE) { | |
198 DCHECK(parent); | 216 DCHECK(parent); |
199 } | 217 } |
200 | 218 |
201 GDataFile::~GDataFile() { | 219 GDataFile::~GDataFile() { |
202 } | 220 } |
203 | 221 |
204 GDataFile* GDataFile::AsGDataFile() { | 222 GDataFile* GDataFile::AsGDataFile() { |
205 return this; | 223 return this; |
206 } | 224 } |
207 | 225 |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
607 | 625 |
608 GDataFileSystemFactory::~GDataFileSystemFactory() { | 626 GDataFileSystemFactory::~GDataFileSystemFactory() { |
609 } | 627 } |
610 | 628 |
611 ProfileKeyedService* GDataFileSystemFactory::BuildServiceInstanceFor( | 629 ProfileKeyedService* GDataFileSystemFactory::BuildServiceInstanceFor( |
612 Profile* profile) const { | 630 Profile* profile) const { |
613 return new GDataFileSystem(profile); | 631 return new GDataFileSystem(profile); |
614 } | 632 } |
615 | 633 |
616 } // namespace gdata | 634 } // namespace gdata |
OLD | NEW |