Chromium Code Reviews (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out

Unified Diff: ios/chrome/app/spotlight/spotlight_util.h

Issue 2580363002: Upstream Chrome on iOS source code [1/11]. (Closed)
Patch Set: Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/chrome/app/spotlight/ ('k') | ios/chrome/app/spotlight/ » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/app/spotlight/spotlight_util.h
diff --git a/ios/chrome/app/spotlight/spotlight_util.h b/ios/chrome/app/spotlight/spotlight_util.h
new file mode 100644
index 0000000000000000000000000000000000000000..c35592e6a82b3e91d1cf7efe41255444361275f5
--- /dev/null
+++ b/ios/chrome/app/spotlight/spotlight_util.h
@@ -0,0 +1,75 @@
+// Copyright 2015 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.
+#import <UIKit/UIKit.h>
+typedef void (^BlockWithError)(NSError*);
+typedef void (^BlockWithNSURL)(NSURL*);
+namespace spotlight {
+// This enum is used for Histogram. Domains should not be removed or reordered
+// and this enum should be kept synced with histograms.xml.
+// DOMAIN_UNKNOWN may be reported if Spotlight is not synced with chrome and
+// a domain has been removed since last indexation (should not happen in stable
+// channel).
+enum Domain {
+// The key of a custom attribute containing the item ID so the item is
+// searchable using CSSearchQuery.
+NSString* GetSpotlightCustomAttributeItemID();
+// NSUserDefaults key of entry containing date of the latest bookmarks indexing.
+extern const char kSpotlightLastIndexingDateKey[];
+// The current version of the Spotlight index format.
+// Change this value if there are change int the information indexed in
+// Spotlight. This will force reindexation on next startup.
+// Value is stored in |kSpotlightLastIndexingVersionKey|.
+extern const int kCurrentSpotlightIndexVersion;
+// NSUserDefault key of entry containing Chrome version of the latest bookmarks
+// indexing.
+extern const char kSpotlightLastIndexingVersionKey[];
+// Utility methods deleting nodes in Spotlight index. Will be retried in case of
+// failure as required by Apple documentation.
+void DeleteSearchableDomainItems(Domain domain, BlockWithError callback);
+void DeleteItemsWithIdentifiers(NSArray* items, BlockWithError callback);
+void ClearAllSpotlightEntries(BlockWithError callback);
+// Converts the spotlight::Domain enum to Spotlight domain string
+NSString* StringFromSpotlightDomain(Domain domain);
+// Converts the Spotlight domain string to spotlight::Domain enum.
+Domain SpotlightDomainFromString(NSString* domain);
+// Returns whether Spotlight is available on the device. Must be tested before
+// calling other methods of this class.
+bool IsSpotlightAvailable();
+// Clears the current Spotlight index of the device. Method is static to allow
+// clearing the index without instantiating SpotlightManager.
+// This method must not be called if |isSpotlightAvailable| returns NO.
+// This method is asynchronous and can fail. Completion is called with a
+// parameter indicating if the deletion was a success.
+void ClearSpotlightIndexWithCompletion(BlockWithError completion);
+// Finds the Spoglight itemID and calls |completion| with the corresponding URL.
+// Calls |completion| with nil if none was found.
+// |completion| is called on the Spotlight Thread.
+void GetURLForSpotlightItemID(NSString* itemID, BlockWithNSURL completion);
+} // namespace spotlight
« no previous file with comments | « ios/chrome/app/spotlight/ ('k') | ios/chrome/app/spotlight/ » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698