| 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" |
| 11 #include "base/i18n/string_search.h" | 11 #include "base/i18n/string_search.h" |
| 12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 15 #include "chrome/browser/chromeos/drive/file_system_util.h" | 15 #include "chrome/browser/chromeos/drive/file_system_util.h" |
| 16 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
| 17 #include "google_apis/drive/gdata_wapi_parser.h" | 17 #include "google_apis/drive/drive_entry_kinds.h" |
| 18 #include "net/base/escape.h" | 18 #include "net/base/escape.h" |
| 19 | 19 |
| 20 using content::BrowserThread; | 20 using content::BrowserThread; |
| 21 | 21 |
| 22 namespace drive { | 22 namespace drive { |
| 23 namespace internal { | 23 namespace internal { |
| 24 | 24 |
| 25 namespace { | 25 namespace { |
| 26 | 26 |
| 27 struct ResultCandidate { | 27 struct ResultCandidate { |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 entry.file_info().is_directory()) | 159 entry.file_info().is_directory()) |
| 160 return false; | 160 return false; |
| 161 | 161 |
| 162 if (options & SEARCH_METADATA_SHARED_WITH_ME) | 162 if (options & SEARCH_METADATA_SHARED_WITH_ME) |
| 163 return entry.shared_with_me(); | 163 return entry.shared_with_me(); |
| 164 | 164 |
| 165 if (options & SEARCH_METADATA_OFFLINE) { | 165 if (options & SEARCH_METADATA_OFFLINE) { |
| 166 if (entry.file_specific_info().is_hosted_document()) { | 166 if (entry.file_specific_info().is_hosted_document()) { |
| 167 // Not all hosted documents are cached by Drive offline app. | 167 // Not all hosted documents are cached by Drive offline app. |
| 168 // http://support.google.com/drive/bin/answer.py?hl=en&answer=1628467 | 168 // http://support.google.com/drive/bin/answer.py?hl=en&answer=1628467 |
| 169 switch (google_apis::ResourceEntry::GetEntryKindFromExtension( | 169 switch (google_apis::GetEntryKindFromExtension( |
| 170 entry.file_specific_info().document_extension())) { | 170 entry.file_specific_info().document_extension())) { |
| 171 case google_apis::ENTRY_KIND_DOCUMENT: | 171 case google_apis::ENTRY_KIND_DOCUMENT: |
| 172 case google_apis::ENTRY_KIND_SPREADSHEET: | 172 case google_apis::ENTRY_KIND_SPREADSHEET: |
| 173 case google_apis::ENTRY_KIND_PRESENTATION: | 173 case google_apis::ENTRY_KIND_PRESENTATION: |
| 174 case google_apis::ENTRY_KIND_DRAWING: | 174 case google_apis::ENTRY_KIND_DRAWING: |
| 175 return true; | 175 return true; |
| 176 default: | 176 default: |
| 177 return false; | 177 return false; |
| 178 } | 178 } |
| 179 } else { | 179 } else { |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 highlighted_text->append(net::EscapeForHTML(base::UTF16ToUTF8(pre))); | 351 highlighted_text->append(net::EscapeForHTML(base::UTF16ToUTF8(pre))); |
| 352 highlighted_text->append("<b>"); | 352 highlighted_text->append("<b>"); |
| 353 highlighted_text->append(net::EscapeForHTML(base::UTF16ToUTF8(match))); | 353 highlighted_text->append(net::EscapeForHTML(base::UTF16ToUTF8(match))); |
| 354 highlighted_text->append("</b>"); | 354 highlighted_text->append("</b>"); |
| 355 highlighted_text->append(net::EscapeForHTML(base::UTF16ToUTF8(post))); | 355 highlighted_text->append(net::EscapeForHTML(base::UTF16ToUTF8(post))); |
| 356 return true; | 356 return true; |
| 357 } | 357 } |
| 358 | 358 |
| 359 } // namespace internal | 359 } // namespace internal |
| 360 } // namespace drive | 360 } // namespace drive |
| OLD | NEW |