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

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

Issue 22694006: Infobar system refactor. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years 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/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 12
13 // This infobar is shown by the GoogleURLTracker when the Google base URL has 13 // This infobar is shown by the GoogleURLTracker when the Google base URL has
14 // changed. 14 // changed.
15 class GoogleURLTrackerInfoBarDelegate : public ConfirmInfoBarDelegate { 15 class GoogleURLTrackerInfoBarDelegate : public ConfirmInfoBarDelegate {
16 public: 16 public:
17 // Creates a Google URL tracker infobar delegate and adds it to 17 // Creates a Google URL tracker infobar and delegate and adds the infobar to
18 // |infobar_service|. Returns the delegate if it was successfully added. 18 // |infobar_service|. Returns the infobar if it was successfully added.
19 static GoogleURLTrackerInfoBarDelegate* Create( 19 static InfoBar* Create(InfoBarService* infobar_service,
20 InfoBarService* infobar_service, 20 GoogleURLTracker* google_url_tracker,
21 GoogleURLTracker* google_url_tracker, 21 const GURL& search_url);
22 const GURL& search_url);
23 22
24 // ConfirmInfoBarDelegate: 23 // ConfirmInfoBarDelegate:
25 virtual bool Accept() OVERRIDE; 24 virtual bool Accept() OVERRIDE;
26 virtual bool Cancel() OVERRIDE; 25 virtual bool Cancel() OVERRIDE;
27 26
28 // Other than set_pending_id(), these accessors are only used by test code. 27 // Other than set_pending_id(), these accessors are only used by test code.
29 const GURL& search_url() const { return search_url_; } 28 const GURL& search_url() const { return search_url_; }
30 void set_search_url(const GURL& search_url) { search_url_ = search_url; } 29 void set_search_url(const GURL& search_url) { search_url_ = search_url; }
31 int pending_id() const { return pending_id_; } 30 int pending_id() const { return pending_id_; }
32 void set_pending_id(int pending_id) { pending_id_ = pending_id; } 31 void set_pending_id(int pending_id) { pending_id_ = pending_id; }
33 32
34 // These are virtual so test code can override them in a subclass. 33 // These are virtual so test code can override them in a subclass.
35 virtual void Update(const GURL& search_url); 34 virtual void Update(const GURL& search_url);
36 virtual void Close(bool redo_search); 35 virtual void Close(bool redo_search);
37 36
38 protected: 37 protected:
39 GoogleURLTrackerInfoBarDelegate(InfoBarService* infobar_service, 38 GoogleURLTrackerInfoBarDelegate(GoogleURLTracker* google_url_tracker,
40 GoogleURLTracker* google_url_tracker,
41 const GURL& search_url); 39 const GURL& search_url);
42 virtual ~GoogleURLTrackerInfoBarDelegate(); 40 virtual ~GoogleURLTrackerInfoBarDelegate();
43 41
44 private: 42 private:
45 // ConfirmInfoBarDelegate: 43 // ConfirmInfoBarDelegate:
46 virtual string16 GetMessageText() const OVERRIDE; 44 virtual string16 GetMessageText() const OVERRIDE;
47 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; 45 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE;
48 virtual string16 GetLinkText() const OVERRIDE; 46 virtual string16 GetLinkText() const OVERRIDE;
49 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE; 47 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE;
50 virtual bool ShouldExpireInternal( 48 virtual bool ShouldExpireInternal(
51 const content::LoadCommittedDetails& details) const OVERRIDE; 49 const content::LoadCommittedDetails& details) const OVERRIDE;
52 50
53 GoogleURLTracker* google_url_tracker_; 51 GoogleURLTracker* google_url_tracker_;
54 GURL search_url_; 52 GURL search_url_;
55 int pending_id_; 53 int pending_id_;
56 54
57 DISALLOW_COPY_AND_ASSIGN(GoogleURLTrackerInfoBarDelegate); 55 DISALLOW_COPY_AND_ASSIGN(GoogleURLTrackerInfoBarDelegate);
58 }; 56 };
59 57
60 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_INFOBAR_DELEGATE_H_ 58 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_INFOBAR_DELEGATE_H_
OLDNEW
« 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