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

Side by Side Diff: ios/chrome/app/spotlight/spotlight_manager.mm

Issue 2704193002: [ObjC ARC] Converts ios/chrome/app/spotlight:spotlight to ARC. (Closed)
Patch Set: s/unsafe/weak Created 3 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
OLDNEW
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/spotlight_manager.h" 5 #import "ios/chrome/app/spotlight/spotlight_manager.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/mac/scoped_nsobject.h"
9 #include "ios/chrome/app/spotlight/actions_spotlight_manager.h" 8 #include "ios/chrome/app/spotlight/actions_spotlight_manager.h"
10 #include "ios/chrome/app/spotlight/bookmarks_spotlight_manager.h" 9 #include "ios/chrome/app/spotlight/bookmarks_spotlight_manager.h"
11 #include "ios/chrome/app/spotlight/topsites_spotlight_manager.h" 10 #include "ios/chrome/app/spotlight/topsites_spotlight_manager.h"
12 #include "ios/chrome/browser/experimental_flags.h" 11 #include "ios/chrome/browser/experimental_flags.h"
13 12
13 #if !defined(__has_feature) || !__has_feature(objc_arc)
14 #error "This file requires ARC support."
15 #endif
16
14 // Called from the BrowserBookmarkModelBridge from C++ -> ObjC. 17 // Called from the BrowserBookmarkModelBridge from C++ -> ObjC.
15 @interface SpotlightManager ()<BookmarkUpdatedDelegate> { 18 @interface SpotlightManager ()<BookmarkUpdatedDelegate> {
16 base::scoped_nsobject<BookmarksSpotlightManager> _bookmarkManager; 19 BookmarksSpotlightManager* _bookmarkManager;
17 base::scoped_nsobject<TopSitesSpotlightManager> _topSitesManager; 20 TopSitesSpotlightManager* _topSitesManager;
18 base::scoped_nsobject<ActionsSpotlightManager> _actionsManager; 21 ActionsSpotlightManager* _actionsManager;
19 } 22 }
20 23
21 - (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState 24 - (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState
22 NS_DESIGNATED_INITIALIZER; 25 NS_DESIGNATED_INITIALIZER;
23 26
24 - (instancetype)init NS_UNAVAILABLE; 27 - (instancetype)init NS_UNAVAILABLE;
25 @end 28 @end
26 29
27 @implementation SpotlightManager 30 @implementation SpotlightManager
28 31
29 + (SpotlightManager*)spotlightManagerWithBrowserState: 32 + (SpotlightManager*)spotlightManagerWithBrowserState:
30 (ios::ChromeBrowserState*)browserState { 33 (ios::ChromeBrowserState*)browserState {
31 if (spotlight::IsSpotlightAvailable()) { 34 if (spotlight::IsSpotlightAvailable()) {
32 return [[[SpotlightManager alloc] initWithBrowserState:browserState] 35 return [[SpotlightManager alloc] initWithBrowserState:browserState];
33 autorelease];
34 } 36 }
35 return nil; 37 return nil;
36 } 38 }
37 39
38 - (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState { 40 - (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState {
39 DCHECK(spotlight::IsSpotlightAvailable()); 41 DCHECK(spotlight::IsSpotlightAvailable());
40 self = [super init]; 42 self = [super init];
41 if (self) { 43 if (self) {
42 _topSitesManager.reset([[TopSitesSpotlightManager 44 _topSitesManager = [TopSitesSpotlightManager
43 topSitesSpotlightManagerWithBrowserState:browserState] retain]); 45 topSitesSpotlightManagerWithBrowserState:browserState];
44 _bookmarkManager.reset([[BookmarksSpotlightManager 46 _bookmarkManager = [BookmarksSpotlightManager
45 bookmarksSpotlightManagerWithBrowserState:browserState] retain]); 47 bookmarksSpotlightManagerWithBrowserState:browserState];
46 [_bookmarkManager setDelegate:self]; 48 [_bookmarkManager setDelegate:self];
47 _actionsManager.reset( 49 _actionsManager = [ActionsSpotlightManager actionsSpotlightManager];
48 [[ActionsSpotlightManager actionsSpotlightManager] retain]);
49 } 50 }
50 return self; 51 return self;
51 } 52 }
52 53
53 - (instancetype)init { 54 - (instancetype)init {
54 NOTREACHED(); 55 NOTREACHED();
55 return nil; 56 return nil;
56 } 57 }
57 58
58 - (void)dealloc {
59 [super dealloc];
60 }
61 59
62 - (void)resyncIndex { 60 - (void)resyncIndex {
63 [_bookmarkManager reindexBookmarksIfNeeded]; 61 [_bookmarkManager reindexBookmarksIfNeeded];
64 [_actionsManager indexActions]; 62 [_actionsManager indexActions];
65 } 63 }
66 64
67 - (void)bookmarkUpdated { 65 - (void)bookmarkUpdated {
68 [_topSitesManager reindexTopSites]; 66 [_topSitesManager reindexTopSites];
69 } 67 }
70 68
71 @end 69 @end
OLDNEW
« no previous file with comments | « ios/chrome/app/spotlight/bookmarks_spotlight_manager.mm ('k') | ios/chrome/app/spotlight/spotlight_util.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698