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