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

Side by Side Diff: chrome/browser/chromeos/extensions/file_browser_private_api.cc

Issue 12211005: fix build with enable_web_intents=0 on chromeos (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: test Created 7 years, 10 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
« no previous file with comments | « chrome/browser/chromeos/extensions/file_browser_private_api.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/extensions/file_browser_private_api.h" 5 #include "chrome/browser/chromeos/extensions/file_browser_private_api.h"
6 6
7 #include <sys/stat.h> 7 #include <sys/stat.h>
8 #include <sys/statvfs.h> 8 #include <sys/statvfs.h>
9 #include <sys/types.h> 9 #include <sys/types.h>
10 #include <utime.h> 10 #include <utime.h>
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 if (icons.empty()) 257 if (icons.empty())
258 return result; 258 return result;
259 result = icons.rbegin()->second; 259 result = icons.rbegin()->second;
260 for (InstalledApp::IconList::const_reverse_iterator iter = icons.rbegin(); 260 for (InstalledApp::IconList::const_reverse_iterator iter = icons.rbegin();
261 iter != icons.rend() && iter->first >= preferred_size; ++iter) { 261 iter != icons.rend() && iter->first >= preferred_size; ++iter) {
262 result = iter->second; 262 result = iter->second;
263 } 263 }
264 return result; 264 return result;
265 } 265 }
266 266
267 #if defined(ENABLE_WEB_INTENTS)
267 // Finds the title of the given Web Intents |action|, if the passed extension 268 // Finds the title of the given Web Intents |action|, if the passed extension
268 // supports this action for all specified |mime_types|. Returns true and 269 // supports this action for all specified |mime_types|. Returns true and
269 // provides the |title| as output on success. 270 // provides the |title| as output on success.
270 bool FindTitleForActionWithTypes( 271 bool FindTitleForActionWithTypes(
271 const Extension* extension, 272 const Extension* extension,
272 const std::string& action, 273 const std::string& action,
273 const std::set<std::string>& mime_types, 274 const std::set<std::string>& mime_types,
274 std::string* title) { 275 std::string* title) {
275 DCHECK(!mime_types.empty()); 276 DCHECK(!mime_types.empty());
276 std::set<std::string> pending(mime_types.begin(), mime_types.end()); 277 std::set<std::string> pending(mime_types.begin(), mime_types.end());
(...skipping 19 matching lines...) Expand all
296 found_title = UTF16ToUTF8(data->title); 297 found_title = UTF16ToUTF8(data->title);
297 } 298 }
298 299
299 // Not all mime-types have been found. 300 // Not all mime-types have been found.
300 if (!pending.empty()) 301 if (!pending.empty())
301 return false; 302 return false;
302 303
303 *title = found_title; 304 *title = found_title;
304 return true; 305 return true;
305 } 306 }
307 #endif // defined(ENABLE_WEB_INTENTS)
306 308
307 // Retrieves total and remaining available size on |mount_path|. 309 // Retrieves total and remaining available size on |mount_path|.
308 void GetSizeStatsOnFileThread(const std::string& mount_path, 310 void GetSizeStatsOnFileThread(const std::string& mount_path,
309 size_t* total_size_kb, 311 size_t* total_size_kb,
310 size_t* remaining_size_kb) { 312 size_t* remaining_size_kb) {
311 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 313 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
312 314
313 uint64_t total_size_in_bytes = 0; 315 uint64_t total_size_in_bytes = 0;
314 uint64_t remaining_size_in_bytes = 0; 316 uint64_t remaining_size_in_bytes = 0;
315 317
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
971 task->SetString("iconUrl", kDefaultIcon); 973 task->SetString("iconUrl", kDefaultIcon);
972 974
973 task->SetBoolean("driveApp", false); 975 task->SetBoolean("driveApp", false);
974 result_list->Append(task); 976 result_list->Append(task);
975 } 977 }
976 } 978 }
977 979
978 return true; 980 return true;
979 } 981 }
980 982
983 #if defined(ENABLE_WEB_INTENTS)
981 // Find Web Intent platform apps that support the View task, and add them to 984 // Find Web Intent platform apps that support the View task, and add them to
982 // the |result_list|. These will be marked as kTaskWebIntent. 985 // the |result_list|. These will be marked as kTaskWebIntent.
983 bool GetFileTasksFileBrowserFunction::FindWebIntentTasks( 986 bool GetFileTasksFileBrowserFunction::FindWebIntentTasks(
984 const std::vector<FilePath>& file_paths, 987 const std::vector<FilePath>& file_paths,
985 ListValue* result_list) { 988 ListValue* result_list) {
986 DCHECK(!file_paths.empty()); 989 DCHECK(!file_paths.empty());
987 ExtensionService* service = profile_->GetExtensionService(); 990 ExtensionService* service = profile_->GetExtensionService();
988 if (!service) 991 if (!service)
989 return false; 992 return false;
990 993
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1022 task->SetString("iconUrl", best_icon.spec()); 1025 task->SetString("iconUrl", best_icon.spec());
1023 else 1026 else
1024 task->SetString("iconUrl", kDefaultIcon); 1027 task->SetString("iconUrl", kDefaultIcon);
1025 1028
1026 task->SetBoolean("driveApp", false); 1029 task->SetBoolean("driveApp", false);
1027 result_list->Append(task); 1030 result_list->Append(task);
1028 } 1031 }
1029 1032
1030 return true; 1033 return true;
1031 } 1034 }
1035 #endif // defined(ENABLE_WEB_INTENTS)
1032 1036
1033 bool GetFileTasksFileBrowserFunction::RunImpl() { 1037 bool GetFileTasksFileBrowserFunction::RunImpl() {
1034 // First argument is the list of files to get tasks for. 1038 // First argument is the list of files to get tasks for.
1035 ListValue* files_list = NULL; 1039 ListValue* files_list = NULL;
1036 if (!args_->GetList(0, &files_list)) 1040 if (!args_->GetList(0, &files_list))
1037 return false; 1041 return false;
1038 1042
1039 // Second argument is the list of mime types of each of the files in the list. 1043 // Second argument is the list of mime types of each of the files in the list.
1040 ListValue* mime_types_list = NULL; 1044 ListValue* mime_types_list = NULL;
1041 if (!args_->GetList(1, &mime_types_list)) 1045 if (!args_->GetList(1, &mime_types_list))
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 result_list->Append(task); 1142 result_list->Append(task);
1139 } 1143 }
1140 1144
1141 // Take the union of platform app file handlers, Web Intents that platform 1145 // Take the union of platform app file handlers, Web Intents that platform
1142 // apps may accept, and all previous Drive and extension tasks. As above, we 1146 // apps may accept, and all previous Drive and extension tasks. As above, we
1143 // know there aren't duplicates because they're entirely different kinds of 1147 // know there aren't duplicates because they're entirely different kinds of
1144 // tasks. 1148 // tasks.
1145 if (!FindAppTasks(file_paths, result_list)) 1149 if (!FindAppTasks(file_paths, result_list))
1146 return false; 1150 return false;
1147 1151
1152 #if defined(ENABLE_WEB_INTENTS)
1148 // TODO(benwells): remove the web intents tasks once we no longer support 1153 // TODO(benwells): remove the web intents tasks once we no longer support
1149 // them. 1154 // them.
1150 if (!FindWebIntentTasks(file_paths, result_list)) 1155 if (!FindWebIntentTasks(file_paths, result_list))
1151 return false; 1156 return false;
1157 #endif
1152 1158
1153 if (VLOG_IS_ON(1)) { 1159 if (VLOG_IS_ON(1)) {
1154 std::string result_json; 1160 std::string result_json;
1155 base::JSONWriter::WriteWithOptions( 1161 base::JSONWriter::WriteWithOptions(
1156 result_list, 1162 result_list,
1157 base::JSONWriter::OPTIONS_DO_NOT_ESCAPE | 1163 base::JSONWriter::OPTIONS_DO_NOT_ESCAPE |
1158 base::JSONWriter::OPTIONS_PRETTY_PRINT, 1164 base::JSONWriter::OPTIONS_PRETTY_PRINT,
1159 &result_json); 1165 &result_json);
1160 VLOG(1) << "GetFileTasks result:\n" << result_json; 1166 VLOG(1) << "GetFileTasks result:\n" << result_json;
1161 } 1167 }
(...skipping 2040 matching lines...) Expand 10 before | Expand all | Expand 10 after
3202 this, name.size())); 3208 this, name.size()));
3203 return true; 3209 return true;
3204 } 3210 }
3205 3211
3206 void ValidatePathNameLengthFunction::OnFilePathLimitRetrieved( 3212 void ValidatePathNameLengthFunction::OnFilePathLimitRetrieved(
3207 size_t current_length, 3213 size_t current_length,
3208 size_t max_length) { 3214 size_t max_length) {
3209 SetResult(new base::FundamentalValue(current_length <= max_length)); 3215 SetResult(new base::FundamentalValue(current_length <= max_length));
3210 SendResponse(true); 3216 SendResponse(true);
3211 } 3217 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/extensions/file_browser_private_api.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698