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

Unified Diff: chrome/browser/ui/android/infobars/infobar_android.cc

Issue 22694006: Infobar system refactor. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/android/infobars/infobar_android.cc
===================================================================
--- chrome/browser/ui/android/infobars/infobar_android.cc (revision 226624)
+++ chrome/browser/ui/android/infobars/infobar_android.cc (working copy)
@@ -28,11 +28,8 @@
// InfoBarAndroid -------------------------------------------------------------
-InfoBarAndroid::InfoBarAndroid(InfoBarService* owner, InfoBarDelegate* delegate)
- : InfoBar(owner, delegate),
- delegate_(delegate) {
- DCHECK(delegate_);
- DCHECK(delegate_->owner());
+InfoBarAndroid::InfoBarAndroid(scoped_ptr<InfoBarDelegate> delegate)
+ : InfoBar(delegate.Pass()) {
}
InfoBarAndroid::~InfoBarAndroid() {
@@ -60,19 +57,18 @@
jobject obj,
jint action,
jstring action_value) {
- DCHECK(delegate_);
std::string value = base::android::ConvertJavaStringToUTF8(env, action_value);
ProcessButton(action, value);
}
void InfoBarAndroid::OnCloseButtonClicked(JNIEnv* env, jobject obj) {
- delegate_->InfoBarDismissed();
+ delegate()->InfoBarDismissed();
+ CloseInfoBar(); // TODO(pkasting): Is this correct?
Miguel Garcia 2013/10/07 15:19:00 This method is being removed in https://codereview
Peter Kasting 2013/10/07 20:19:24 Sounds like I should just wait for that to go in a
}
void InfoBarAndroid::OnInfoBarClosed(JNIEnv* env, jobject obj) {
java_info_bar_.Reset(); // So we don't notify Java.
- if (owner())
- RemoveSelf();
+ RemoveSelf();
}
void InfoBarAndroid::CloseJavaInfoBar() {
@@ -83,14 +79,12 @@
}
int InfoBarAndroid::GetEnumeratedIconId() {
- DCHECK(delegate_);
- return ResourceMapper::MapFromChromiumId(delegate_->GetIconID());
+ return ResourceMapper::MapFromChromiumId(delegate()->GetIconID());
}
void InfoBarAndroid::CloseInfoBar() {
CloseJavaInfoBar();
- if (owner())
- RemoveSelf();
+ RemoveSelf();
}

Powered by Google App Engine
This is Rietveld 408576698