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

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_infobar_delegate.h" 20 #include "components/translate/core/browser/translate_infobar_delegate.h"
21 #include "components/translate/core/browser/translate_browser_metrics.h"
napper 2017/07/06 05:09:01 sort
ramyasharma 2017/07/06 06:05:53 Done.
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 {
31 if (base::FeatureList::IsEnabled(translate::kTranslateCompactUI)) 32 if (base::FeatureList::IsEnabled(translate::kTranslateCompactUI)) {
33 translate::TranslateBrowserMetrics::ReportInitiationStatus(
34 translate::TranslateBrowserMetrics::INITIATION_STATUS_CREATE_INFOBAR);
32 return base::MakeUnique<TranslateCompactInfoBar>(std::move(delegate)); 35 return base::MakeUnique<TranslateCompactInfoBar>(std::move(delegate));
33 else 36 }
napper 2017/07/06 05:09:01 } else {
ramyasharma 2017/07/06 06:05:53 Done.
37 else {
napper 2017/07/06 05:09:01 Note that the style guide says don't use else afte
ramyasharma 2017/07/06 06:05:53 Done.
38 if (delegate.get()->translate_step() ==
39 translate::TRANSLATE_STEP_BEFORE_TRANSLATE) {
40 translate::TranslateBrowserMetrics::ReportInitiationStatus(
41 translate::TranslateBrowserMetrics::INITIATION_STATUS_CREATE_INFOBAR);
42 }
34 return base::MakeUnique<TranslateInfoBar>(std::move(delegate)); 43 return base::MakeUnique<TranslateInfoBar>(std::move(delegate));
44 }
35 } 45 }
36 46
37
38 // TranslateInfoBar ----------------------------------------------------------- 47 // TranslateInfoBar -----------------------------------------------------------
39 48
40 TranslateInfoBar::TranslateInfoBar( 49 TranslateInfoBar::TranslateInfoBar(
41 std::unique_ptr<translate::TranslateInfoBarDelegate> delegate) 50 std::unique_ptr<translate::TranslateInfoBarDelegate> delegate)
42 : InfoBarAndroid(std::move(delegate)) {} 51 : InfoBarAndroid(std::move(delegate)) {}
43 52
44 TranslateInfoBar::~TranslateInfoBar() { 53 TranslateInfoBar::~TranslateInfoBar() {
45 } 54 }
46 55
47 ScopedJavaLocalRef<jobject> TranslateInfoBar::CreateRenderInfoBar(JNIEnv* env) { 56 ScopedJavaLocalRef<jobject> TranslateInfoBar::CreateRenderInfoBar(JNIEnv* env) {
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 translate::TranslateInfoBarDelegate* TranslateInfoBar::GetDelegate() { 159 translate::TranslateInfoBarDelegate* TranslateInfoBar::GetDelegate() {
151 return delegate()->AsTranslateInfoBarDelegate(); 160 return delegate()->AsTranslateInfoBarDelegate();
152 } 161 }
153 162
154 163
155 // Native JNI methods --------------------------------------------------------- 164 // Native JNI methods ---------------------------------------------------------
156 165
157 bool RegisterTranslateInfoBarDelegate(JNIEnv* env) { 166 bool RegisterTranslateInfoBarDelegate(JNIEnv* env) {
158 return RegisterNativesImpl(env); 167 return RegisterNativesImpl(env);
159 } 168 }
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