| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/drive/search_metadata.h" | 5 #include "chrome/browser/chromeos/drive/search_metadata.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <queue> | 8 #include <queue> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 entry.file_specific_info().is_hosted_document()) | 82 entry.file_specific_info().is_hosted_document()) |
| 83 return false; | 83 return false; |
| 84 | 84 |
| 85 if ((options & SEARCH_METADATA_EXCLUDE_DIRECTORIES) && | 85 if ((options & SEARCH_METADATA_EXCLUDE_DIRECTORIES) && |
| 86 entry.file_info().is_directory()) | 86 entry.file_info().is_directory()) |
| 87 return false; | 87 return false; |
| 88 | 88 |
| 89 if (options & SEARCH_METADATA_SHARED_WITH_ME) | 89 if (options & SEARCH_METADATA_SHARED_WITH_ME) |
| 90 return entry.shared_with_me(); | 90 return entry.shared_with_me(); |
| 91 | 91 |
| 92 // Exclude "drive", "drive/root", and "drive/other". |
| 93 if (entry.resource_id() == util::kDriveGrandRootSpecialResourceId || |
| 94 entry.parent_resource_id() == util::kDriveGrandRootSpecialResourceId) { |
| 95 return false; |
| 96 } |
| 97 |
| 92 return true; | 98 return true; |
| 93 } | 99 } |
| 94 | 100 |
| 95 } // namespace | 101 } // namespace |
| 96 | 102 |
| 97 // Helper class for searching the local resource metadata. | 103 // Helper class for searching the local resource metadata. |
| 98 class SearchMetadataHelper { | 104 class SearchMetadataHelper { |
| 99 public: | 105 public: |
| 100 SearchMetadataHelper(DriveResourceMetadata* resource_metadata, | 106 SearchMetadataHelper(DriveResourceMetadata* resource_metadata, |
| 101 const std::string& query, | 107 const std::string& query, |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 if (num_matches == 0) | 261 if (num_matches == 0) |
| 256 return false; | 262 return false; |
| 257 | 263 |
| 258 std::string remaining_piece = text.substr(cursor); | 264 std::string remaining_piece = text.substr(cursor); |
| 259 highlighted_text->append(net::EscapeForHTML(remaining_piece)); | 265 highlighted_text->append(net::EscapeForHTML(remaining_piece)); |
| 260 | 266 |
| 261 return true; | 267 return true; |
| 262 } | 268 } |
| 263 | 269 |
| 264 } // namespace drive | 270 } // namespace drive |
| OLD | NEW |