| OLD | NEW | 
|    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_property_releaser.h" | 
|    8 #include "base/mac/scoped_nsobject.h" |    9 #include "base/mac/scoped_nsobject.h" | 
|    9 #include "net/base/mac/url_conversions.h" |   10 #include "net/base/mac/url_conversions.h" | 
|   10  |   11  | 
|   11 #if defined(OS_IOS) |   12 #if defined(OS_IOS) | 
|   12 #include "base/ios/ios_util.h" |   13 #include "base/ios/ios_util.h" | 
|   13 #include "components/handoff/pref_names_ios.h" |   14 #include "components/handoff/pref_names_ios.h" | 
|   14 #include "components/pref_registry/pref_registry_syncable.h"  // nogncheck |   15 #include "components/pref_registry/pref_registry_syncable.h"  // nogncheck | 
|   15 #endif |   16 #endif | 
|   16  |   17  | 
|   17 #if defined(OS_MACOSX) && !defined(OS_IOS) |   18 #if defined(OS_MACOSX) && !defined(OS_IOS) | 
|   18 #include "base/mac/mac_util.h" |   19 #include "base/mac/mac_util.h" | 
|   19 #include "base/mac/sdk_forward_declarations.h" |   20 #include "base/mac/sdk_forward_declarations.h" | 
|   20 #endif |   21 #endif | 
|   21  |   22  | 
|   22 @interface HandoffManager () |   23 @interface HandoffManager () | 
|   23  |   24  | 
|   24 // The active user activity. |   25 // The active user activity. | 
|   25 @property(nonatomic, retain) NSUserActivity* userActivity; |   26 @property(nonatomic, retain) NSUserActivity* userActivity; | 
|   26  |   27  | 
|   27 // 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. | 
|   28 - (BOOL)shouldUseActiveURL; |   29 - (BOOL)shouldUseActiveURL; | 
|   29  |   30  | 
|   30 // Updates the active NSUserActivity. |   31 // Updates the active NSUserActivity. | 
|   31 - (void)updateUserActivity; |   32 - (void)updateUserActivity; | 
|   32  |   33  | 
|   33 @end |   34 @end | 
|   34  |   35  | 
|   35 @implementation HandoffManager |   36 @implementation HandoffManager { | 
 |   37   base::mac::ObjCPropertyReleaser _propertyReleaser_HandoffManager; | 
 |   38   GURL _activeURL; | 
 |   39   NSUserActivity* _userActivity; | 
 |   40   handoff::Origin _origin; | 
 |   41 } | 
|   36  |   42  | 
|   37 @synthesize userActivity = _userActivity; |   43 @synthesize userActivity = _userActivity; | 
|   38  |   44  | 
|   39 #if defined(OS_IOS) |   45 #if defined(OS_IOS) | 
|   40 + (void)registerBrowserStatePrefs:(user_prefs::PrefRegistrySyncable*)registry { |   46 + (void)registerBrowserStatePrefs:(user_prefs::PrefRegistrySyncable*)registry { | 
|   41   registry->RegisterBooleanPref( |   47   registry->RegisterBooleanPref( | 
|   42       prefs::kIosHandoffToOtherDevices, true, |   48       prefs::kIosHandoffToOtherDevices, true, | 
|   43       user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |   49       user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); | 
|   44 } |   50 } | 
|   45 #endif |   51 #endif | 
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  103  |  109  | 
|  104 @end |  110 @end | 
|  105  |  111  | 
|  106 @implementation HandoffManager (TestingOnly) |  112 @implementation HandoffManager (TestingOnly) | 
|  107  |  113  | 
|  108 - (NSURL*)userActivityWebpageURL { |  114 - (NSURL*)userActivityWebpageURL { | 
|  109   return self.userActivity.webpageURL; |  115   return self.userActivity.webpageURL; | 
|  110 } |  116 } | 
|  111  |  117  | 
|  112 @end |  118 @end | 
| OLD | NEW |