Chromium Code Reviews| Index: chrome/browser/google/google_url_tracker_infobar_delegate.h |
| diff --git a/chrome/browser/google/google_url_tracker_infobar_delegate.h b/chrome/browser/google/google_url_tracker_infobar_delegate.h |
| index 43972d64175d197c3880beda614d90b258e7eac3..f0c28d1eaa5ca90a7d6f87573b0ad45bfa377c49 100644 |
| --- a/chrome/browser/google/google_url_tracker_infobar_delegate.h |
| +++ b/chrome/browser/google/google_url_tracker_infobar_delegate.h |
| @@ -9,22 +9,37 @@ |
| #include "url/gurl.h" |
| class GoogleURLTracker; |
| -class InfoBarService; |
| +class GoogleURLTrackerNavigationHelper; |
| + |
| +namespace infobars { |
| +class InfoBarManager; |
| +} |
| // This infobar is shown by the GoogleURLTracker when the Google base URL has |
| // changed. |
| class GoogleURLTrackerInfoBarDelegate : public ConfirmInfoBarDelegate { |
| public: |
| // Creates a Google URL tracker infobar and delegate and adds the infobar to |
| - // |infobar_service|. Returns the infobar if it was successfully added. |
| - static infobars::InfoBar* Create(InfoBarService* infobar_service, |
| - GoogleURLTracker* google_url_tracker, |
| - const GURL& search_url); |
| + // |infobar_manager|. Returns the infobar if it was successfully added. |
| + static infobars::InfoBar* Create( |
| + infobars::InfoBarManager* infobar_manager, |
| + GoogleURLTracker* google_url_tracker, |
| + const GURL& search_url); |
| // ConfirmInfoBarDelegate: |
| virtual bool Accept() OVERRIDE; |
| virtual bool Cancel() OVERRIDE; |
| + GoogleURLTrackerNavigationHelper* navigation_helper() { |
| + return navigation_helper_weak_ptr_; |
| + } |
| + |
| + void set_navigation_helper( |
| + scoped_ptr<GoogleURLTrackerNavigationHelper> navigation_helper) { |
| + navigation_helper_ = navigation_helper.Pass(); |
| + navigation_helper_weak_ptr_ = navigation_helper_.get(); |
| + } |
| + |
| // Other than set_pending_id(), these accessors are only used by test code. |
| const GURL& search_url() const { return search_url_; } |
| void set_search_url(const GURL& search_url) { search_url_ = search_url; } |
| @@ -36,8 +51,9 @@ class GoogleURLTrackerInfoBarDelegate : public ConfirmInfoBarDelegate { |
| virtual void Close(bool redo_search); |
| protected: |
| - GoogleURLTrackerInfoBarDelegate(GoogleURLTracker* google_url_tracker, |
| - const GURL& search_url); |
| + GoogleURLTrackerInfoBarDelegate( |
| + GoogleURLTracker* google_url_tracker, |
| + const GURL& search_url); |
| virtual ~GoogleURLTrackerInfoBarDelegate(); |
| private: |
| @@ -50,6 +66,14 @@ class GoogleURLTrackerInfoBarDelegate : public ConfirmInfoBarDelegate { |
| const NavigationDetails& details) const OVERRIDE; |
| GoogleURLTracker* google_url_tracker_; |
| + scoped_ptr<GoogleURLTrackerNavigationHelper> navigation_helper_; |
| + |
| + // In certain corner cases, this object gives up ownership of |
|
Peter Kasting
2014/05/28 22:19:04
Nit: "In certain corner cases" -> "During Close()"
blundell
2014/05/30 09:39:18
Done.
|
| + // |navigation_helper_|, which then outlives this object. In these cases, |
| + // other classes still require that |navigation_helper()| return a pointer to |
|
Peter Kasting
2014/05/28 22:19:04
Nit: No || around function name
Maybe "Sometimes
blundell
2014/05/30 09:39:18
Done.
|
| + // the (still-valid) instance. The NavigationHelper instance is stored as a |
| + // weak pointer in addition to a strong pointer to facilitate this case. |
| + GoogleURLTrackerNavigationHelper* navigation_helper_weak_ptr_; |
| GURL search_url_; |
| int pending_id_; |