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

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

Issue 2892143002: Remove all feature flag checks in Delegate. (Closed)
Patch Set: fix Created 3 years, 7 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 | chrome/browser/ui/android/infobars/translate_infobar.cc » ('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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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_compact_infobar.h" 5 #include "chrome/browser/ui/android/infobars/translate_compact_infobar.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/android/jni_android.h" 9 #include "base/android/jni_android.h"
10 #include "base/android/jni_array.h" 10 #include "base/android/jni_array.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 if (action == InfoBarAndroid::ACTION_TRANSLATE) { 64 if (action == InfoBarAndroid::ACTION_TRANSLATE) {
65 action_flags_ |= FLAG_TRANSLATE; 65 action_flags_ |= FLAG_TRANSLATE;
66 delegate->Translate(); 66 delegate->Translate();
67 if (!delegate->ShouldAlwaysTranslate() && ShouldAutoAlwaysTranslate()) { 67 if (!delegate->ShouldAlwaysTranslate() && ShouldAutoAlwaysTranslate()) {
68 JNIEnv* env = base::android::AttachCurrentThread(); 68 JNIEnv* env = base::android::AttachCurrentThread();
69 Java_TranslateCompactInfoBar_setAutoAlwaysTranslate(env, 69 Java_TranslateCompactInfoBar_setAutoAlwaysTranslate(env,
70 GetJavaInfoBar()); 70 GetJavaInfoBar());
71 } 71 }
72 } else if (action == InfoBarAndroid::ACTION_TRANSLATE_SHOW_ORIGINAL) { 72 } else if (action == InfoBarAndroid::ACTION_TRANSLATE_SHOW_ORIGINAL) {
73 action_flags_ |= FLAG_REVERT; 73 action_flags_ |= FLAG_REVERT;
74 delegate->RevertTranslation(); 74 delegate->RevertWithoutClosingInfobar();
75 } else if (action == InfoBarAndroid::ACTION_CANCEL) { 75 } else if (action == InfoBarAndroid::ACTION_CANCEL) {
76 delegate->TranslationDeclined(); 76 delegate->TranslationDeclined();
77 } else { 77 } else {
78 DCHECK_EQ(InfoBarAndroid::ACTION_NONE, action); 78 DCHECK_EQ(InfoBarAndroid::ACTION_NONE, action);
79 } 79 }
80 } 80 }
81 81
82 void TranslateCompactInfoBar::SetJavaInfoBar( 82 void TranslateCompactInfoBar::SetJavaInfoBar(
83 const base::android::JavaRef<jobject>& java_info_bar) { 83 const base::android::JavaRef<jobject>& java_info_bar) {
84 InfoBarAndroid::SetJavaInfoBar(java_info_bar); 84 InfoBarAndroid::SetJavaInfoBar(java_info_bar);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 bool TranslateCompactInfoBar::IsDeclinedByUser() { 167 bool TranslateCompactInfoBar::IsDeclinedByUser() {
168 return action_flags_ == FLAG_NONE; 168 return action_flags_ == FLAG_NONE;
169 }; 169 };
170 170
171 // Native JNI methods --------------------------------------------------------- 171 // Native JNI methods ---------------------------------------------------------
172 172
173 // static 173 // static
174 bool RegisterTranslateCompactInfoBar(JNIEnv* env) { 174 bool RegisterTranslateCompactInfoBar(JNIEnv* env) {
175 return RegisterNativesImpl(env); 175 return RegisterNativesImpl(env);
176 } 176 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/android/infobars/translate_infobar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698