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

Side by Side Diff: chrome/browser/ui/android/infobars/confirm_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
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/confirm_infobar.h" 5 #include "chrome/browser/ui/android/infobars/confirm_infobar.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "chrome/browser/android/resource_mapper.h" 10 #include "chrome/browser/android/resource_mapper.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 } 63 }
64 64
65 void ConfirmInfoBar::ProcessButton(int action, 65 void ConfirmInfoBar::ProcessButton(int action,
66 const std::string& action_value) { 66 const std::string& action_value) {
67 if (!owner()) 67 if (!owner())
68 return; // We're closing; don't call anything, it might access the owner. 68 return; // We're closing; don't call anything, it might access the owner.
69 DCHECK((action == InfoBarAndroid::ACTION_OK) || 69 DCHECK((action == InfoBarAndroid::ACTION_OK) ||
70 (action == InfoBarAndroid::ACTION_CANCEL)); 70 (action == InfoBarAndroid::ACTION_CANCEL));
71 if ((action == InfoBarAndroid::ACTION_OK) ? 71 if ((action == InfoBarAndroid::ACTION_OK) ?
72 delegate_->Accept() : delegate_->Cancel()) 72 delegate_->Accept() : delegate_->Cancel())
73 // TODO(miguelg): Consider RemoveSelf(); instead. 73 RemoveSelf();
74 CloseInfoBar();
75 } 74 }
76 75
77 string16 ConfirmInfoBar::GetTextFor( 76 string16 ConfirmInfoBar::GetTextFor(
78 ConfirmInfoBarDelegate::InfoBarButton button) { 77 ConfirmInfoBarDelegate::InfoBarButton button) {
79 return (delegate_->GetButtons() & button) ? 78 return (delegate_->GetButtons() & button) ?
80 delegate_->GetButtonLabel(button) : string16(); 79 delegate_->GetButtonLabel(button) : string16();
81 } 80 }
82 81
83 82
84 // Native JNI methods --------------------------------------------------------- 83 // Native JNI methods ---------------------------------------------------------
85 84
86 bool RegisterConfirmInfoBarDelegate(JNIEnv* env) { 85 bool RegisterConfirmInfoBarDelegate(JNIEnv* env) {
87 return RegisterNativesImpl(env); 86 return RegisterNativesImpl(env);
88 } 87 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698