Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / google / google_url_tracker_infobar_delegate.h
blobcbeab033464190bf6be651d114107bdd8505c966
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_INFOBAR_DELEGATE_H_
6 #define CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_INFOBAR_DELEGATE_H_
8 #include "chrome/browser/infobars/confirm_infobar_delegate.h"
9 #include "url/gurl.h"
11 class GoogleURLTracker;
13 // This infobar is shown by the GoogleURLTracker when the Google base URL has
14 // changed.
15 class GoogleURLTrackerInfoBarDelegate : public ConfirmInfoBarDelegate {
16 public:
17 // Creates a Google URL tracker infobar and delegate and adds the infobar to
18 // |infobar_service|. Returns the infobar if it was successfully added.
19 static InfoBar* Create(InfoBarService* infobar_service,
20 GoogleURLTracker* google_url_tracker,
21 const GURL& search_url);
23 // ConfirmInfoBarDelegate:
24 virtual bool Accept() OVERRIDE;
25 virtual bool Cancel() OVERRIDE;
27 // Other than set_pending_id(), these accessors are only used by test code.
28 const GURL& search_url() const { return search_url_; }
29 void set_search_url(const GURL& search_url) { search_url_ = search_url; }
30 int pending_id() const { return pending_id_; }
31 void set_pending_id(int pending_id) { pending_id_ = pending_id; }
33 // These are virtual so test code can override them in a subclass.
34 virtual void Update(const GURL& search_url);
35 virtual void Close(bool redo_search);
37 protected:
38 GoogleURLTrackerInfoBarDelegate(GoogleURLTracker* google_url_tracker,
39 const GURL& search_url);
40 virtual ~GoogleURLTrackerInfoBarDelegate();
42 private:
43 // ConfirmInfoBarDelegate:
44 virtual base::string16 GetMessageText() const OVERRIDE;
45 virtual base::string16 GetButtonLabel(InfoBarButton button) const OVERRIDE;
46 virtual base::string16 GetLinkText() const OVERRIDE;
47 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE;
48 virtual bool ShouldExpireInternal(
49 const content::LoadCommittedDetails& details) const OVERRIDE;
51 GoogleURLTracker* google_url_tracker_;
52 GURL search_url_;
53 int pending_id_;
55 DISALLOW_COPY_AND_ASSIGN(GoogleURLTrackerInfoBarDelegate);
58 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_INFOBAR_DELEGATE_H_