Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: chrome/browser/chromeos/drive/search_metadata.h

Issue 12229002: Misc cleanups in Drive code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_SEARCH_METADATA_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_SEARCH_METADATA_H_
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_SEARCH_METADATA_H_ 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_SEARCH_METADATA_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "chrome/browser/chromeos/drive/drive_file_system_interface.h" 11 #include "chrome/browser/chromeos/drive/drive_file_system_interface.h"
hashimoto 2013/02/08 11:42:21 This include can be replaced with following includ
kinaba 2013/02/12 03:38:07 We also need fwd declaration of DriveFileSystemInt
12 12
13 namespace drive { 13 namespace drive {
14 14
15 // Struct to represent a search result for SearchMetadata(). 15 // Struct to represent a search result for SearchMetadata().
16 struct MetadataSearchResult { 16 struct MetadataSearchResult {
17 MetadataSearchResult(const FilePath& in_path, 17 MetadataSearchResult(const FilePath& in_path,
18 const DriveEntryProto& in_entry_proto, 18 const DriveEntryProto& in_entry_proto,
19 const std::string& in_highlighted_base_name) 19 const std::string& in_highlighted_base_name)
20 : path(in_path), 20 : path(in_path),
21 entry_proto(in_entry_proto), 21 entry_proto(in_entry_proto),
22 highlighted_base_name(in_highlighted_base_name) { 22 highlighted_base_name(in_highlighted_base_name) {
23 } 23 }
24 24
25 // The two members are used to create FileEntry object. 25 // The two members are used to create FileEntry object.
26 FilePath path; 26 FilePath path;
27 DriveEntryProto entry_proto; 27 DriveEntryProto entry_proto;
28 28
29 // The base name to be displayed in the UI. The parts matched the search 29 // The base name to be displayed in the UI. The parts matched the search
30 // query are highlited with <b> tag. Meta characters are escaped like &lt; 30 // query are highlighted with <b> tag. Meta characters are escaped like &lt;
31 // 31 //
32 // Why HTML? we could instead provide matched ranges using pairs of 32 // Why HTML? we could instead provide matched ranges using pairs of
33 // integers, but this is fragile as we'll eventually converting strings 33 // integers, but this is fragile as we'll eventually converting strings
34 // from UTF-8 (StringValue in base/values.h uses std::string) to UTF-16 34 // from UTF-8 (StringValue in base/values.h uses std::string) to UTF-16
35 // when sending strings from C++ to JavaSCript. 35 // when sending strings from C++ to JavaSCript.
36 // 36 //
37 // Why <b> instead of <strong>? Because <b> is shorter. 37 // Why <b> instead of <strong>? Because <b> is shorter.
38 std::string highlighted_base_name; 38 std::string highlighted_base_name;
39 }; 39 };
40 40
(...skipping 19 matching lines...) Expand all
60 // will have the original text with matched portions highlighted with <b> tag 60 // will have the original text with matched portions highlighted with <b> tag
61 // (multiple portions can be highlighted). Meta characters are escaped like 61 // (multiple portions can be highlighted). Meta characters are escaped like
62 // &lt;. The original contents of |highlighted| will be lost. 62 // &lt;. The original contents of |highlighted| will be lost.
63 bool FindAndHighlight(const std::string& text, 63 bool FindAndHighlight(const std::string& text,
64 const std::string& query, 64 const std::string& query,
65 std::string* highlighted_text); 65 std::string* highlighted_text);
66 66
67 } // namespace drive 67 } // namespace drive
68 68
69 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_SEARCH_METADATA_H_ 69 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_SEARCH_METADATA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698