| 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/scoped_nsobject.h" | 8 #include "base/mac/scoped_nsobject.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "net/base/mac/url_conversions.h" | 10 #include "net/base/mac/url_conversions.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 } | 51 } |
| 52 | 52 |
| 53 - (void)updateActiveURL:(const GURL&)url { | 53 - (void)updateActiveURL:(const GURL&)url { |
| 54 #if defined(OS_IOS) | 54 #if defined(OS_IOS) |
| 55 // Handoff is only available on iOS 8+. | 55 // Handoff is only available on iOS 8+. |
| 56 DCHECK(base::ios::IsRunningOnIOS8OrLater()); | 56 DCHECK(base::ios::IsRunningOnIOS8OrLater()); |
| 57 #endif | 57 #endif |
| 58 | 58 |
| 59 #if defined(OS_MACOSX) && !defined(OS_IOS) | 59 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 60 // Handoff is only available on OSX 10.10+. | 60 // Handoff is only available on OSX 10.10+. |
| 61 DCHECK(base::mac::IsOSYosemiteOrLater()); | 61 DCHECK(base::mac::IsAtLeastOS10_10()); |
| 62 #endif | 62 #endif |
| 63 | 63 |
| 64 _activeURL = url; | 64 _activeURL = url; |
| 65 [self updateUserActivity]; | 65 [self updateUserActivity]; |
| 66 } | 66 } |
| 67 | 67 |
| 68 - (BOOL)shouldUseActiveURL { | 68 - (BOOL)shouldUseActiveURL { |
| 69 return _activeURL.SchemeIsHTTPOrHTTPS(); | 69 return _activeURL.SchemeIsHTTPOrHTTPS(); |
| 70 } | 70 } |
| 71 | 71 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 91 withObject:handoff::kChromeHandoffActivityType]; | 91 withObject:handoff::kChromeHandoffActivityType]; |
| 92 self.userActivity = base::scoped_nsobject<NSUserActivity>(userActivity); | 92 self.userActivity = base::scoped_nsobject<NSUserActivity>(userActivity); |
| 93 self.userActivity.webpageURL = net::NSURLWithGURL(_activeURL); | 93 self.userActivity.webpageURL = net::NSURLWithGURL(_activeURL); |
| 94 NSString* origin = handoff::StringFromOrigin(_origin); | 94 NSString* origin = handoff::StringFromOrigin(_origin); |
| 95 DCHECK(origin); | 95 DCHECK(origin); |
| 96 self.userActivity.userInfo = @{ handoff::kOriginKey : origin }; | 96 self.userActivity.userInfo = @{ handoff::kOriginKey : origin }; |
| 97 [self.userActivity becomeCurrent]; | 97 [self.userActivity becomeCurrent]; |
| 98 } | 98 } |
| 99 | 99 |
| 100 @end | 100 @end |
| OLD | NEW |