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

Side by Side Diff: ios/chrome/browser/ui/history/history_collection_view_controller.mm

Issue 2592843002: [ios] Adds history user action metrics (Closed)
Patch Set: Rebase Created 3 years, 11 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
« no previous file with comments | « no previous file | ios/chrome/browser/ui/history/history_panel_view_controller.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #include "ios/chrome/browser/ui/history/history_collection_view_controller.h" 5 #include "ios/chrome/browser/ui/history/history_collection_view_controller.h"
6 6
7 #import <MobileCoreServices/MobileCoreServices.h> 7 #import <MobileCoreServices/MobileCoreServices.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
11 #import "base/ios/weak_nsobject.h" 11 #import "base/ios/weak_nsobject.h"
12 #include "base/mac/foundation_util.h" 12 #include "base/mac/foundation_util.h"
13 #import "base/mac/objc_property_releaser.h" 13 #import "base/mac/objc_property_releaser.h"
14 #include "base/mac/scoped_nsobject.h" 14 #include "base/mac/scoped_nsobject.h"
15 #include "base/metrics/user_metrics.h"
16 #include "base/metrics/user_metrics_action.h"
15 #include "base/strings/sys_string_conversions.h" 17 #include "base/strings/sys_string_conversions.h"
16 #include "base/strings/utf_string_conversions.h" 18 #include "base/strings/utf_string_conversions.h"
17 #include "components/browsing_data/core/history_notice_utils.h" 19 #include "components/browsing_data/core/history_notice_utils.h"
18 #include "components/strings/grit/components_strings.h" 20 #include "components/strings/grit/components_strings.h"
19 #include "components/url_formatter/url_formatter.h" 21 #include "components/url_formatter/url_formatter.h"
20 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" 22 #include "ios/chrome/browser/browser_state/chrome_browser_state.h"
21 #include "ios/chrome/browser/chrome_url_constants.h" 23 #include "ios/chrome/browser/chrome_url_constants.h"
22 #import "ios/chrome/browser/signin/authentication_service.h" 24 #import "ios/chrome/browser/signin/authentication_service.h"
23 #include "ios/chrome/browser/signin/authentication_service_factory.h" 25 #include "ios/chrome/browser/signin/authentication_service_factory.h"
24 #include "ios/chrome/browser/sync/sync_setup_service.h" 26 #include "ios/chrome/browser/sync/sync_setup_service.h"
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 - (void)collectionView:(UICollectionView*)collectionView 476 - (void)collectionView:(UICollectionView*)collectionView
475 didSelectItemAtIndexPath:(NSIndexPath*)indexPath { 477 didSelectItemAtIndexPath:(NSIndexPath*)indexPath {
476 [super collectionView:collectionView didSelectItemAtIndexPath:indexPath]; 478 [super collectionView:collectionView didSelectItemAtIndexPath:indexPath];
477 479
478 if (self.isEditing) { 480 if (self.isEditing) {
479 [self.delegate historyCollectionViewControllerDidChangeEntrySelection:self]; 481 [self.delegate historyCollectionViewControllerDidChangeEntrySelection:self];
480 } else { 482 } else {
481 HistoryEntryItem* item = base::mac::ObjCCastStrict<HistoryEntryItem>( 483 HistoryEntryItem* item = base::mac::ObjCCastStrict<HistoryEntryItem>(
482 [self.collectionViewModel itemAtIndexPath:indexPath]); 484 [self.collectionViewModel itemAtIndexPath:indexPath]);
483 [self openURL:item.URL]; 485 [self openURL:item.URL];
486 if (self.isSearching) {
487 base::RecordAction(
488 base::UserMetricsAction("HistoryPage_SearchResultClick"));
489 } else {
490 base::RecordAction(base::UserMetricsAction("HistoryPage_EntryLinkClick"));
491 }
484 } 492 }
485 } 493 }
486 494
487 - (void)collectionView:(UICollectionView*)collectionView 495 - (void)collectionView:(UICollectionView*)collectionView
488 didDeselectItemAtIndexPath:(NSIndexPath*)indexPath { 496 didDeselectItemAtIndexPath:(NSIndexPath*)indexPath {
489 [super collectionView:collectionView didDeselectItemAtIndexPath:indexPath]; 497 [super collectionView:collectionView didDeselectItemAtIndexPath:indexPath];
490 [self.delegate historyCollectionViewControllerDidChangeEntrySelection:self]; 498 [self.delegate historyCollectionViewControllerDidChangeEntrySelection:self];
491 } 499 }
492 500
493 - (void)collectionView:(UICollectionView*)collectionView 501 - (void)collectionView:(UICollectionView*)collectionView
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 NSData* plainText = [base::SysUTF8ToNSString(URL.spec()) 816 NSData* plainText = [base::SysUTF8ToNSString(URL.spec())
809 dataUsingEncoding:NSUTF8StringEncoding]; 817 dataUsingEncoding:NSUTF8StringEncoding];
810 NSDictionary* copiedItem = @{ 818 NSDictionary* copiedItem = @{
811 (NSString*)kUTTypeURL : net::NSURLWithGURL(URL), 819 (NSString*)kUTTypeURL : net::NSURLWithGURL(URL),
812 (NSString*)kUTTypeUTF8PlainText : plainText, 820 (NSString*)kUTTypeUTF8PlainText : plainText,
813 }; 821 };
814 [[UIPasteboard generalPasteboard] setItems:@[ copiedItem ]]; 822 [[UIPasteboard generalPasteboard] setItems:@[ copiedItem ]];
815 } 823 }
816 824
817 @end 825 @end
OLDNEW
« no previous file with comments | « no previous file | ios/chrome/browser/ui/history/history_panel_view_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698