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

Side by Side Diff: components/handoff/handoff_manager.mm

Issue 2881183002: Revert of Replace ObjCPropertyReleaser with ReleaseProperties() project-wide. (Closed)
Patch Set: Created 3 years, 7 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "components/handoff/handoff_manager.h" 5 #include "components/handoff/handoff_manager.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/mac/objc_release_properties.h" 8 #include "base/mac/objc_property_releaser.h"
9 #include "base/mac/scoped_nsobject.h" 9 #include "base/mac/scoped_nsobject.h"
10 #include "net/base/mac/url_conversions.h" 10 #include "net/base/mac/url_conversions.h"
11 11
12 #if defined(OS_IOS) 12 #if defined(OS_IOS)
13 #include "base/ios/ios_util.h" 13 #include "base/ios/ios_util.h"
14 #include "components/handoff/pref_names_ios.h" 14 #include "components/handoff/pref_names_ios.h"
15 #include "components/pref_registry/pref_registry_syncable.h" // nogncheck 15 #include "components/pref_registry/pref_registry_syncable.h" // nogncheck
16 #endif 16 #endif
17 17
18 #if defined(OS_MACOSX) && !defined(OS_IOS) 18 #if defined(OS_MACOSX) && !defined(OS_IOS)
19 #include "base/mac/mac_util.h" 19 #include "base/mac/mac_util.h"
20 #include "base/mac/sdk_forward_declarations.h" 20 #include "base/mac/sdk_forward_declarations.h"
21 #endif 21 #endif
22 22
23 @interface HandoffManager () 23 @interface HandoffManager ()
24 24
25 // The active user activity. 25 // The active user activity.
26 @property(nonatomic, retain) NSUserActivity* userActivity; 26 @property(nonatomic, retain) NSUserActivity* userActivity;
27 27
28 // Whether the URL of the current tab should be exposed for Handoff. 28 // Whether the URL of the current tab should be exposed for Handoff.
29 - (BOOL)shouldUseActiveURL; 29 - (BOOL)shouldUseActiveURL;
30 30
31 // Updates the active NSUserActivity. 31 // Updates the active NSUserActivity.
32 - (void)updateUserActivity; 32 - (void)updateUserActivity;
33 33
34 @end 34 @end
35 35
36 @implementation HandoffManager { 36 @implementation HandoffManager {
37 base::mac::ObjCPropertyReleaser _propertyReleaser_HandoffManager;
37 GURL _activeURL; 38 GURL _activeURL;
38 NSUserActivity* _userActivity; 39 NSUserActivity* _userActivity;
39 handoff::Origin _origin; 40 handoff::Origin _origin;
40 } 41 }
41 42
42 @synthesize userActivity = _userActivity; 43 @synthesize userActivity = _userActivity;
43 44
44 #if defined(OS_IOS) 45 #if defined(OS_IOS)
45 + (void)registerBrowserStatePrefs:(user_prefs::PrefRegistrySyncable*)registry { 46 + (void)registerBrowserStatePrefs:(user_prefs::PrefRegistrySyncable*)registry {
46 registry->RegisterBooleanPref( 47 registry->RegisterBooleanPref(
47 prefs::kIosHandoffToOtherDevices, true, 48 prefs::kIosHandoffToOtherDevices, true,
48 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); 49 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
49 } 50 }
50 #endif 51 #endif
51 52
52 - (instancetype)init { 53 - (instancetype)init {
53 self = [super init]; 54 self = [super init];
54 if (self) { 55 if (self) {
56 _propertyReleaser_HandoffManager.Init(self, [HandoffManager class]);
55 #if defined(OS_MACOSX) && !defined(OS_IOS) 57 #if defined(OS_MACOSX) && !defined(OS_IOS)
56 _origin = handoff::ORIGIN_MAC; 58 _origin = handoff::ORIGIN_MAC;
57 #elif defined(OS_IOS) 59 #elif defined(OS_IOS)
58 _origin = handoff::ORIGIN_IOS; 60 _origin = handoff::ORIGIN_IOS;
59 #else 61 #else
60 NOTREACHED(); 62 NOTREACHED();
61 #endif 63 #endif
62 } 64 }
63 return self; 65 return self;
64 } 66 }
65 67
66 - (void)dealloc {
67 base::mac::ReleaseProperties(self);
68 [super dealloc];
69 }
70
71 - (void)updateActiveURL:(const GURL&)url { 68 - (void)updateActiveURL:(const GURL&)url {
72 #if defined(OS_MACOSX) && !defined(OS_IOS) 69 #if defined(OS_MACOSX) && !defined(OS_IOS)
73 // Handoff is only available on OSX 10.10+. 70 // Handoff is only available on OSX 10.10+.
74 DCHECK(base::mac::IsAtLeastOS10_10()); 71 DCHECK(base::mac::IsAtLeastOS10_10());
75 #endif 72 #endif
76 73
77 _activeURL = url; 74 _activeURL = url;
78 [self updateUserActivity]; 75 [self updateUserActivity];
79 } 76 }
80 77
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 109
113 @end 110 @end
114 111
115 @implementation HandoffManager (TestingOnly) 112 @implementation HandoffManager (TestingOnly)
116 113
117 - (NSURL*)userActivityWebpageURL { 114 - (NSURL*)userActivityWebpageURL {
118 return self.userActivity.webpageURL; 115 return self.userActivity.webpageURL;
119 } 116 }
120 117
121 @end 118 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell.mm ('k') | ios/chrome/app/main_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698