Chromium Code Reviews| 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(); |
| } |