| 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 #ifndef CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_INFOBAR_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_INFOBAR_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_INFOBAR_DELEGATE_H_ | 6 #define CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_INFOBAR_DELEGATE_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/infobars/confirm_infobar_delegate.h" | 8 #include "chrome/browser/infobars/confirm_infobar_delegate.h" |
| 9 #include "url/gurl.h" | 9 #include "url/gurl.h" |
| 10 | 10 |
| 11 class GoogleURLTracker; | 11 class GoogleURLTracker; |
| 12 class InfoBarService; | 12 class GoogleURLTrackerNavigationHelper; |
| 13 |
| 14 namespace infobars { |
| 15 class InfoBarManager; |
| 16 } |
| 13 | 17 |
| 14 // This infobar is shown by the GoogleURLTracker when the Google base URL has | 18 // This infobar is shown by the GoogleURLTracker when the Google base URL has |
| 15 // changed. | 19 // changed. |
| 16 class GoogleURLTrackerInfoBarDelegate : public ConfirmInfoBarDelegate { | 20 class GoogleURLTrackerInfoBarDelegate : public ConfirmInfoBarDelegate { |
| 17 public: | 21 public: |
| 18 // Creates a Google URL tracker infobar and delegate and adds the infobar to | 22 // Creates a Google URL tracker infobar and delegate and adds the infobar to |
| 19 // |infobar_service|. Returns the infobar if it was successfully added. | 23 // |infobar_manager|. Returns the infobar if it was successfully added. |
| 20 static infobars::InfoBar* Create(InfoBarService* infobar_service, | 24 static infobars::InfoBar* Create( |
| 21 GoogleURLTracker* google_url_tracker, | 25 infobars::InfoBarManager* infobar_manager, |
| 22 const GURL& search_url); | 26 GoogleURLTracker* google_url_tracker, |
| 27 GoogleURLTrackerNavigationHelper* navigation_helper, |
| 28 const GURL& search_url); |
| 23 | 29 |
| 24 // ConfirmInfoBarDelegate: | 30 // ConfirmInfoBarDelegate: |
| 25 virtual bool Accept() OVERRIDE; | 31 virtual bool Accept() OVERRIDE; |
| 26 virtual bool Cancel() OVERRIDE; | 32 virtual bool Cancel() OVERRIDE; |
| 27 | 33 |
| 28 // Other than set_pending_id(), these accessors are only used by test code. | 34 // Other than set_pending_id(), these accessors are only used by test code. |
| 29 const GURL& search_url() const { return search_url_; } | 35 const GURL& search_url() const { return search_url_; } |
| 30 void set_search_url(const GURL& search_url) { search_url_ = search_url; } | 36 void set_search_url(const GURL& search_url) { search_url_ = search_url; } |
| 31 int pending_id() const { return pending_id_; } | 37 int pending_id() const { return pending_id_; } |
| 32 void set_pending_id(int pending_id) { pending_id_ = pending_id; } | 38 void set_pending_id(int pending_id) { pending_id_ = pending_id; } |
| 33 | 39 |
| 34 // These are virtual so test code can override them in a subclass. | 40 // These are virtual so test code can override them in a subclass. |
| 35 virtual void Update(const GURL& search_url); | 41 virtual void Update(const GURL& search_url); |
| 36 virtual void Close(bool redo_search); | 42 virtual void Close(bool redo_search); |
| 37 | 43 |
| 38 protected: | 44 protected: |
| 39 GoogleURLTrackerInfoBarDelegate(GoogleURLTracker* google_url_tracker, | 45 GoogleURLTrackerInfoBarDelegate( |
| 40 const GURL& search_url); | 46 GoogleURLTracker* google_url_tracker, |
| 47 GoogleURLTrackerNavigationHelper* navigation_helper, |
| 48 const GURL& search_url); |
| 41 virtual ~GoogleURLTrackerInfoBarDelegate(); | 49 virtual ~GoogleURLTrackerInfoBarDelegate(); |
| 42 | 50 |
| 43 private: | 51 private: |
| 44 // ConfirmInfoBarDelegate: | 52 // ConfirmInfoBarDelegate: |
| 45 virtual base::string16 GetMessageText() const OVERRIDE; | 53 virtual base::string16 GetMessageText() const OVERRIDE; |
| 46 virtual base::string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; | 54 virtual base::string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; |
| 47 virtual base::string16 GetLinkText() const OVERRIDE; | 55 virtual base::string16 GetLinkText() const OVERRIDE; |
| 48 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE; | 56 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE; |
| 49 virtual bool ShouldExpireInternal( | 57 virtual bool ShouldExpireInternal( |
| 50 const NavigationDetails& details) const OVERRIDE; | 58 const NavigationDetails& details) const OVERRIDE; |
| 51 | 59 |
| 52 GoogleURLTracker* google_url_tracker_; | 60 GoogleURLTracker* google_url_tracker_; |
| 61 GoogleURLTrackerNavigationHelper* navigation_helper_; |
| 53 GURL search_url_; | 62 GURL search_url_; |
| 54 int pending_id_; | 63 int pending_id_; |
| 55 | 64 |
| 56 DISALLOW_COPY_AND_ASSIGN(GoogleURLTrackerInfoBarDelegate); | 65 DISALLOW_COPY_AND_ASSIGN(GoogleURLTrackerInfoBarDelegate); |
| 57 }; | 66 }; |
| 58 | 67 |
| 59 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_INFOBAR_DELEGATE_H_ | 68 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_INFOBAR_DELEGATE_H_ |
| OLD | NEW |