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

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

Issue 9581024: Added proper extensions for hosted documents. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 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_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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 DCHECK(doc->is_hosted_document() || doc->is_file()); 157 DCHECK(doc->is_hosted_document() || doc->is_file());
158 GDataFile* file = new GDataFile(parent); 158 GDataFile* file = new GDataFile(parent);
159 // Check if this entry is a true file, or... 159 // Check if this entry is a true file, or...
160 if (doc->is_file()) { 160 if (doc->is_file()) {
161 file->original_file_name_ = UTF16ToUTF8(doc->filename()); 161 file->original_file_name_ = UTF16ToUTF8(doc->filename());
162 file->file_name_ = 162 file->file_name_ =
163 EscapeFileName(file->original_file_name_); 163 EscapeFileName(file->original_file_name_);
164 file->file_info_.size = doc->file_size(); 164 file->file_info_.size = doc->file_size();
165 file->file_md5_ = doc->file_md5(); 165 file->file_md5_ = doc->file_md5();
166 } else { 166 } else {
167 DCHECK(doc->is_hosted_document());
167 // ... a hosted document. 168 // ... a hosted document.
168 file->original_file_name_ = UTF16ToUTF8(doc->title()); 169 file->original_file_name_ = UTF16ToUTF8(doc->title());
169 // Attach .g<something> extension to hosted documents so we can special 170 // Attach .g<something> extension to hosted documents so we can special
170 // case their handling in UI. 171 // case their handling in UI.
171 // TODO(zelidrag): Figure out better way how to pass entry info like kind 172 // TODO(zelidrag): Figure out better way how to pass entry info like kind
172 // to UI through the File API stack. 173 // to UI through the File API stack.
173 file->file_name_ = EscapeFileName( 174 file->file_name_ = EscapeFileName(
174 base::StringPrintf("%s.g%s", 175 base::StringPrintf("%s%s",
175 file->original_file_name_.c_str(), 176 file->original_file_name_.c_str(),
176 doc->GetEntryKindText().c_str())); 177 doc->GetHostedDocumentExtension().c_str()));
satorux1 2012/03/02 22:13:01 EscapeFileName(file->original_file_name + doc->Get
177 // We don't know the size of hosted docs and it does not matter since 178 // We don't know the size of hosted docs and it does not matter since
178 // is has no effect on the quota. 179 // is has no effect on the quota.
179 file->file_info_.size = 0; 180 file->file_info_.size = 0;
180 } 181 }
181 file->kind_ = doc->kind(); 182 file->kind_ = doc->kind();
182 const Link* self_link = doc->GetLinkByType(Link::SELF); 183 const Link* self_link = doc->GetLinkByType(Link::SELF);
183 if (self_link) 184 if (self_link)
184 file->self_url_ = self_link->href(); 185 file->self_url_ = self_link->href();
185 file->content_url_ = doc->content_url(); 186 file->content_url_ = doc->content_url();
186 file->content_mime_type_ = doc->content_mime_type(); 187 file->content_mime_type_ = doc->content_mime_type();
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
854 855
855 GDataFileSystemFactory::~GDataFileSystemFactory() { 856 GDataFileSystemFactory::~GDataFileSystemFactory() {
856 } 857 }
857 858
858 ProfileKeyedService* GDataFileSystemFactory::BuildServiceInstanceFor( 859 ProfileKeyedService* GDataFileSystemFactory::BuildServiceInstanceFor(
859 Profile* profile) const { 860 Profile* profile) const {
860 return new GDataFileSystem(profile); 861 return new GDataFileSystem(profile);
861 } 862 }
862 863
863 } // namespace gdata 864 } // namespace gdata
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698