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

Side by Side Diff: ios/chrome/browser/native_app_launcher/native_app_navigation_utils.mm

Issue 2650563002: Pass WebState to NativeAppNavigationController (Closed)
Patch Set: IsLinkNavigation() is now a util function w/ unit tests 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 #include "ios/chrome/browser/native_app_launcher/native_app_navigation_utils.h"
6
7 #include "base/logging.h"
8 #import "ios/web/navigation/navigation_manager_impl.h"
Eugene But (OOO till 7-30) 2017/01/26 01:04:38 do we need this include?
pkl (ping after 24h if needed) 2017/01/26 02:26:28 Not this one, but we do need ios/web/public/naviga
9 #include "ios/web/public/navigation_item.h"
10 #include "ios/web/public/web_state/web_state.h"
Eugene But (OOO till 7-30) 2017/01/26 01:04:38 s/include/import
pkl (ping after 24h if needed) 2017/01/26 02:26:28 web_state.h is all C++ code, so should be #include
Eugene But (OOO till 7-30) 2017/01/26 03:10:02 Line 26 is Objective-C code.
pkl (ping after 24h if needed) 2017/01/26 19:44:24 Done.
11
12 namespace native_app_launcher {
13
14 bool IsLinkNavigation(web::WebState* webState) {
Eugene But (OOO till 7-30) 2017/01/26 01:04:39 Please use C++ Style for variables
pkl (ping after 24h if needed) 2017/01/26 02:26:28 Done.
15 web::NavigationManager* navigationManager = webState->GetNavigationManager();
16 if (!navigationManager)
17 return false;
Eugene But (OOO till 7-30) 2017/01/26 01:04:38 Can this ever happen? I think NavigationManager li
pkl (ping after 24h if needed) 2017/01/26 02:26:28 web_state.h says "Can never return null". Cool! Tu
18 int index = navigationManager->GetCurrentItemIndex();
19 // Walks backward on the navigation items for the first item that is not a
Eugene But (OOO till 7-30) 2017/01/26 01:04:38 nit: s/Walks/Walk
pkl (ping after 24h if needed) 2017/01/26 02:26:28 I recall that comments should be third-person sing
Eugene But (OOO till 7-30) 2017/01/26 03:10:02 I guess you referring to Style Guide: "Use descrip
pkl (ping after 24h if needed) 2017/01/26 19:44:24 Acknowledged.
20 // redirect.
21 while (index >= 0) {
22 web::NavigationItem* item = navigationManager->GetItemAtIndex(index);
23 DCHECK(item);
24 ui::PageTransition currentTransition = item->GetTransitionType();
25 // Checks non-redirect entries for transitions that are either links or
26 // bookmarks.
27 if ((currentTransition & ui::PAGE_TRANSITION_IS_REDIRECT_MASK) == 0) {
28 return PageTransitionCoreTypeIs(currentTransition,
29 ui::PAGE_TRANSITION_LINK) ||
30 PageTransitionCoreTypeIs(currentTransition,
31 ui::PAGE_TRANSITION_AUTO_BOOKMARK);
32 }
33 --index;
34 }
35 return false;
36 }
37
38 } // namespace native_app_launcher
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698