| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/google/google_url_tracker_map_entry.h" | 5 #include "chrome/browser/google/google_url_tracker_map_entry.h" |
| 6 | 6 |
| 7 #include "chrome/browser/google/google_url_tracker.h" | 7 #include "chrome/browser/google/google_url_tracker.h" |
| 8 #include "chrome/browser/google/google_url_tracker_infobar_delegate.h" | 8 #include "chrome/browser/google/google_url_tracker_infobar_delegate.h" |
| 9 #include "chrome/browser/infobars/infobar.h" | 9 #include "chrome/browser/infobars/infobar.h" |
| 10 #include "chrome/common/chrome_notification_types.h" | 10 #include "chrome/common/chrome_notification_types.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 void GoogleURLTrackerMapEntry::SetInfoBar( | 41 void GoogleURLTrackerMapEntry::SetInfoBar( |
| 42 GoogleURLTrackerInfoBarDelegate* infobar) { | 42 GoogleURLTrackerInfoBarDelegate* infobar) { |
| 43 DCHECK(!infobar_); | 43 DCHECK(!infobar_); |
| 44 infobar_ = infobar; | 44 infobar_ = infobar; |
| 45 registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, | 45 registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, |
| 46 content::Source<InfoBarTabHelper>(infobar_helper_)); | 46 content::Source<InfoBarTabHelper>(infobar_helper_)); |
| 47 } | 47 } |
| 48 | 48 |
| 49 void GoogleURLTrackerMapEntry::Close(bool redo_search) { | 49 void GoogleURLTrackerMapEntry::Close(bool redo_search) { |
| 50 if (infobar_) | 50 if (infobar_) { |
| 51 infobar_->Close(redo_search); | 51 infobar_->Close(redo_search); |
| 52 else | 52 } else { |
| 53 // WARNING: |infobar_helper_| may point to a deleted object. Do not |
| 54 // dereference it! See GoogleURLTracker::OnTabClosed(). |
| 53 google_url_tracker_->DeleteMapEntryForHelper(infobar_helper_); | 55 google_url_tracker_->DeleteMapEntryForHelper(infobar_helper_); |
| 56 } |
| 54 // WARNING: At this point |this| has been deleted! | 57 // WARNING: At this point |this| has been deleted! |
| 55 } | 58 } |
| OLD | NEW |