OLD | NEW |
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 "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
9 #include "base/android/jni_helper.h" | 9 #include "base/android/jni_helper.h" |
10 #include "chrome/browser/translate/translate_infobar_delegate.h" | 10 #include "chrome/browser/translate/translate_infobar_delegate.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 return; | 65 return; |
66 } | 66 } |
67 | 67 |
68 if (action == InfoBarAndroid::ACTION_CANCEL) | 68 if (action == InfoBarAndroid::ACTION_CANCEL) |
69 delegate_->TranslationDeclined(); | 69 delegate_->TranslationDeclined(); |
70 else if (action == InfoBarAndroid::ACTION_TRANSLATE_SHOW_ORIGINAL) | 70 else if (action == InfoBarAndroid::ACTION_TRANSLATE_SHOW_ORIGINAL) |
71 delegate_->RevertTranslation(); | 71 delegate_->RevertTranslation(); |
72 else | 72 else |
73 DCHECK_EQ(InfoBarAndroid::ACTION_NONE, action); | 73 DCHECK_EQ(InfoBarAndroid::ACTION_NONE, action); |
74 | 74 |
75 CloseInfoBar(); | 75 RemoveSelf(); |
76 } | 76 } |
77 | 77 |
78 void TranslateInfoBar::PassJavaInfoBar(InfoBarAndroid* source) { | 78 void TranslateInfoBar::PassJavaInfoBar(InfoBarAndroid* source) { |
79 DCHECK_NE( | 79 DCHECK_NE( |
80 delegate_->infobar_type(), TranslateInfoBarDelegate::BEFORE_TRANSLATE); | 80 delegate_->infobar_type(), TranslateInfoBarDelegate::BEFORE_TRANSLATE); |
81 | 81 |
82 // Ask the former bar to transfer ownership to us. | 82 // Ask the former bar to transfer ownership to us. |
83 DCHECK(source != NULL); | 83 DCHECK(source != NULL); |
84 static_cast<TranslateInfoBar*>(source)->TransferOwnership( | 84 static_cast<TranslateInfoBar*>(source)->TransferOwnership( |
85 this, delegate_->infobar_type()); | 85 this, delegate_->infobar_type()); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 TranslateInfoBarDelegate::BEFORE_TRANSLATE) && | 128 TranslateInfoBarDelegate::BEFORE_TRANSLATE) && |
129 (delegate_->ShouldShowNeverTranslateShortcut()); | 129 (delegate_->ShouldShowNeverTranslateShortcut()); |
130 } | 130 } |
131 | 131 |
132 | 132 |
133 // Native JNI methods --------------------------------------------------------- | 133 // Native JNI methods --------------------------------------------------------- |
134 | 134 |
135 bool RegisterTranslateInfoBarDelegate(JNIEnv* env) { | 135 bool RegisterTranslateInfoBarDelegate(JNIEnv* env) { |
136 return RegisterNativesImpl(env); | 136 return RegisterNativesImpl(env); |
137 } | 137 } |
OLD | NEW |