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

Unified Diff: chrome/browser/google/google_url_tracker_infobar_delegate.h

Issue 293503003: Eliminate dependence of GoogleURLTracker et al. on InfoBarService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Response to review Created 6 years, 7 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/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..4905e1c8e82241d45d0de21746b1f7e2bb3f1f16 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_;
+
+ // During Close(), this object gives up ownership of |navigation_helper_|,
+ // which then outlives this object. Sometimes after this point, other classes
+ // still attempt to call navigation_helper() to access 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_;
« no previous file with comments | « chrome/browser/google/google_url_tracker.cc ('k') | chrome/browser/google/google_url_tracker_infobar_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698