| 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 #import <Foundation/Foundation.h> | 10 #import <Foundation/Foundation.h> |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 // Called when |source| wants to open a new window. |url| is the URL of | 26 // Called when |source| wants to open a new window. |url| is the URL of |
| 27 // the new window; |opener_url| is the URL of the page which requested a | 27 // the new window; |opener_url| is the URL of the page which requested a |
| 28 // window to be open; |initiated_by_user| is true if action was caused by the | 28 // window to be open; |initiated_by_user| is true if action was caused by the |
| 29 // user. |source| will not open a window if this method returns nil. This | 29 // user. |source| will not open a window if this method returns nil. This |
| 30 // method can not return |source|. | 30 // method can not return |source|. |
| 31 virtual WebState* CreateNewWebState(WebState* source, | 31 virtual WebState* CreateNewWebState(WebState* source, |
| 32 const GURL& url, | 32 const GURL& url, |
| 33 const GURL& opener_url, | 33 const GURL& opener_url, |
| 34 bool initiated_by_user); | 34 bool initiated_by_user); |
| 35 | 35 |
| 36 // Called when the page calls wants to close self by calling window.close() |
| 37 // JavaScript API. |
| 38 virtual void CloseWebState(WebState* source); |
| 39 |
| 36 // Returns the WebState the URL is opened in, or nullptr if the URL wasn't | 40 // Returns the WebState the URL is opened in, or nullptr if the URL wasn't |
| 37 // opened immediately. | 41 // opened immediately. |
| 38 virtual WebState* OpenURLFromWebState(WebState*, | 42 virtual WebState* OpenURLFromWebState(WebState*, |
| 39 const WebState::OpenURLParams&); | 43 const WebState::OpenURLParams&); |
| 40 | 44 |
| 41 // Notifies the delegate that the user triggered the context menu with the | 45 // Notifies the delegate that the user triggered the context menu with the |
| 42 // given |ContextMenuParams|. Returns true if the context menu operation was | 46 // given |ContextMenuParams|. Returns true if the context menu operation was |
| 43 // handled by the delegate. | 47 // handled by the delegate. |
| 44 virtual bool HandleContextMenu(WebState* source, | 48 virtual bool HandleContextMenu(WebState* source, |
| 45 const ContextMenuParams& params); | 49 const ContextMenuParams& params); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 // Called when |this| is no longer the WebStateDelegate for |source|. | 84 // Called when |this| is no longer the WebStateDelegate for |source|. |
| 81 void Detach(WebState* source); | 85 void Detach(WebState* source); |
| 82 | 86 |
| 83 // The WebStates for which |this| is currently a delegate. | 87 // The WebStates for which |this| is currently a delegate. |
| 84 std::set<WebState*> attached_states_; | 88 std::set<WebState*> attached_states_; |
| 85 }; | 89 }; |
| 86 | 90 |
| 87 } // namespace web | 91 } // namespace web |
| 88 | 92 |
| 89 #endif // IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_DELEGATE_H_ | 93 #endif // IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_DELEGATE_H_ |
| OLD | NEW |