Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: ios/shared/chrome/browser/tabs/web_state_list_observer_bridge.mm

Issue 2680403005: Introduce WebStateList to manage a list of web::WebState. (Closed)
Patch Set: Fix "gn check". Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #import "ios/shared/chrome/browser/tabs/web_state_list_observer_bridge.h"
6
7 #if !defined(__has_feature) || !__has_feature(objc_arc)
8 #error "This file requires ARC support."
9 #endif
10
11 WebStateListObserverBridge::WebStateListObserverBridge(
12 id<WebStateListObserver> observer)
13 : observer_(observer) {}
14
15 WebStateListObserverBridge::~WebStateListObserverBridge() {}
16
17 void WebStateListObserverBridge::WebStateInsertedAt(
18 WebStateList* web_state_list,
19 web::WebState* web_state,
20 size_t index) {
21 SEL selector = @selector(webStateList:webStateInserted:atIndex:);
22 if (![observer_ respondsToSelector:selector])
23 return;
24
25 [observer_ webStateList:web_state_list
26 webStateInserted:web_state
27 atIndex:index];
28 }
29
30 void WebStateListObserverBridge::WebStateMoved(WebStateList* web_state_list,
31 web::WebState* web_state,
32 size_t from_index,
33 size_t to_index) {
34 SEL selector = @selector(webStateList:webStateMoved:fromIndex:toIndex:);
35 if (![observer_ respondsToSelector:selector])
36 return;
37
38 [observer_ webStateList:web_state_list
39 webStateMoved:web_state
40 fromIndex:from_index
41 toIndex:to_index];
42 }
43
44 void WebStateListObserverBridge::WebStateReplacedAt(
45 WebStateList* web_state_list,
46 web::WebState* old_web_state,
47 web::WebState* new_web_state,
48 size_t index) {
49 SEL selector = @selector(webStateList:webStateReplaced:byWebState:atIndex:);
50 if (![observer_ respondsToSelector:selector])
51 return;
52
53 [observer_ webStateList:web_state_list
54 webStateReplaced:old_web_state
55 byWebState:new_web_state
56 atIndex:index];
57 }
58
59 void WebStateListObserverBridge::WebStateRemovedAt(WebStateList* web_state_list,
60 web::WebState* web_state,
61 size_t index) {
62 SEL selector = @selector(webStateList:webStateRemoved:atIndex:);
63 if (![observer_ respondsToSelector:selector])
64 return;
65
66 [observer_ webStateList:web_state_list
67 webStateRemoved:web_state
68 atIndex:index];
69 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698