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

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

Issue 2766413004: [ios] Change API to inform WebStateList of opener-opened relationship. (Closed)
Patch Set: Address comments. Created 3 years, 9 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_opener.h"
6
7 #include "base/logging.h"
8 #import "ios/web/public/navigation_manager.h"
9 #import "ios/web/public/web_state/web_state.h"
10
11 #if !defined(__has_feature) || !__has_feature(objc_arc)
12 #error "This file requires ARC support."
13 #endif
14
15 namespace {
16 int NavigationIndexFromWebState(web::WebState* web_state) {
17 if (!web_state)
18 return -1;
19
20 DCHECK(web_state->GetNavigationManager());
21 return web_state->GetNavigationManager()->GetLastCommittedItemIndex();
22 }
23 } // namespace
24
25 WebStateOpener::WebStateOpener(web::WebState* opener)
26 : WebStateOpener(opener, NavigationIndexFromWebState(opener)) {}
27
28 WebStateOpener::WebStateOpener(web::WebState* opener, int navigation_index)
29 : opener(opener), navigation_index(navigation_index) {}
OLDNEW
« no previous file with comments | « ios/shared/chrome/browser/tabs/web_state_opener.h ('k') | ios/shared/chrome/browser/tabs/web_state_opener_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698