| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_SHARED_CHROME_BROWSER_TABS_WEB_STATE_LIST_OBSERVER_BRIDGE_H_ | 5 #ifndef IOS_SHARED_CHROME_BROWSER_TABS_WEB_STATE_LIST_OBSERVER_BRIDGE_H_ |
| 6 #define IOS_SHARED_CHROME_BROWSER_TABS_WEB_STATE_LIST_OBSERVER_BRIDGE_H_ | 6 #define IOS_SHARED_CHROME_BROWSER_TABS_WEB_STATE_LIST_OBSERVER_BRIDGE_H_ |
| 7 | 7 |
| 8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 didReplaceWebState:(web::WebState*)oldWebState | 34 didReplaceWebState:(web::WebState*)oldWebState |
| 35 withWebState:(web::WebState*)newWebState | 35 withWebState:(web::WebState*)newWebState |
| 36 atIndex:(int)index; | 36 atIndex:(int)index; |
| 37 | 37 |
| 38 // Invoked after the WebState at the specified index has been detached. The | 38 // Invoked after the WebState at the specified index has been detached. The |
| 39 // WebState is still valid but is no longer in the WebStateList. | 39 // WebState is still valid but is no longer in the WebStateList. |
| 40 - (void)webStateList:(WebStateList*)webStateList | 40 - (void)webStateList:(WebStateList*)webStateList |
| 41 didDetachWebState:(web::WebState*)webState | 41 didDetachWebState:(web::WebState*)webState |
| 42 atIndex:(int)index; | 42 atIndex:(int)index; |
| 43 | 43 |
| 44 // Invoked after |newWebState| was activated at the specified index. Both |
| 45 // WebState are either valid or null (if there was no selection or there is |
| 46 // no selection). If the change is due to an user action, |userAction| will |
| 47 // be true. |
| 48 - (void)webStateList:(WebStateList*)webStateList |
| 49 didChangeActiveWebState:(web::WebState*)newWebState |
| 50 oldWebState:(web::WebState*)oldWebState |
| 51 atIndex:(int)atIndex |
| 52 userAction:(BOOL)userAction; |
| 53 |
| 44 @end | 54 @end |
| 45 | 55 |
| 46 // Observer that bridges WebStateList events to an Objective-C observer that | 56 // Observer that bridges WebStateList events to an Objective-C observer that |
| 47 // implements the WebStateListObserver protocol (the observer is owned). | 57 // implements the WebStateListObserver protocol (the observer is owned). |
| 48 class WebStateListObserverBridge : public WebStateListObserver { | 58 class WebStateListObserverBridge : public WebStateListObserver { |
| 49 public: | 59 public: |
| 50 explicit WebStateListObserverBridge(id<WebStateListObserving> observer); | 60 explicit WebStateListObserverBridge(id<WebStateListObserving> observer); |
| 51 ~WebStateListObserverBridge() override; | 61 ~WebStateListObserverBridge() override; |
| 52 | 62 |
| 53 private: | 63 private: |
| 54 // WebStateListObserver implementation. | 64 // WebStateListObserver implementation. |
| 55 void WebStateInsertedAt(WebStateList* web_state_list, | 65 void WebStateInsertedAt(WebStateList* web_state_list, |
| 56 web::WebState* web_state, | 66 web::WebState* web_state, |
| 57 int index) override; | 67 int index) override; |
| 58 void WebStateMoved(WebStateList* web_state_list, | 68 void WebStateMoved(WebStateList* web_state_list, |
| 59 web::WebState* web_state, | 69 web::WebState* web_state, |
| 60 int from_index, | 70 int from_index, |
| 61 int to_index) override; | 71 int to_index) override; |
| 62 void WebStateReplacedAt(WebStateList* web_state_list, | 72 void WebStateReplacedAt(WebStateList* web_state_list, |
| 63 web::WebState* old_web_state, | 73 web::WebState* old_web_state, |
| 64 web::WebState* new_web_state, | 74 web::WebState* new_web_state, |
| 65 int index) override; | 75 int index) override; |
| 66 void WebStateDetachedAt(WebStateList* web_state_list, | 76 void WebStateDetachedAt(WebStateList* web_state_list, |
| 67 web::WebState* web_state, | 77 web::WebState* web_state, |
| 68 int index) override; | 78 int index) override; |
| 79 void WebStateActivatedAt(WebStateList* web_state_list, |
| 80 web::WebState* old_web_state, |
| 81 web::WebState* new_web_state, |
| 82 int active_index, |
| 83 bool user_action) override; |
| 69 | 84 |
| 70 id<WebStateListObserving> observer_; | 85 id<WebStateListObserving> observer_; |
| 71 | 86 |
| 72 DISALLOW_COPY_AND_ASSIGN(WebStateListObserverBridge); | 87 DISALLOW_COPY_AND_ASSIGN(WebStateListObserverBridge); |
| 73 }; | 88 }; |
| 74 | 89 |
| 75 #endif // IOS_SHARED_CHROME_BROWSER_TABS_WEB_STATE_LIST_OBSERVER_BRIDGE_H_ | 90 #endif // IOS_SHARED_CHROME_BROWSER_TABS_WEB_STATE_LIST_OBSERVER_BRIDGE_H_ |
| OLD | NEW |