OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "chrome/browser/chromeos/extensions/file_manager/private_api_drive.h" | 5 #include "chrome/browser/chromeos/extensions/file_manager/private_api_drive.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/chromeos/drive/drive_integration_service.h" | 9 #include "chrome/browser/chromeos/drive/drive_integration_service.h" |
10 #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h" | 10 #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
90 } | 90 } |
91 properties->is_hosted.reset( | 91 properties->is_hosted.reset( |
92 new bool(file_specific_info.is_hosted_document())); | 92 new bool(file_specific_info.is_hosted_document())); |
93 properties->content_mime_type.reset( | 93 properties->content_mime_type.reset( |
94 new std::string(file_specific_info.content_mime_type())); | 94 new std::string(file_specific_info.content_mime_type())); |
95 | 95 |
96 properties->is_pinned.reset( | 96 properties->is_pinned.reset( |
97 new bool(file_specific_info.cache_state().is_pinned())); | 97 new bool(file_specific_info.cache_state().is_pinned())); |
98 properties->is_present.reset( | 98 properties->is_present.reset( |
99 new bool(file_specific_info.cache_state().is_present())); | 99 new bool(file_specific_info.cache_state().is_present())); |
100 | |
101 if (file_specific_info.cache_state().is_present()) { | |
102 properties->is_available_offline.reset(new bool(true)); | |
103 } else if (file_specific_info.is_hosted_document() && | |
104 file_specific_info.has_document_extension()) { | |
105 const std::string file_extension = file_specific_info.document_extension(); | |
106 // What's available offline? See the 'Web' column at: | |
107 // http://support.google.com/drive/answer/1628467 | |
108 properties->is_available_offline.reset( | |
109 new bool(file_extension == ".gdoc" || file_extension == ".gdraw" || | |
110 file_extension == ".gsheet" || file_extension == ".gslides")); | |
yoshiki
2014/09/01 02:41:04
(maybe out of this patch's work)
I think we shoul
mtomasz
2014/09/01 02:43:53
Good idea. Let me do it in a separate CL.
| |
111 } else { | |
112 properties->is_available_offline.reset(new bool(false)); | |
113 } | |
114 | |
115 properties->is_available_when_metered.reset( | |
116 new bool(file_specific_info.cache_state().is_present() || | |
117 file_specific_info.is_hosted_document())); | |
100 } | 118 } |
101 | 119 |
102 // Creates entry definition list for (metadata) search result info list. | 120 // Creates entry definition list for (metadata) search result info list. |
103 template <class T> | 121 template <class T> |
104 void ConvertSearchResultInfoListToEntryDefinitionList( | 122 void ConvertSearchResultInfoListToEntryDefinitionList( |
105 Profile* profile, | 123 Profile* profile, |
106 const std::string& extension_id, | 124 const std::string& extension_id, |
107 const std::vector<T>& search_result_info_list, | 125 const std::vector<T>& search_result_info_list, |
108 const EntryDefinitionListCallback& callback) { | 126 const EntryDefinitionListCallback& callback) { |
109 FileDefinitionList file_definition_list; | 127 FileDefinitionList file_definition_list; |
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
975 return; | 993 return; |
976 } | 994 } |
977 | 995 |
978 const std::string url = download_url_ + "?access_token=" + access_token; | 996 const std::string url = download_url_ + "?access_token=" + access_token; |
979 SetResult(new base::StringValue(url)); | 997 SetResult(new base::StringValue(url)); |
980 | 998 |
981 SendResponse(true); | 999 SendResponse(true); |
982 } | 1000 } |
983 | 1001 |
984 } // namespace extensions | 1002 } // namespace extensions |
OLD | NEW |