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/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 3047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3058 file_system_url_ = file_system_url; | 3058 file_system_url_ = file_system_url; |
3059 | 3059 |
3060 drive::DriveSystemService* system_service = | 3060 drive::DriveSystemService* system_service = |
3061 drive::DriveSystemServiceFactory::GetForProfile(profile_); | 3061 drive::DriveSystemServiceFactory::GetForProfile(profile_); |
3062 // |system_service| is NULL if Drive is disabled. | 3062 // |system_service| is NULL if Drive is disabled. |
3063 if (!system_service || !system_service->file_system()) { | 3063 if (!system_service || !system_service->file_system()) { |
3064 SendResponse(false); | 3064 SendResponse(false); |
3065 return; | 3065 return; |
3066 } | 3066 } |
3067 | 3067 |
| 3068 int options = drive::SEARCH_METADATA_ALL; |
| 3069 if (types_ == "EXCLUDE_DIRECTORIES") |
| 3070 options = drive::SEARCH_METADATA_EXCLUDE_DIRECTORIES; |
| 3071 else if (types_ == "SHARED_WITH_ME") |
| 3072 options = drive::SEARCH_METADATA_SHARED_WITH_ME; |
| 3073 else |
| 3074 DCHECK_EQ("ALL", types_); |
| 3075 |
3068 system_service->file_system()->SearchMetadata( | 3076 system_service->file_system()->SearchMetadata( |
3069 query_, | 3077 query_, |
3070 types_ == "EXCLUDE_DIRECTORIES" ? | 3078 options, |
3071 drive::SEARCH_METADATA_EXCLUDE_DIRECTORIES : | |
3072 drive::SEARCH_METADATA_ALL, | |
3073 max_results_, | 3079 max_results_, |
3074 base::Bind(&SearchDriveMetadataFunction::OnSearchMetadata, this)); | 3080 base::Bind(&SearchDriveMetadataFunction::OnSearchMetadata, this)); |
3075 } | 3081 } |
3076 | 3082 |
3077 void SearchDriveMetadataFunction::OnSearchMetadata( | 3083 void SearchDriveMetadataFunction::OnSearchMetadata( |
3078 drive::DriveFileError error, | 3084 drive::DriveFileError error, |
3079 scoped_ptr<drive::MetadataSearchResultVector> results) { | 3085 scoped_ptr<drive::MetadataSearchResultVector> results) { |
3080 if (error != drive::DRIVE_FILE_OK) { | 3086 if (error != drive::DRIVE_FILE_OK) { |
3081 SendResponse(false); | 3087 SendResponse(false); |
3082 return; | 3088 return; |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3328 OpenNewWindowFunction::OpenNewWindowFunction() {} | 3334 OpenNewWindowFunction::OpenNewWindowFunction() {} |
3329 | 3335 |
3330 OpenNewWindowFunction::~OpenNewWindowFunction() {} | 3336 OpenNewWindowFunction::~OpenNewWindowFunction() {} |
3331 | 3337 |
3332 bool OpenNewWindowFunction::RunImpl() { | 3338 bool OpenNewWindowFunction::RunImpl() { |
3333 std::string url; | 3339 std::string url; |
3334 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &url)); | 3340 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &url)); |
3335 file_manager_util::OpenNewWindow(profile_, GURL(url)); | 3341 file_manager_util::OpenNewWindow(profile_, GURL(url)); |
3336 return true; | 3342 return true; |
3337 } | 3343 } |
OLD | NEW |