handoff_manager.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_HANDOFF_HANDOFF_MANAGER_H_
  5. #define COMPONENTS_HANDOFF_HANDOFF_MANAGER_H_
  6. #import <Foundation/Foundation.h>
  7. #include "build/build_config.h"
  8. #include "components/handoff/handoff_utility.h"
  9. #include "url/gurl.h"
  10. @class NSUserActivity;
  11. #if BUILDFLAG(IS_IOS)
  12. namespace user_prefs {
  13. class PrefRegistrySyncable;
  14. } // namespace user_prefs
  15. #endif
  16. // Maintains all of the state relevant to the Handoff feature. Allows Chrome to
  17. // hand off the current active URL to other devices.
  18. @interface HandoffManager : NSObject
  19. #if BUILDFLAG(IS_IOS)
  20. // Registers preferences related to Handoff.
  21. + (void)registerBrowserStatePrefs:(user_prefs::PrefRegistrySyncable*)registry;
  22. #endif
  23. // The active URL is defined as the URL of the most recently accessed tab. This
  24. // method should be called any time the active URL might have changed. This
  25. // method is idempotent.
  26. - (void)updateActiveURL:(const GURL&)url;
  27. // The active title is defined as the title of the most recently accessed tab.
  28. // This method should be called any time the active title might have changed.
  29. // This method is idempotent.
  30. // -updateActiveURL: should be called prior since the URL identifier is
  31. // required while the title is optional.
  32. - (void)updateActiveTitle:(const std::u16string&)title;
  33. @end
  34. #if BUILDFLAG(IS_IOS)
  35. @interface HandoffManager (TestingOnly)
  36. - (NSURL*)userActivityWebpageURL;
  37. - (NSString*)userActivityTitle;
  38. @end
  39. #endif
  40. #endif // COMPONENTS_HANDOFF_HANDOFF_MANAGER_H_