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

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

Issue 2476373004: [ios] Removed User Action reporting from CRWSessionController. (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/crw_session_controller.h" 5 #import "ios/web/navigation/crw_session_controller.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <utility> 10 #include <utility>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/format_macros.h" 13 #include "base/format_macros.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #import "base/mac/foundation_util.h" 15 #import "base/mac/foundation_util.h"
16 #import "base/mac/scoped_nsobject.h" 16 #import "base/mac/scoped_nsobject.h"
17 #include "base/metrics/user_metrics.h"
18 #include "base/metrics/user_metrics_action.h"
19 #include "base/strings/sys_string_conversions.h" 17 #include "base/strings/sys_string_conversions.h"
20 #import "ios/web/history_state_util.h" 18 #import "ios/web/history_state_util.h"
21 #import "ios/web/navigation/crw_session_certificate_policy_manager.h" 19 #import "ios/web/navigation/crw_session_certificate_policy_manager.h"
22 #import "ios/web/navigation/crw_session_controller+private_constructors.h" 20 #import "ios/web/navigation/crw_session_controller+private_constructors.h"
23 #import "ios/web/navigation/crw_session_entry.h" 21 #import "ios/web/navigation/crw_session_entry.h"
24 #include "ios/web/navigation/navigation_item_impl.h" 22 #include "ios/web/navigation/navigation_item_impl.h"
25 #import "ios/web/navigation/navigation_manager_facade_delegate.h" 23 #import "ios/web/navigation/navigation_manager_facade_delegate.h"
26 #import "ios/web/navigation/navigation_manager_impl.h" 24 #import "ios/web/navigation/navigation_manager_impl.h"
27 #include "ios/web/navigation/time_smoother.h" 25 #include "ios/web/navigation/time_smoother.h"
28 #include "ios/web/public/browser_state.h" 26 #include "ios/web/public/browser_state.h"
29 #include "ios/web/public/browser_url_rewriter.h" 27 #include "ios/web/public/browser_url_rewriter.h"
30 #include "ios/web/public/referrer.h" 28 #include "ios/web/public/referrer.h"
31 #include "ios/web/public/ssl_status.h" 29 #include "ios/web/public/ssl_status.h"
32 30
33 #if !defined(__has_feature) || !__has_feature(objc_arc) 31 #if !defined(__has_feature) || !__has_feature(objc_arc)
34 #error "This file requires ARC support." 32 #error "This file requires ARC support."
35 #endif 33 #endif
36 34
37 using base::UserMetricsAction;
38
39 namespace { 35 namespace {
40 NSString* const kCertificatePolicyManagerKey = @"certificatePolicyManager"; 36 NSString* const kCertificatePolicyManagerKey = @"certificatePolicyManager";
41 NSString* const kCurrentNavigationIndexKey = @"currentNavigationIndex"; 37 NSString* const kCurrentNavigationIndexKey = @"currentNavigationIndex";
42 NSString* const kEntriesKey = @"entries"; 38 NSString* const kEntriesKey = @"entries";
43 NSString* const kLastVisitedTimestampKey = @"lastVisitedTimestamp"; 39 NSString* const kLastVisitedTimestampKey = @"lastVisitedTimestamp";
44 NSString* const kOpenerIdKey = @"openerId"; 40 NSString* const kOpenerIdKey = @"openerId";
45 NSString* const kOpenedByDOMKey = @"openedByDOM"; 41 NSString* const kOpenedByDOMKey = @"openedByDOM";
46 NSString* const kOpenerNavigationIndexKey = @"openerNavigationIndex"; 42 NSString* const kOpenerNavigationIndexKey = @"openerNavigationIndex";
47 NSString* const kPreviousNavigationIndexKey = @"previousNavigationIndex"; 43 NSString* const kPreviousNavigationIndexKey = @"previousNavigationIndex";
48 NSString* const kTabIdKey = @"tabId"; 44 NSString* const kTabIdKey = @"tabId";
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 [self goToEntry:_entries[newNavigationIndex]]; 623 [self goToEntry:_entries[newNavigationIndex]];
628 } 624 }
629 } 625 }
630 626
631 - (void)goToEntry:(CRWSessionEntry*)entry { 627 - (void)goToEntry:(CRWSessionEntry*)entry {
632 DCHECK(entry); 628 DCHECK(entry);
633 if (![_entries containsObject:entry]) 629 if (![_entries containsObject:entry])
634 return; 630 return;
635 631
636 NSInteger newNavigationIndex = [_entries indexOfObject:entry]; 632 NSInteger newNavigationIndex = [_entries indexOfObject:entry];
637 NSInteger delta = newNavigationIndex - _currentNavigationIndex; 633 if (newNavigationIndex < _currentNavigationIndex) {
638 if (delta < 0) { 634 // Going back.
639 for (int i = delta; i < 0; i++) {
640 base::RecordAction(UserMetricsAction("Back"));
641 }
642 [self discardNonCommittedEntries]; 635 [self discardNonCommittedEntries];
643 } else if (0 < delta) { 636 } else if (_currentNavigationIndex < newNavigationIndex) {
644 for (int i = 0; i < delta; i++) { 637 // Going forward.
645 base::RecordAction(UserMetricsAction("Forward"));
646 }
647 [self discardTransientEntry]; 638 [self discardTransientEntry];
648 } else { 639 } else {
649 // delta is 0, no need to change current navigation index. 640 // |delta| is 0, no need to change current navigation index.
650 return; 641 return;
651 } 642 }
652 643
653 _previousNavigationIndex = _currentNavigationIndex; 644 _previousNavigationIndex = _currentNavigationIndex;
654 _currentNavigationIndex = newNavigationIndex; 645 _currentNavigationIndex = newNavigationIndex;
655 } 646 }
656 647
657 - (void)removeEntryAtIndex:(NSInteger)index { 648 - (void)removeEntryAtIndex:(NSInteger)index {
658 DCHECK(index < static_cast<NSInteger>([_entries count])); 649 DCHECK(index < static_cast<NSInteger>([_entries count]));
659 DCHECK(index != _currentNavigationIndex); 650 DCHECK(index != _currentNavigationIndex);
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 item->set_is_renderer_initiated(rendererInitiated); 855 item->set_is_renderer_initiated(rendererInitiated);
865 return [[CRWSessionEntry alloc] initWithNavigationItem:std::move(item)]; 856 return [[CRWSessionEntry alloc] initWithNavigationItem:std::move(item)];
866 } 857 }
867 858
868 - (BOOL)isRedirectTransitionForEntryAtIndex:(NSInteger)index { 859 - (BOOL)isRedirectTransitionForEntryAtIndex:(NSInteger)index {
869 ui::PageTransition transition = [self transitionForIndex:index]; 860 ui::PageTransition transition = [self transitionForIndex:index];
870 return (transition & ui::PAGE_TRANSITION_IS_REDIRECT_MASK) ? YES : NO; 861 return (transition & ui::PAGE_TRANSITION_IS_REDIRECT_MASK) ? YES : NO;
871 } 862 }
872 863
873 @end 864 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698