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_files.h" | 5 #include "chrome/browser/chromeos/gdata/gdata_files.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "base/platform_file.h" | 8 #include "base/platform_file.h" |
9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
11 #include "chrome/browser/chromeos/gdata/gdata.pb.h" | 11 #include "chrome/browser/chromeos/gdata/gdata.pb.h" |
12 #include "chrome/browser/chromeos/gdata/gdata_parser.h" | 12 #include "chrome/browser/chromeos/gdata/gdata_parser.h" |
13 #include "chrome/browser/chromeos/gdata/gdata_util.h" | 13 #include "chrome/browser/chromeos/gdata/gdata_util.h" |
14 #include "net/base/escape.h" | 14 #include "net/base/escape.h" |
15 | 15 |
16 namespace gdata { | 16 namespace gdata { |
17 namespace { | 17 namespace { |
18 | 18 |
19 const char kSlash[] = "/"; | 19 const char kSlash[] = "/"; |
20 const char kEscapedSlash[] = "\xE2\x88\x95"; | 20 const char kEscapedSlash[] = "\xE2\x88\x95"; |
21 | 21 |
22 // Extracts resource_id out of edit url. | 22 // Extracts resource_id out of edit url. |
23 std::string ExtractResourceId(const GURL& url) { | 23 std::string ExtractResourceId(const GURL& url) { |
24 return net::UnescapeURLComponent(url.ExtractFileName(), | 24 return net::UnescapeURLComponent(url.ExtractFileName(), |
25 net::UnescapeRule::URL_SPECIAL_CHARS); | 25 net::UnescapeRule::URL_SPECIAL_CHARS); |
26 } | 26 } |
27 | 27 |
28 } // namespace | 28 } // namespace |
29 | 29 |
| 30 void ReadOnlyFindEntryCallback(GDataEntry** out, |
| 31 base::PlatformFileError error, |
| 32 GDataEntry* entry) { |
| 33 if (error == base::PLATFORM_FILE_OK) |
| 34 *out = entry; |
| 35 } |
| 36 |
30 // GDataEntry class. | 37 // GDataEntry class. |
31 | 38 |
32 GDataEntry::GDataEntry(GDataDirectory* parent, GDataRootDirectory* root) | 39 GDataEntry::GDataEntry(GDataDirectory* parent, GDataRootDirectory* root) |
33 : root_(root), | 40 : root_(root), |
34 deleted_(false) { | 41 deleted_(false) { |
35 SetParent(parent); | 42 SetParent(parent); |
36 } | 43 } |
37 | 44 |
38 GDataEntry::~GDataEntry() { | 45 GDataEntry::~GDataEntry() { |
39 } | 46 } |
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
772 return false; | 779 return false; |
773 } | 780 } |
774 | 781 |
775 FromProto(proto); | 782 FromProto(proto); |
776 set_origin(FROM_CACHE); | 783 set_origin(FROM_CACHE); |
777 } | 784 } |
778 return ok; | 785 return ok; |
779 } | 786 } |
780 | 787 |
781 } // namespace gdata | 788 } // namespace gdata |
OLD | NEW |