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.
5 #ifndef CHROME_BROWSER_UI_COCOA_HANDOFF_ACTIVE_URL_OBSERVER_BRIDGE_H_
6 #define CHROME_BROWSER_UI_COCOA_HANDOFF_ACTIVE_URL_OBSERVER_BRIDGE_H_
8 #import <Cocoa/Cocoa.h>
10 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "chrome/browser/ui/cocoa/handoff_active_url_observer_delegate.h"
18 class HandoffActiveURLObserver
;
20 // A protocol that allows ObjC objects to receive delegate callbacks from
21 // HandoffActiveURLObserver.
22 @protocol HandoffActiveURLObserverBridgeDelegate
23 - (void)handoffActiveURLChanged
:(content::WebContents
*)webContents
;
26 // This class allows an ObjC object to receive the delegate callbacks from an
27 // HandoffActiveURLObserver.
28 class HandoffActiveURLObserverBridge
: public HandoffActiveURLObserverDelegate
{
30 explicit HandoffActiveURLObserverBridge(
31 NSObject
<HandoffActiveURLObserverBridgeDelegate
>* delegate
);
33 ~HandoffActiveURLObserverBridge() override
;
36 void HandoffActiveURLChanged(content::WebContents
* web_contents
) override
;
38 // Instances of this class should be owned by their |delegate_|.
39 NSObject
<HandoffActiveURLObserverBridgeDelegate
>* delegate_
;
41 // The C++ object that this class acts as a bridge for.
42 scoped_ptr
<HandoffActiveURLObserver
> observer_
;
44 DISALLOW_COPY_AND_ASSIGN(HandoffActiveURLObserverBridge
);
47 #endif // CHROME_BROWSER_UI_COCOA_HANDOFF_ACTIVE_URL_OBSERVER_BRIDGE_H_