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 #import "ios/shared/chrome/browser/tabs/web_state_list_observer_bridge.h" | 5 #import "ios/shared/chrome/browser/tabs/web_state_list_observer_bridge.h" |
6 | 6 |
7 #if !defined(__has_feature) || !__has_feature(objc_arc) | 7 #if !defined(__has_feature) || !__has_feature(objc_arc) |
8 #error "This file requires ARC support." | 8 #error "This file requires ARC support." |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 @selector(webStateList:didReplaceWebState:withWebState:atIndex:); | 51 @selector(webStateList:didReplaceWebState:withWebState:atIndex:); |
52 if (![observer_ respondsToSelector:selector]) | 52 if (![observer_ respondsToSelector:selector]) |
53 return; | 53 return; |
54 | 54 |
55 [observer_ webStateList:web_state_list | 55 [observer_ webStateList:web_state_list |
56 didReplaceWebState:old_web_state | 56 didReplaceWebState:old_web_state |
57 withWebState:new_web_state | 57 withWebState:new_web_state |
58 atIndex:index]; | 58 atIndex:index]; |
59 } | 59 } |
60 | 60 |
| 61 void WebStateListObserverBridge::WillDetachWebStateAt( |
| 62 WebStateList* web_state_list, |
| 63 web::WebState* web_state, |
| 64 int index) { |
| 65 const SEL selector = @selector(webStateList:willDetachWebState:atIndex:); |
| 66 if (![observer_ respondsToSelector:selector]) |
| 67 return; |
| 68 |
| 69 [observer_ webStateList:web_state_list |
| 70 willDetachWebState:web_state |
| 71 atIndex:index]; |
| 72 } |
| 73 |
61 void WebStateListObserverBridge::WebStateDetachedAt( | 74 void WebStateListObserverBridge::WebStateDetachedAt( |
62 WebStateList* web_state_list, | 75 WebStateList* web_state_list, |
63 web::WebState* web_state, | 76 web::WebState* web_state, |
64 int index) { | 77 int index) { |
65 const SEL selector = @selector(webStateList:didDetachWebState:atIndex:); | 78 const SEL selector = @selector(webStateList:didDetachWebState:atIndex:); |
66 if (![observer_ respondsToSelector:selector]) | 79 if (![observer_ respondsToSelector:selector]) |
67 return; | 80 return; |
68 | 81 |
69 [observer_ webStateList:web_state_list | 82 [observer_ webStateList:web_state_list |
70 didDetachWebState:web_state | 83 didDetachWebState:web_state |
71 atIndex:index]; | 84 atIndex:index]; |
72 } | 85 } |
73 | 86 |
| 87 void WebStateListObserverBridge::WillCloseWebStateAt( |
| 88 WebStateList* web_state_list, |
| 89 web::WebState* web_state, |
| 90 int index) { |
| 91 const SEL selector = @selector(webStateList:willCloseWebState:atIndex:); |
| 92 if (![observer_ respondsToSelector:selector]) |
| 93 return; |
| 94 |
| 95 [observer_ webStateList:web_state_list |
| 96 willCloseWebState:web_state |
| 97 atIndex:index]; |
| 98 } |
| 99 |
74 void WebStateListObserverBridge::WebStateActivatedAt( | 100 void WebStateListObserverBridge::WebStateActivatedAt( |
75 WebStateList* web_state_list, | 101 WebStateList* web_state_list, |
76 web::WebState* old_web_state, | 102 web::WebState* old_web_state, |
77 web::WebState* new_web_state, | 103 web::WebState* new_web_state, |
78 int active_index, | 104 int active_index, |
79 bool user_action) { | 105 bool user_action) { |
80 const SEL selector = @selector | 106 const SEL selector = @selector |
81 (webStateList:didChangeActiveWebState:oldWebState:atIndex:userAction:); | 107 (webStateList:didChangeActiveWebState:oldWebState:atIndex:userAction:); |
82 if (![observer_ respondsToSelector:selector]) | 108 if (![observer_ respondsToSelector:selector]) |
83 return; | 109 return; |
84 | 110 |
85 [observer_ webStateList:web_state_list | 111 [observer_ webStateList:web_state_list |
86 didChangeActiveWebState:new_web_state | 112 didChangeActiveWebState:new_web_state |
87 oldWebState:old_web_state | 113 oldWebState:old_web_state |
88 atIndex:active_index | 114 atIndex:active_index |
89 userAction:(user_action ? YES : NO)]; | 115 userAction:(user_action ? YES : NO)]; |
90 } | 116 } |
OLD | NEW |