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

Side by Side Diff: ios/chrome/browser/metrics/first_user_action_recorder.cc

Issue 2592173002: Fix ios_chrome_unittests to crash on DCHECK failure. (Closed)
Patch Set: Address comments Created 3 years, 12 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 #include "ios/chrome/browser/metrics/first_user_action_recorder.h" 5 #include "ios/chrome/browser/metrics/first_user_action_recorder.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 } // namespace 84 } // namespace
85 85
86 FirstUserActionRecorder::FirstUserActionRecorder( 86 FirstUserActionRecorder::FirstUserActionRecorder(
87 base::TimeDelta background_duration) 87 base::TimeDelta background_duration)
88 : device_family_(IsIPadIdiom() ? TABLET : HANDSET), 88 : device_family_(IsIPadIdiom() ? TABLET : HANDSET),
89 recorded_action_(false), 89 recorded_action_(false),
90 action_pending_(false), 90 action_pending_(false),
91 background_duration_(background_duration), 91 background_duration_(background_duration),
92 action_callback_(base::Bind(&FirstUserActionRecorder::OnUserAction, 92 action_callback_(base::Bind(&FirstUserActionRecorder::OnUserAction,
93 base::Unretained(this))) { 93 base::Unretained(this))) {
94 base::SetRecordActionTaskRunner(
95 web::WebThread::GetTaskRunnerForThread(web::WebThread::UI));
96 base::AddActionCallback(action_callback_); 94 base::AddActionCallback(action_callback_);
97 } 95 }
98 96
99 FirstUserActionRecorder::~FirstUserActionRecorder() { 97 FirstUserActionRecorder::~FirstUserActionRecorder() {
100 base::RemoveActionCallback(action_callback_); 98 base::RemoveActionCallback(action_callback_);
101 } 99 }
102 100
103 void FirstUserActionRecorder::Expire() { 101 void FirstUserActionRecorder::Expire() {
104 std::string log_message = "Recording 'Expiration' for first user action type"; 102 std::string log_message = "Recording 'Expiration' for first user action type";
105 RecordAction(EXPIRATION, log_message); 103 RecordAction(EXPIRATION, log_message);
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 195
198 bool FirstUserActionRecorder::ArrayContainsString(const char* to_search[], 196 bool FirstUserActionRecorder::ArrayContainsString(const char* to_search[],
199 const size_t to_search_size, 197 const size_t to_search_size,
200 const char* to_find) { 198 const char* to_find) {
201 for (size_t i = 0; i < to_search_size; ++i) { 199 for (size_t i = 0; i < to_search_size; ++i) {
202 if (strcmp(to_find, to_search[i]) == 0) 200 if (strcmp(to_find, to_search[i]) == 0)
203 return true; 201 return true;
204 } 202 }
205 return false; 203 return false;
206 } 204 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698