summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/cocoa/handoff_active_url_observer_bridge.h
diff options
context:
space:
mode:
authorerikchen <erikchen@chromium.org>2014-12-11 16:17:38 -0800
committerCommit bot <commit-bot@chromium.org>2014-12-12 00:18:30 +0000
commit600f7962455cb8479168eb2c6678eda05365460a (patch)
tree0485cd68bf693af4ef9e925ee1e594da813d6463 /chrome/browser/ui/cocoa/handoff_active_url_observer_bridge.h
parentd01af9d9c924bcca8e965a89eb21e6299b2eb3e0 (diff)
downloadchromium_src-600f7962455cb8479168eb2c6678eda05365460a.zip
chromium_src-600f7962455cb8479168eb2c6678eda05365460a.tar.gz
chromium_src-600f7962455cb8479168eb2c6678eda05365460a.tar.bz2
Reland 1: "mac: Allow Chrome to hand off its active URL to other devices."
The original CL used instance variables in a class extension and automatic generation of ivars for synthesized properties, features only available on 64-bit builds. The Mac Memory bots are still compiling Chromium in 32-bits. This reland removes the usage of those features. > This CL adds the class HandoffManager, which is responsible for interfacing > with Apple's Handoff APIs. It takes a GURL, and exposes that GURL to Handoff. > > This CL adds the class ActiveWebContentsObserver, which is responsible for > listening to changes to the active browser, the active tab, and the visible > URL. It notifies its delegate when any of this state might have changed. > > AppControllerMac is the delegate of ActiveWebContentsObserver, as well as the > owner of the HandoffManager. When it receives a delegate callback, it passes an > updated GURL to the HandoffManager. There is some minimal logic in > AppControllerMac that prevents URLs from incognito windows from being passed to > the HandoffManager. > > BUG=431051, 438823 > Committed: https://crrev.com/708abc5b0abb5e0916d779bf6d1342fd472a2aa1 > Cr-Commit-Position: refs/heads/master@{#307846} BUG=431051, 438823 TBR=sky, erikwright, mmenke, avi Review URL: https://codereview.chromium.org/794853004 Cr-Commit-Position: refs/heads/master@{#308005}
Diffstat (limited to 'chrome/browser/ui/cocoa/handoff_active_url_observer_bridge.h')
-rw-r--r--chrome/browser/ui/cocoa/handoff_active_url_observer_bridge.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/chrome/browser/ui/cocoa/handoff_active_url_observer_bridge.h b/chrome/browser/ui/cocoa/handoff_active_url_observer_bridge.h
new file mode 100644
index 0000000..0d00961
--- /dev/null
+++ b/chrome/browser/ui/cocoa/handoff_active_url_observer_bridge.h
@@ -0,0 +1,47 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_COCOA_HANDOFF_ACTIVE_URL_OBSERVER_BRIDGE_H_
+#define CHROME_BROWSER_UI_COCOA_HANDOFF_ACTIVE_URL_OBSERVER_BRIDGE_H_
+
+#import <Cocoa/Cocoa.h>
+
+#include "base/macros.h"
+#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/ui/cocoa/handoff_active_url_observer_delegate.h"
+
+namespace content {
+class WebContents;
+}
+
+class HandoffActiveURLObserver;
+
+// A protocol that allows ObjC objects to receive delegate callbacks from
+// HandoffActiveURLObserver.
+@protocol HandoffActiveURLObserverBridgeDelegate
+- (void)handoffActiveURLChanged:(content::WebContents*)webContents;
+@end
+
+// This class allows an ObjC object to receive the delegate callbacks from an
+// HandoffActiveURLObserver.
+class HandoffActiveURLObserverBridge : public HandoffActiveURLObserverDelegate {
+ public:
+ explicit HandoffActiveURLObserverBridge(
+ NSObject<HandoffActiveURLObserverBridgeDelegate>* delegate);
+
+ ~HandoffActiveURLObserverBridge() override;
+
+ private:
+ void HandoffActiveURLChanged(content::WebContents* web_contents) override;
+
+ // Instances of this class should be owned by their |delegate_|.
+ NSObject<HandoffActiveURLObserverBridgeDelegate>* delegate_;
+
+ // The C++ object that this class acts as a bridge for.
+ scoped_ptr<HandoffActiveURLObserver> observer_;
+
+ DISALLOW_COPY_AND_ASSIGN(HandoffActiveURLObserverBridge);
+};
+
+#endif // CHROME_BROWSER_UI_COCOA_HANDOFF_ACTIVE_URL_OBSERVER_BRIDGE_H_