Chromium Code Reviews| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 111 return entry.shared_with_me(); | 111 return entry.shared_with_me(); |
| 112 | 112 |
| 113 if (options & SEARCH_METADATA_OFFLINE) { | 113 if (options & SEARCH_METADATA_OFFLINE) { |
| 114 if (entry.file_specific_info().is_hosted_document()) | 114 if (entry.file_specific_info().is_hosted_document()) |
| 115 return true; | 115 return true; |
| 116 FileCacheEntry cache_entry; | 116 FileCacheEntry cache_entry; |
| 117 it->GetCacheEntry(&cache_entry); | 117 it->GetCacheEntry(&cache_entry); |
| 118 return cache_entry.is_present(); | 118 return cache_entry.is_present(); |
| 119 } | 119 } |
| 120 | 120 |
| 121 // Exclude "drive", "drive/root", and "drive/other". | 121 // Exclude "drive", "drive/root", "drive/other", "drive/trash" and its |
| 122 // children. | |
| 122 if (it->GetID() == util::kDriveGrandRootLocalId || | 123 if (it->GetID() == util::kDriveGrandRootLocalId || |
| 123 entry.parent_local_id() == util::kDriveGrandRootLocalId) { | 124 entry.parent_local_id() == util::kDriveGrandRootLocalId || |
| 125 entry.parent_local_id() == util::kDriveTrashDirLocalId) { | |
|
kinaba
2013/11/12 02:10:27
Is looking only the parent sufficient (i.e., what
hashimoto
2013/11/12 04:08:13
Hmm, recursively looking up parent does not look e
| |
| 124 return false; | 126 return false; |
| 125 } | 127 } |
| 126 | 128 |
| 127 return true; | 129 return true; |
| 128 } | 130 } |
| 129 | 131 |
| 130 // Used to implement SearchMetadata. | 132 // Used to implement SearchMetadata. |
| 131 // Adds entry to the result when appropriate. | 133 // Adds entry to the result when appropriate. |
| 132 // In particular, if |query| is non-null, only adds files with the name matching | 134 // In particular, if |query| is non-null, only adds files with the name matching |
| 133 // the query. | 135 // the query. |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 271 highlighted_text->append(net::EscapeForHTML(base::UTF16ToUTF8(pre))); | 273 highlighted_text->append(net::EscapeForHTML(base::UTF16ToUTF8(pre))); |
| 272 highlighted_text->append("<b>"); | 274 highlighted_text->append("<b>"); |
| 273 highlighted_text->append(net::EscapeForHTML(base::UTF16ToUTF8(match))); | 275 highlighted_text->append(net::EscapeForHTML(base::UTF16ToUTF8(match))); |
| 274 highlighted_text->append("</b>"); | 276 highlighted_text->append("</b>"); |
| 275 highlighted_text->append(net::EscapeForHTML(base::UTF16ToUTF8(post))); | 277 highlighted_text->append(net::EscapeForHTML(base::UTF16ToUTF8(post))); |
| 276 return true; | 278 return true; |
| 277 } | 279 } |
| 278 | 280 |
| 279 } // namespace internal | 281 } // namespace internal |
| 280 } // namespace drive | 282 } // namespace drive |
| OLD | NEW |