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_util.h" | 5 #include "chrome/browser/chromeos/gdata/gdata_util.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 } | 74 } |
75 | 75 |
76 void GetHostedDocumentURLBlockingThread(const FilePath& gdata_cache_path, | 76 void GetHostedDocumentURLBlockingThread(const FilePath& gdata_cache_path, |
77 GURL* url) { | 77 GURL* url) { |
78 std::string json; | 78 std::string json; |
79 if (!file_util::ReadFileToString(gdata_cache_path, &json)) { | 79 if (!file_util::ReadFileToString(gdata_cache_path, &json)) { |
80 NOTREACHED() << "Unable to read file " << gdata_cache_path.value(); | 80 NOTREACHED() << "Unable to read file " << gdata_cache_path.value(); |
81 return; | 81 return; |
82 } | 82 } |
83 DVLOG(1) << "Hosted doc content " << json; | 83 DVLOG(1) << "Hosted doc content " << json; |
84 scoped_ptr<base::Value> val(base::JSONReader::Read(json, false)); | 84 scoped_ptr<base::Value> val(base::JSONReader::Read(json)); |
85 base::DictionaryValue* dict_val; | 85 base::DictionaryValue* dict_val; |
86 if (!val.get() || !val->GetAsDictionary(&dict_val)) { | 86 if (!val.get() || !val->GetAsDictionary(&dict_val)) { |
87 NOTREACHED() << "Parse failure for " << json; | 87 NOTREACHED() << "Parse failure for " << json; |
88 return; | 88 return; |
89 } | 89 } |
90 std::string edit_url; | 90 std::string edit_url; |
91 if (!dict_val->GetString("url", &edit_url)) { | 91 if (!dict_val->GetString("url", &edit_url)) { |
92 NOTREACHED() << "url field doesn't exist in " << json; | 92 NOTREACHED() << "url field doesn't exist in " << json; |
93 return; | 93 return; |
94 } | 94 } |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 // --disable-gdata or enterprise policy, or probably with user settings too | 242 // --disable-gdata or enterprise policy, or probably with user settings too |
243 // in the future. | 243 // in the future. |
244 if (profile->GetPrefs()->GetBoolean(prefs::kDisableGData)) | 244 if (profile->GetPrefs()->GetBoolean(prefs::kDisableGData)) |
245 return false; | 245 return false; |
246 | 246 |
247 return true; | 247 return true; |
248 } | 248 } |
249 | 249 |
250 } // namespace util | 250 } // namespace util |
251 } // namespace gdata | 251 } // namespace gdata |
OLD | NEW |