OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #import "ios/chrome/app/spotlight/bookmarks_spotlight_manager.h" | 5 #import "ios/chrome/app/spotlight/bookmarks_spotlight_manager.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #import <CoreSpotlight/CoreSpotlight.h> | 9 #import <CoreSpotlight/CoreSpotlight.h> |
10 | 10 |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 [self refreshNodeInIndex:node->GetChild(child) initial:initial]; | 282 [self refreshNodeInIndex:node->GetChild(child) initial:initial]; |
283 } | 283 } |
284 } | 284 } |
285 | 285 |
286 - (NSArray*)spotlightItemsWithURL:(const GURL&)URL | 286 - (NSArray*)spotlightItemsWithURL:(const GURL&)URL |
287 favicon:(UIImage*)favicon | 287 favicon:(UIImage*)favicon |
288 defaultTitle:(NSString*)defaultTitle { | 288 defaultTitle:(NSString*)defaultTitle { |
289 NSMutableDictionary* spotlightItems = [[NSMutableDictionary alloc] init]; | 289 NSMutableDictionary* spotlightItems = [[NSMutableDictionary alloc] init]; |
290 std::vector<const bookmarks::BookmarkNode*> nodes; | 290 std::vector<const bookmarks::BookmarkNode*> nodes; |
291 _bookmarkModel->GetNodesByURL(URL, &nodes); | 291 _bookmarkModel->GetNodesByURL(URL, &nodes); |
292 for (auto node : nodes) { | 292 for (auto* node : nodes) { |
293 NSString* nodeTitle = base::SysUTF16ToNSString(node->GetTitle()); | 293 NSString* nodeTitle = base::SysUTF16ToNSString(node->GetTitle()); |
294 NSString* spotlightID = [self spotlightIDForURL:URL title:nodeTitle]; | 294 NSString* spotlightID = [self spotlightIDForURL:URL title:nodeTitle]; |
295 CSSearchableItem* item = [spotlightItems objectForKey:spotlightID]; | 295 CSSearchableItem* item = [spotlightItems objectForKey:spotlightID]; |
296 if (!item) { | 296 if (!item) { |
297 item = [[super spotlightItemsWithURL:URL | 297 item = [[super spotlightItemsWithURL:URL |
298 favicon:favicon | 298 favicon:favicon |
299 defaultTitle:nodeTitle] objectAtIndex:0]; | 299 defaultTitle:nodeTitle] objectAtIndex:0]; |
300 } | 300 } |
301 NSMutableArray* nodeKeywords = [[NSMutableArray alloc] init]; | 301 NSMutableArray* nodeKeywords = [[NSMutableArray alloc] init]; |
302 [self getParentKeywordsForNode:node inArray:nodeKeywords]; | 302 [self getParentKeywordsForNode:node inArray:nodeKeywords]; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 spotlight::kCurrentSpotlightIndexVersion] | 337 spotlight::kCurrentSpotlightIndexVersion] |
338 forKey:@(spotlight::kSpotlightLastIndexingVersionKey)]; | 338 forKey:@(spotlight::kSpotlightLastIndexingVersionKey)]; |
339 [_delegate bookmarkUpdated]; | 339 [_delegate bookmarkUpdated]; |
340 }); | 340 }); |
341 } | 341 } |
342 }; | 342 }; |
343 [self clearAllSpotlightItems:completion]; | 343 [self clearAllSpotlightItems:completion]; |
344 } | 344 } |
345 | 345 |
346 @end | 346 @end |
OLD | NEW |