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

Side by Side Diff: chrome/browser/ui/android/infobars/translate_infobar.cc

Issue 2968103002: Adds logging to indicate infobar creation in the native library, (Closed)
Patch Set: Created 3 years, 5 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 | components/translate/core/browser/translate_browser_metrics.h » ('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 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 "chrome/browser/ui/android/infobars/translate_infobar.h" 5 #include "chrome/browser/ui/android/infobars/translate_infobar.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/android/jni_android.h" 11 #include "base/android/jni_android.h"
12 #include "base/android/jni_array.h" 12 #include "base/android/jni_array.h"
13 #include "base/android/jni_string.h" 13 #include "base/android/jni_string.h"
14 #include "base/android/jni_weak_ref.h" 14 #include "base/android/jni_weak_ref.h"
15 #include "base/feature_list.h" 15 #include "base/feature_list.h"
16 #include "base/memory/ptr_util.h" 16 #include "base/memory/ptr_util.h"
17 #include "chrome/browser/translate/android/translate_utils.h" 17 #include "chrome/browser/translate/android/translate_utils.h"
18 #include "chrome/browser/translate/chrome_translate_client.h" 18 #include "chrome/browser/translate/chrome_translate_client.h"
19 #include "chrome/browser/ui/android/infobars/translate_compact_infobar.h" 19 #include "chrome/browser/ui/android/infobars/translate_compact_infobar.h"
20 #include "components/translate/core/browser/translate_browser_metrics.h"
20 #include "components/translate/core/browser/translate_infobar_delegate.h" 21 #include "components/translate/core/browser/translate_infobar_delegate.h"
21 #include "jni/TranslateInfoBar_jni.h" 22 #include "jni/TranslateInfoBar_jni.h"
22 23
23 using base::android::JavaParamRef; 24 using base::android::JavaParamRef;
24 using base::android::ScopedJavaLocalRef; 25 using base::android::ScopedJavaLocalRef;
25 26
26 // ChromeTranslateClient 27 // ChromeTranslateClient
27 // ---------------------------------------------------------- 28 // ----------------------------------------------------------
28 29
29 std::unique_ptr<infobars::InfoBar> ChromeTranslateClient::CreateInfoBar( 30 std::unique_ptr<infobars::InfoBar> ChromeTranslateClient::CreateInfoBar(
30 std::unique_ptr<translate::TranslateInfoBarDelegate> delegate) const { 31 std::unique_ptr<translate::TranslateInfoBarDelegate> delegate) const {
32 // Log metric to track how many times a brand new infobar was created to
33 // prompt the user to translate.
34 if (delegate.get()->translate_step() ==
35 translate::TRANSLATE_STEP_BEFORE_TRANSLATE) {
36 translate::TranslateBrowserMetrics::ReportInitiationStatus(
37 translate::TranslateBrowserMetrics::INITIATION_STATUS_CREATE_INFOBAR);
38 }
39
31 if (base::FeatureList::IsEnabled(translate::kTranslateCompactUI)) 40 if (base::FeatureList::IsEnabled(translate::kTranslateCompactUI))
32 return base::MakeUnique<TranslateCompactInfoBar>(std::move(delegate)); 41 return base::MakeUnique<TranslateCompactInfoBar>(std::move(delegate));
33 else 42
34 return base::MakeUnique<TranslateInfoBar>(std::move(delegate)); 43 return base::MakeUnique<TranslateInfoBar>(std::move(delegate));
35 } 44 }
36 45
37
38 // TranslateInfoBar ----------------------------------------------------------- 46 // TranslateInfoBar -----------------------------------------------------------
39 47
40 TranslateInfoBar::TranslateInfoBar( 48 TranslateInfoBar::TranslateInfoBar(
41 std::unique_ptr<translate::TranslateInfoBarDelegate> delegate) 49 std::unique_ptr<translate::TranslateInfoBarDelegate> delegate)
42 : InfoBarAndroid(std::move(delegate)) {} 50 : InfoBarAndroid(std::move(delegate)) {}
43 51
44 TranslateInfoBar::~TranslateInfoBar() { 52 TranslateInfoBar::~TranslateInfoBar() {
45 } 53 }
46 54
47 ScopedJavaLocalRef<jobject> TranslateInfoBar::CreateRenderInfoBar(JNIEnv* env) { 55 ScopedJavaLocalRef<jobject> TranslateInfoBar::CreateRenderInfoBar(JNIEnv* env) {
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 translate::TranslateInfoBarDelegate* TranslateInfoBar::GetDelegate() { 158 translate::TranslateInfoBarDelegate* TranslateInfoBar::GetDelegate() {
151 return delegate()->AsTranslateInfoBarDelegate(); 159 return delegate()->AsTranslateInfoBarDelegate();
152 } 160 }
153 161
154 162
155 // Native JNI methods --------------------------------------------------------- 163 // Native JNI methods ---------------------------------------------------------
156 164
157 bool RegisterTranslateInfoBarDelegate(JNIEnv* env) { 165 bool RegisterTranslateInfoBarDelegate(JNIEnv* env) {
158 return RegisterNativesImpl(env); 166 return RegisterNativesImpl(env);
159 } 167 }
OLDNEW
« no previous file with comments | « no previous file | components/translate/core/browser/translate_browser_metrics.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698