| 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_H_ | 5 #ifndef CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_H_ |
| 6 #define CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_H_ | 6 #define CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 friend class GoogleURLTrackerTest; | 93 friend class GoogleURLTrackerTest; |
| 94 | 94 |
| 95 typedef std::map<const InfoBarTabHelper*, | 95 typedef std::map<const InfoBarTabHelper*, |
| 96 GoogleURLTrackerInfoBarDelegate*> InfoBarMap; | 96 GoogleURLTrackerInfoBarDelegate*> InfoBarMap; |
| 97 typedef GoogleURLTrackerInfoBarDelegate* (*InfoBarCreator)( | 97 typedef GoogleURLTrackerInfoBarDelegate* (*InfoBarCreator)( |
| 98 InfoBarTabHelper* infobar_helper, | 98 InfoBarTabHelper* infobar_helper, |
| 99 const GURL& search_url, | 99 const GURL& search_url, |
| 100 GoogleURLTracker* google_url_tracker, | 100 GoogleURLTracker* google_url_tracker, |
| 101 const GURL& new_google_url); | 101 const GURL& new_google_url); |
| 102 | 102 |
| 103 void AcceptGoogleURL(const GURL& google_url); | 103 void AcceptGoogleURL(const GURL& google_url, bool redo_searches); |
| 104 void CancelGoogleURL(const GURL& google_url); | 104 void CancelGoogleURL(const GURL& google_url); |
| 105 void InfoBarClosed(const InfoBarTabHelper* infobar_helper); | 105 void InfoBarClosed(const InfoBarTabHelper* infobar_helper); |
| 106 | 106 |
| 107 // Registers consumer interest in getting an updated URL from the server. | 107 // Registers consumer interest in getting an updated URL from the server. |
| 108 // It will be notified as chrome::GOOGLE_URL_UPDATED, so the | 108 // It will be notified as chrome::GOOGLE_URL_UPDATED, so the |
| 109 // consumer should observe this notification before calling this. | 109 // consumer should observe this notification before calling this. |
| 110 void SetNeedToFetch(); | 110 void SetNeedToFetch(); |
| 111 | 111 |
| 112 // Called when the five second startup sleep has finished. Runs any pending | 112 // Called when the five second startup sleep has finished. Runs any pending |
| 113 // fetch. | 113 // fetch. |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 const GURL& search_url, | 204 const GURL& search_url, |
| 205 GoogleURLTracker* google_url_tracker, | 205 GoogleURLTracker* google_url_tracker, |
| 206 const GURL& new_google_url); | 206 const GURL& new_google_url); |
| 207 | 207 |
| 208 // ConfirmInfoBarDelegate: | 208 // ConfirmInfoBarDelegate: |
| 209 virtual bool Accept() OVERRIDE; | 209 virtual bool Accept() OVERRIDE; |
| 210 virtual bool Cancel() OVERRIDE; | 210 virtual bool Cancel() OVERRIDE; |
| 211 virtual string16 GetLinkText() const OVERRIDE; | 211 virtual string16 GetLinkText() const OVERRIDE; |
| 212 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE; | 212 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE; |
| 213 | 213 |
| 214 // Allows GoogleURLTracker to change the Google base URL after the infobar has |
| 215 // been instantiated. This should only be called with an URL with the same |
| 216 // TLD as the existing one, so that the prompt we're displaying will still be |
| 217 // correct. |
| 218 void SetGoogleURL(const GURL& new_google_url); |
| 219 |
| 214 // These are virtual so test code can override them in a subclass. | 220 // These are virtual so test code can override them in a subclass. |
| 215 virtual void Show(); | 221 virtual void Show(); |
| 216 virtual void Close(bool redo_search); | 222 virtual void Close(bool redo_search); |
| 217 | 223 |
| 218 protected: | 224 protected: |
| 219 virtual ~GoogleURLTrackerInfoBarDelegate(); | 225 virtual ~GoogleURLTrackerInfoBarDelegate(); |
| 220 | 226 |
| 221 InfoBarTabHelper* map_key_; // What |google_url_tracker_| uses to track us. | 227 InfoBarTabHelper* map_key_; // What |google_url_tracker_| uses to track us. |
| 222 const GURL search_url_; | 228 const GURL search_url_; |
| 223 GoogleURLTracker* google_url_tracker_; | 229 GoogleURLTracker* google_url_tracker_; |
| 224 const GURL new_google_url_; | 230 GURL new_google_url_; |
| 225 bool showing_; // True if this delegate has been added to a TabContents. | 231 bool showing_; // True if this delegate has been added to a TabContents. |
| 226 | 232 |
| 227 private: | 233 private: |
| 228 // ConfirmInfoBarDelegate: | 234 // ConfirmInfoBarDelegate: |
| 229 virtual string16 GetMessageText() const OVERRIDE; | 235 virtual string16 GetMessageText() const OVERRIDE; |
| 230 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; | 236 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; |
| 231 | 237 |
| 232 // Returns the portion of the appropriate hostname to display. | |
| 233 string16 GetHost(bool new_host) const; | |
| 234 | |
| 235 DISALLOW_COPY_AND_ASSIGN(GoogleURLTrackerInfoBarDelegate); | 238 DISALLOW_COPY_AND_ASSIGN(GoogleURLTrackerInfoBarDelegate); |
| 236 }; | 239 }; |
| 237 | 240 |
| 238 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_H_ | 241 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_H_ |
| OLD | NEW |