OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "google_apis/drive/request_util.h" | 5 #include "google_apis/drive/request_util.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 | 9 |
10 namespace google_apis { | 10 namespace google_apis { |
11 namespace util { | 11 namespace util { |
12 | 12 |
13 namespace { | 13 namespace { |
14 | 14 |
15 // etag matching header. | 15 // etag matching header. |
16 const char kIfMatchHeaderPrefix[] = "If-Match: "; | 16 const char kIfMatchHeaderPrefix[] = "If-Match: "; |
17 const char kParentLinkKind[] = "drive#fileLink"; | 17 const char kParentLinkKind[] = "drive#fileLink"; |
18 | 18 |
19 } // namespace | 19 } // namespace |
20 | 20 |
21 const char kIfMatchAllHeader[] = "If-Match: *"; | 21 const char kIfMatchAllHeader[] = "If-Match: *"; |
22 const char kContentTypeApplicationJson[] = "application/json"; | 22 const char kContentTypeApplicationJson[] = "application/json"; |
23 | 23 |
24 std::string GenerateIfMatchHeader(const std::string& etag) { | 24 std::string GenerateIfMatchHeader(const std::string& etag) { |
25 return etag.empty() ? kIfMatchAllHeader : (kIfMatchHeaderPrefix + etag); | 25 return etag.empty() ? kIfMatchAllHeader : (kIfMatchHeaderPrefix + etag); |
26 } | 26 } |
27 | 27 |
28 scoped_ptr<base::DictionaryValue> CreateParentValue( | 28 std::unique_ptr<base::DictionaryValue> CreateParentValue( |
29 const std::string& file_id) { | 29 const std::string& file_id) { |
30 scoped_ptr<base::DictionaryValue> parent(new base::DictionaryValue); | 30 std::unique_ptr<base::DictionaryValue> parent(new base::DictionaryValue); |
31 parent->SetString("kind", kParentLinkKind); | 31 parent->SetString("kind", kParentLinkKind); |
32 parent->SetString("id", file_id); | 32 parent->SetString("id", file_id); |
33 return parent; | 33 return parent; |
34 } | 34 } |
35 | 35 |
36 } // namespace util | 36 } // namespace util |
37 } // namespace google_apis | 37 } // namespace google_apis |
OLD | NEW |