| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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_PUBLIC_WEB_STATE_WEB_STATE_DELEGATE_H_ | 5 #ifndef IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_DELEGATE_H_ |
| 6 #define IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_DELEGATE_H_ | 6 #define IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #import "ios/web/public/web_state/web_state.h" |
| 11 | 12 |
| 12 namespace web { | 13 namespace web { |
| 13 | 14 |
| 14 struct ContextMenuParams; | 15 struct ContextMenuParams; |
| 15 class JavaScriptDialogPresenter; | 16 class JavaScriptDialogPresenter; |
| 16 class WebState; | |
| 17 | 17 |
| 18 // Objects implement this interface to get notified about changes in the | 18 // Objects implement this interface to get notified about changes in the |
| 19 // WebState and to provide necessary functionality. | 19 // WebState and to provide necessary functionality. |
| 20 class WebStateDelegate { | 20 class WebStateDelegate { |
| 21 public: | 21 public: |
| 22 WebStateDelegate(); | 22 WebStateDelegate(); |
| 23 | 23 |
| 24 // Returns the WebState the URL is opened in, or nullptr if the URL wasn't |
| 25 // opened immediately. |
| 26 virtual WebState* OpenURLFromWebState(WebState*, |
| 27 const WebState::OpenURLParams&); |
| 28 |
| 24 // Notifies the delegate that the page has made some progress loading. | 29 // Notifies the delegate that the page has made some progress loading. |
| 25 // |progress| is a value between 0.0 (nothing loaded) to 1.0 (page fully | 30 // |progress| is a value between 0.0 (nothing loaded) to 1.0 (page fully |
| 26 // loaded). | 31 // loaded). |
| 27 virtual void LoadProgressChanged(WebState* source, double progress); | 32 virtual void LoadProgressChanged(WebState* source, double progress); |
| 28 | 33 |
| 29 // Notifies the delegate that the user triggered the context menu with the | 34 // Notifies the delegate that the user triggered the context menu with the |
| 30 // given |ContextMenuParams|. Returns true if the context menu operation was | 35 // given |ContextMenuParams|. Returns true if the context menu operation was |
| 31 // handled by the delegate. | 36 // handled by the delegate. |
| 32 virtual bool HandleContextMenu(WebState* source, | 37 virtual bool HandleContextMenu(WebState* source, |
| 33 const ContextMenuParams& params); | 38 const ContextMenuParams& params); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 50 // Called when |this| is no longer the WebStateDelegate for |source|. | 55 // Called when |this| is no longer the WebStateDelegate for |source|. |
| 51 void Detach(WebState* source); | 56 void Detach(WebState* source); |
| 52 | 57 |
| 53 // The WebStates for which |this| is currently a delegate. | 58 // The WebStates for which |this| is currently a delegate. |
| 54 std::set<WebState*> attached_states_; | 59 std::set<WebState*> attached_states_; |
| 55 }; | 60 }; |
| 56 | 61 |
| 57 } // namespace web | 62 } // namespace web |
| 58 | 63 |
| 59 #endif // IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_DELEGATE_H_ | 64 #endif // IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_DELEGATE_H_ |
| OLD | NEW |