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

Side by Side Diff: ios/web/navigation/navigation_manager_impl.mm

Issue 2711683002: (Set)IsOverridingUserAgent should be called on VisibleItem (Closed)
Patch Set: Rename function names 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
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/web/navigation/navigation_manager_impl.h" 5 #import "ios/web/navigation/navigation_manager_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 // Result may be out of bounds, so stop trying to skip redirect items and 413 // Result may be out of bounds, so stop trying to skip redirect items and
414 // simply add the remainder. 414 // simply add the remainder.
415 result += offset; 415 result += offset;
416 if (result < 0 /* overflow */) 416 if (result < 0 /* overflow */)
417 result = INT_MAX; 417 result = INT_MAX;
418 } 418 }
419 419
420 return result; 420 return result;
421 } 421 }
422 422
423 bool NavigationManagerImpl::IsUsingDesktopUserAgent() const {
424 return GetVisibleItem() && GetVisibleItem()->IsOverridingUserAgent();
Eugene But (OOO till 7-30) 2017/02/22 21:57:42 Why Visible? Should this be LastCommittedItem? Acc
kkhorimoto 2017/02/22 22:54:15 When reviewing, I was looking at the places this i
Eugene But (OOO till 7-30) 2017/02/22 23:13:56 Makes sense. Yuke, please update header comments t
liaoyuke 2017/02/22 23:48:31 Done.
liaoyuke 2017/02/22 23:48:31 Acknowledged.
liaoyuke 2017/02/22 23:48:31 Isn't it the case that CRWWebController also uses
Eugene But (OOO till 7-30) 2017/02/23 00:03:13 So this statement made me rethink this approach. Q
425 }
426
423 void NavigationManagerImpl::OverrideDesktopUserAgentForNextPendingItem() { 427 void NavigationManagerImpl::OverrideDesktopUserAgentForNextPendingItem() {
424 if (GetPendingItem()) 428 if (GetPendingItem())
425 GetPendingItem()->SetIsOverridingUserAgent(true); 429 GetPendingItem()->SetIsOverridingUserAgent(true);
426 else 430 else
427 override_desktop_user_agent_for_next_pending_item_ = true; 431 override_desktop_user_agent_for_next_pending_item_ = true;
428 } 432 }
429 433
430 bool NavigationManagerImpl::IsRedirectItemAtIndex(int index) const { 434 bool NavigationManagerImpl::IsRedirectItemAtIndex(int index) const {
431 DCHECK_GT(index, 0); 435 DCHECK_GT(index, 0);
432 DCHECK_LT(index, GetItemCount()); 436 DCHECK_LT(index, GetItemCount());
433 ui::PageTransition transition = GetItemAtIndex(index)->GetTransitionType(); 437 ui::PageTransition transition = GetItemAtIndex(index)->GetTransitionType();
434 return transition & ui::PAGE_TRANSITION_IS_REDIRECT_MASK; 438 return transition & ui::PAGE_TRANSITION_IS_REDIRECT_MASK;
435 } 439 }
436 440
437 } // namespace web 441 } // namespace web
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698