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

Side by Side Diff: chrome/browser/google/google_url_tracker_infobar_delegate.h

Issue 11114009: Split the existing GoogleURLTrackerInfoBarDelegate into two classes (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/api/infobars/confirm_infobar_delegate.h" 8 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h"
9 #include "googleurl/src/gurl.h" 9 #include "googleurl/src/gurl.h"
10 10
11 class GoogleURLTracker; 11 class GoogleURLTracker;
12 class InfoBarTabHelper; 12 class InfoBarTabHelper;
13 13
14 // This infobar is shown by the GoogleURLTracker when the Google base URL has 14 // This infobar is shown by the GoogleURLTracker when the Google base URL has
15 // changed. 15 // changed.
16 class GoogleURLTrackerInfoBarDelegate : public ConfirmInfoBarDelegate { 16 class GoogleURLTrackerInfoBarDelegate : public ConfirmInfoBarDelegate {
17 public: 17 public:
18 GoogleURLTrackerInfoBarDelegate(InfoBarTabHelper* infobar_helper, 18 GoogleURLTrackerInfoBarDelegate(InfoBarTabHelper* infobar_helper,
19 GoogleURLTracker* google_url_tracker, 19 GoogleURLTracker* google_url_tracker,
20 const GURL& new_google_url); 20 const GURL& search_url);
21 21
22 // ConfirmInfoBarDelegate: 22 // ConfirmInfoBarDelegate:
23 virtual bool Accept() OVERRIDE; 23 virtual bool Accept() OVERRIDE;
24 virtual bool Cancel() OVERRIDE; 24 virtual bool Cancel() OVERRIDE;
25 virtual string16 GetLinkText() const OVERRIDE; 25 virtual string16 GetLinkText() const OVERRIDE;
26 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE; 26 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE;
27 virtual bool ShouldExpireInternal( 27 virtual bool ShouldExpireInternal(
28 const content::LoadCommittedDetails& details) const OVERRIDE; 28 const content::LoadCommittedDetails& details) const OVERRIDE;
29 29
30 // Allows GoogleURLTracker to change the Google base URL after the infobar has
31 // been instantiated. This should only be called with an URL with the same
32 // TLD as the existing one, so that the prompt we're displaying will still be
33 // correct.
34 void SetGoogleURL(const GURL& new_google_url);
35
36 bool showing() const { return showing_; }
37 void set_pending_id(int pending_id) { pending_id_ = pending_id; } 30 void set_pending_id(int pending_id) { pending_id_ = pending_id; }
38 31
39 // These are virtual so test code can override them in a subclass. 32 // These are virtual so test code can override them in a subclass.
40 virtual void Show(const GURL& search_url); 33 virtual void Update(const GURL& search_url);
41 virtual void Close(bool redo_search); 34 virtual void Close(bool redo_search);
42 35
43 protected: 36 protected:
44 virtual ~GoogleURLTrackerInfoBarDelegate(); 37 virtual ~GoogleURLTrackerInfoBarDelegate();
45 38
46 InfoBarTabHelper* map_key_; // What |google_url_tracker_| uses to track us. 39 GoogleURLTracker* google_url_tracker_;
47 GURL search_url_; 40 GURL search_url_;
48 GoogleURLTracker* google_url_tracker_;
49 GURL new_google_url_;
50 bool showing_; // True if this delegate has been added to a TabContents.
51 int pending_id_; 41 int pending_id_;
Ilya Sherman 2012/10/16 20:16:24 nit: Class members should always have private visi
Peter Kasting 2012/10/16 23:29:35 Done.
52 42
53 private: 43 private:
54 // ConfirmInfoBarDelegate: 44 // ConfirmInfoBarDelegate:
55 virtual string16 GetMessageText() const OVERRIDE; 45 virtual string16 GetMessageText() const OVERRIDE;
56 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; 46 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE;
57 47
58 DISALLOW_COPY_AND_ASSIGN(GoogleURLTrackerInfoBarDelegate); 48 DISALLOW_COPY_AND_ASSIGN(GoogleURLTrackerInfoBarDelegate);
59 }; 49 };
60 50
61 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_INFOBAR_DELEGATE_H_ 51 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_INFOBAR_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698