blob: 62cca4965dd642488973649ff0a145f4b3174c37 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_CHROMEOS_DRIVE_SEARCH_METADATA_H_
#define CHROME_BROWSER_CHROMEOS_DRIVE_SEARCH_METADATA_H_
#include <string>
#include <vector>
#include "chrome/browser/chromeos/drive/file_system_interface.h"
namespace drive {
namespace internal {
class FileCache;
class ResourceMetadata;
// Searches the local resource metadata, and returns the entries
// |at_most_num_matches| that contain |query| in their base names. Search is
// done in a case-insensitive fashion. The eligible entries are selected based
// on the given |options|, which is a bit-wise OR of SearchMetadataOptions.
// |callback| must not be null. Must be called on UI thread. Empty |query|
// matches any base name. i.e. returns everything. |blocking_task_runner| must
// be the same one as |resource_metadata| uses.
void SearchMetadata(
scoped_refptr<base::SequencedTaskRunner> blocking_task_runner,
ResourceMetadata* resource_metadata,
FileCache* cache,
const std::string& query,
int search_options,
int at_most_num_matches,
const SearchMetadataCallback& callback);
// Finds |query| in |text| while ignoring cases or accents. Cases of non-ASCII
// characters are also ignored; they are compared in the 'Primary Level' of
// http://userguide.icu-project.org/collation/concepts.
// Returns true if |query| is found. |highlighted_text| will have the original
// text with matched portions highlighted with <b> tag (only the first match
// is highlighted). Meta characters are escaped like <. The original
// contents of |highlighted| will be lost.
bool FindAndHighlight(const std::string& text,
const std::string& query,
std::string* highlighted_text);
} // namespace internal
} // namespace drive
#endif // CHROME_BROWSER_CHROMEOS_DRIVE_SEARCH_METADATA_H_
|