Chromium Code Reviews| 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; | |
|
hashimoto
2013/04/10 09:32:40
How about DCHECK_EQ("ALL", types_)?
Haruki Sato
2013/04/10 09:43:56
You mean an else case to check it?
Done. Thanks.
| |
| 3073 | |
| 3068 system_service->file_system()->SearchMetadata( | 3074 system_service->file_system()->SearchMetadata( |
| 3069 query_, | 3075 query_, |
| 3070 types_ == "EXCLUDE_DIRECTORIES" ? | 3076 options, |
| 3071 drive::SEARCH_METADATA_EXCLUDE_DIRECTORIES : | |
| 3072 drive::SEARCH_METADATA_ALL, | |
| 3073 max_results_, | 3077 max_results_, |
| 3074 base::Bind(&SearchDriveMetadataFunction::OnSearchMetadata, this)); | 3078 base::Bind(&SearchDriveMetadataFunction::OnSearchMetadata, this)); |
| 3075 } | 3079 } |
| 3076 | 3080 |
| 3077 void SearchDriveMetadataFunction::OnSearchMetadata( | 3081 void SearchDriveMetadataFunction::OnSearchMetadata( |
| 3078 drive::DriveFileError error, | 3082 drive::DriveFileError error, |
| 3079 scoped_ptr<drive::MetadataSearchResultVector> results) { | 3083 scoped_ptr<drive::MetadataSearchResultVector> results) { |
| 3080 if (error != drive::DRIVE_FILE_OK) { | 3084 if (error != drive::DRIVE_FILE_OK) { |
| 3081 SendResponse(false); | 3085 SendResponse(false); |
| 3082 return; | 3086 return; |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3328 OpenNewWindowFunction::OpenNewWindowFunction() {} | 3332 OpenNewWindowFunction::OpenNewWindowFunction() {} |
| 3329 | 3333 |
| 3330 OpenNewWindowFunction::~OpenNewWindowFunction() {} | 3334 OpenNewWindowFunction::~OpenNewWindowFunction() {} |
| 3331 | 3335 |
| 3332 bool OpenNewWindowFunction::RunImpl() { | 3336 bool OpenNewWindowFunction::RunImpl() { |
| 3333 std::string url; | 3337 std::string url; |
| 3334 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &url)); | 3338 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &url)); |
| 3335 file_manager_util::OpenNewWindow(profile_, GURL(url)); | 3339 file_manager_util::OpenNewWindow(profile_, GURL(url)); |
| 3336 return true; | 3340 return true; |
| 3337 } | 3341 } |
| OLD | NEW |