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

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

Issue 26263002: [InfoBar] Always close native infobars from C++. Part II (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/android/infobars/infobar_android.cc ('k') | no next file » | 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 "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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 ShouldDisplayNeverTranslateInfoBarOnCancel(), 52 ShouldDisplayNeverTranslateInfoBarOnCancel(),
53 java_languages.obj()); 53 java_languages.obj());
54 } 54 }
55 55
56 void TranslateInfoBar::ProcessButton( 56 void TranslateInfoBar::ProcessButton(
57 int action, const std::string& action_value) { 57 int action, const std::string& action_value) {
58 if (!owner()) 58 if (!owner())
59 return; // We're closing; don't call anything, it might access the owner. 59 return; // We're closing; don't call anything, it might access the owner.
60 60
61 if (action == InfoBarAndroid::ACTION_TRANSLATE) { 61 if (action == InfoBarAndroid::ACTION_TRANSLATE) {
62 // Do not close the infobar upon translate since it will be replaced by a
63 // different one which will close this current infobar.
64 delegate_->Translate(); 62 delegate_->Translate();
65 return; 63 return;
66 } 64 }
67 65
68 if (action == InfoBarAndroid::ACTION_CANCEL) 66 if (action == InfoBarAndroid::ACTION_CANCEL)
69 delegate_->TranslationDeclined(); 67 delegate_->TranslationDeclined();
70 else if (action == InfoBarAndroid::ACTION_TRANSLATE_SHOW_ORIGINAL) 68 else if (action == InfoBarAndroid::ACTION_TRANSLATE_SHOW_ORIGINAL)
71 delegate_->RevertTranslation(); 69 delegate_->RevertTranslation();
72 else 70 else
73 DCHECK_EQ(InfoBarAndroid::ACTION_NONE, action); 71 DCHECK_EQ(InfoBarAndroid::ACTION_NONE, action);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 TranslateInfoBarDelegate::BEFORE_TRANSLATE) && 126 TranslateInfoBarDelegate::BEFORE_TRANSLATE) &&
129 (delegate_->ShouldShowNeverTranslateShortcut()); 127 (delegate_->ShouldShowNeverTranslateShortcut());
130 } 128 }
131 129
132 130
133 // Native JNI methods --------------------------------------------------------- 131 // Native JNI methods ---------------------------------------------------------
134 132
135 bool RegisterTranslateInfoBarDelegate(JNIEnv* env) { 133 bool RegisterTranslateInfoBarDelegate(JNIEnv* env) {
136 return RegisterNativesImpl(env); 134 return RegisterNativesImpl(env);
137 } 135 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/android/infobars/infobar_android.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698