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

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

Issue 26176007: [InfoBar] Always close native infobars from C++ (Part I) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 }
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