| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef IOS_WEB_WEB_STATE_WEB_CONTROLLER_OBSERVER_BRIDGE_H_ | 5 #ifndef IOS_WEB_WEB_STATE_WEB_CONTROLLER_OBSERVER_BRIDGE_H_ |
| 6 #define IOS_WEB_WEB_STATE_WEB_CONTROLLER_OBSERVER_BRIDGE_H_ | 6 #define IOS_WEB_WEB_STATE_WEB_CONTROLLER_OBSERVER_BRIDGE_H_ |
| 7 | 7 |
| 8 #include <string> | |
| 9 | |
| 10 #import "base/ios/weak_nsobject.h" | 8 #import "base/ios/weak_nsobject.h" |
| 11 #include "base/macros.h" | 9 #include "base/macros.h" |
| 12 #include "ios/web/public/web_state/web_state_observer.h" | 10 #include "ios/web/public/web_state/web_state_observer.h" |
| 13 | 11 |
| 14 @class CRWWebController; | 12 @class CRWWebController; |
| 15 @protocol CRWWebControllerObserver; | 13 @protocol CRWWebControllerObserver; |
| 16 class GURL; | |
| 17 | |
| 18 namespace base { | |
| 19 class DictionaryValue; | |
| 20 } | |
| 21 | 14 |
| 22 namespace web { | 15 namespace web { |
| 23 | 16 |
| 24 class WebState; | 17 class WebState; |
| 25 | 18 |
| 26 // This class allows to register a CRWWebControllerObserver instance as | 19 // This class allows to register a CRWWebControllerObserver instance as |
| 27 // a WebStateObserver. | 20 // a WebStateObserver. |
| 28 // It listens to WebStateObserver calls and forwards them to the underlying | 21 // It listens to WebStateObserver calls and forwards them to the underlying |
| 29 // CRWWebControllerObserver. | 22 // CRWWebControllerObserver. |
| 30 // TODO(droger): Remove this class once all CRWWebControllerObserver have been | 23 // TODO(droger): Remove this class once all CRWWebControllerObserver have been |
| (...skipping 11 matching lines...) Expand all Loading... |
| 42 | 35 |
| 43 // Gets the underlying CRWWebControllerObserver. | 36 // Gets the underlying CRWWebControllerObserver. |
| 44 id<CRWWebControllerObserver> web_controller_observer() const { | 37 id<CRWWebControllerObserver> web_controller_observer() const { |
| 45 return web_controller_observer_; | 38 return web_controller_observer_; |
| 46 } | 39 } |
| 47 | 40 |
| 48 private: | 41 private: |
| 49 // WebStateObserver implementation. | 42 // WebStateObserver implementation. |
| 50 void PageLoaded(PageLoadCompletionStatus load_completion_status) override; | 43 void PageLoaded(PageLoadCompletionStatus load_completion_status) override; |
| 51 | 44 |
| 52 // Callback for script commands. | |
| 53 bool ScriptCommandReceived(const base::DictionaryValue& value, | |
| 54 const GURL& url, | |
| 55 bool user_is_interacting); | |
| 56 | |
| 57 base::WeakNSProtocol<id<CRWWebControllerObserver>> web_controller_observer_; | 45 base::WeakNSProtocol<id<CRWWebControllerObserver>> web_controller_observer_; |
| 58 base::WeakNSObject<CRWWebController> web_controller_; | 46 base::WeakNSObject<CRWWebController> web_controller_; |
| 59 std::string script_command_callback_prefix_; | |
| 60 | 47 |
| 61 DISALLOW_COPY_AND_ASSIGN(WebControllerObserverBridge); | 48 DISALLOW_COPY_AND_ASSIGN(WebControllerObserverBridge); |
| 62 }; | 49 }; |
| 63 | 50 |
| 64 } // namespace web | 51 } // namespace web |
| 65 | 52 |
| 66 #endif // IOS_WEB_WEB_STATE_WEB_CONTROLLER_OBSERVER_BRIDGE_H_ | 53 #endif // IOS_WEB_WEB_STATE_WEB_CONTROLLER_OBSERVER_BRIDGE_H_ |
| OLD | NEW |