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

Side by Side Diff: chrome/browser/translate/chrome_translate_client.cc

Issue 2916873004: Quick fix for logging. (Closed)
Patch Set: updates Created 3 years, 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/translate/chrome_translate_client.h" 5 #include "chrome/browser/translate/chrome_translate_client.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 79
80 syncer::UserEventService* const user_event_service = 80 syncer::UserEventService* const user_event_service =
81 browser_sync::UserEventServiceFactory::GetForProfile(profile); 81 browser_sync::UserEventServiceFactory::GetForProfile(profile);
82 82
83 const auto* const entry = 83 const auto* const entry =
84 web_contents->GetController().GetLastCommittedEntry(); 84 web_contents->GetController().GetLastCommittedEntry();
85 85
86 // If entry is null, we don't record the page. 86 // If entry is null, we don't record the page.
87 // The navigation entry can be null in situations like download or initial 87 // The navigation entry can be null in situations like download or initial
88 // blank page. 88 // blank page.
89 if (entry != nullptr) { 89 DCHECK(web_contents);
90 if (entry != nullptr &&
91 TranslateService::IsTranslatableURL(entry->GetVirtualURL())) {
90 user_event_service->RecordUserEvent( 92 user_event_service->RecordUserEvent(
91 translate::ConstructLanguageDetectionEvent(details)); 93 translate::ConstructLanguageDetectionEvent(
94 entry->GetTimestamp().ToInternalValue(), details));
92 } 95 }
93 } 96 }
94 97
95 } // namespace 98 } // namespace
96 99
97 DEFINE_WEB_CONTENTS_USER_DATA_KEY(ChromeTranslateClient); 100 DEFINE_WEB_CONTENTS_USER_DATA_KEY(ChromeTranslateClient);
98 101
99 ChromeTranslateClient::ChromeTranslateClient(content::WebContents* web_contents) 102 ChromeTranslateClient::ChromeTranslateClient(content::WebContents* web_contents)
100 : content::WebContentsObserver(web_contents), 103 : content::WebContentsObserver(web_contents),
101 translate_driver_(&web_contents->GetController()), 104 translate_driver_(&web_contents->GetController()),
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 return ShowTranslateBubbleResult::SUCCESS; 395 return ShowTranslateBubbleResult::SUCCESS;
393 } 396 }
394 397
395 return TranslateBubbleFactory::Show(browser->window(), web_contents(), step, 398 return TranslateBubbleFactory::Show(browser->window(), web_contents(), step,
396 error_type); 399 error_type);
397 #else 400 #else
398 NOTREACHED(); 401 NOTREACHED();
399 return ShowTranslateBubbleResult::SUCCESS; 402 return ShowTranslateBubbleResult::SUCCESS;
400 #endif 403 #endif
401 } 404 }
OLDNEW
« no previous file with comments | « chrome/browser/translate/chrome_translate_client.h ('k') | chrome/browser/translate/chrome_translate_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698