| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 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 IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_DELEGATE_BRIDGE_H_ |
| 6 #define IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_DELEGATE_BRIDGE_H_ |
| 7 |
| 8 #import <Foundation/Foundation.h> |
| 9 |
| 10 #import "base/ios/weak_nsobject.h" |
| 11 #include "ios/web/public/web_state/web_state_delegate.h" |
| 12 |
| 13 // Objective-C interface for web::WebStateDelegate. |
| 14 @protocol CRWWebStateDelegate<NSObject> |
| 15 @optional |
| 16 |
| 17 // Called when the page has made some progress loading. |progress| is a value |
| 18 // between 0.0 (nothing loaded) to 1.0 (page fully loaded). |
| 19 - (void)webState:(web::WebState*)webState didChangeProgress:(double)progress; |
| 20 |
| 21 @end |
| 22 |
| 23 namespace web { |
| 24 |
| 25 // Adapter to use an id<CRWWebStateDelegate> as a web::WebStateDelegate. |
| 26 class WebStateDelegateBridge : public web::WebStateDelegate { |
| 27 public: |
| 28 explicit WebStateDelegateBridge(id<CRWWebStateDelegate> delegate); |
| 29 ~WebStateDelegateBridge() override; |
| 30 |
| 31 // web::WebStateDelegate methods. |
| 32 void LoadProgressChanged(WebState* source, double progress) override; |
| 33 |
| 34 private: |
| 35 // CRWWebStateDelegate which receives forwarded calls. |
| 36 base::WeakNSProtocol<id<CRWWebStateDelegate>> delegate_; |
| 37 DISALLOW_COPY_AND_ASSIGN(WebStateDelegateBridge); |
| 38 }; |
| 39 |
| 40 } // web |
| 41 |
| 42 #endif // IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_DELEGATE_BRIDGE_H_ |
| OLD | NEW |