OLD | NEW |
| (Empty) |
1 // Copyright 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. | |
4 | |
5 #ifndef CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_MAP_ENTRY_H_ | |
6 #define CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_MAP_ENTRY_H_ | |
7 | |
8 #include "base/memory/scoped_ptr.h" | |
9 #include "chrome/browser/google/google_url_tracker_infobar_delegate.h" | |
10 #include "chrome/browser/google/google_url_tracker_navigation_helper.h" | |
11 #include "components/infobars/core/infobar_manager.h" | |
12 | |
13 class GoogleURLTracker; | |
14 | |
15 namespace infobars { | |
16 class InfoBarManager; | |
17 } | |
18 | |
19 class GoogleURLTrackerMapEntry : public infobars::InfoBarManager::Observer { | |
20 public: | |
21 GoogleURLTrackerMapEntry( | |
22 GoogleURLTracker* google_url_tracker, | |
23 infobars::InfoBarManager* infobar_manager, | |
24 scoped_ptr<GoogleURLTrackerNavigationHelper> navigation_helper); | |
25 virtual ~GoogleURLTrackerMapEntry(); | |
26 | |
27 bool has_infobar_delegate() const { return !!infobar_delegate_; } | |
28 GoogleURLTrackerInfoBarDelegate* infobar_delegate() { | |
29 return infobar_delegate_; | |
30 } | |
31 void SetInfoBarDelegate(GoogleURLTrackerInfoBarDelegate* infobar_delegate); | |
32 | |
33 GoogleURLTrackerNavigationHelper* navigation_helper() { | |
34 // This object gives ownership of |navigation_helper_| to the infobar | |
35 // delegate in SetInfoBarDelegate(). | |
36 return has_infobar_delegate() ? | |
37 infobar_delegate_->navigation_helper() : navigation_helper_.get(); | |
38 } | |
39 | |
40 const infobars::InfoBarManager* infobar_manager() const { | |
41 return infobar_manager_; | |
42 } | |
43 | |
44 void Close(bool redo_search); | |
45 | |
46 private: | |
47 friend class GoogleURLTrackerTest; | |
48 | |
49 // infobars::InfoBarManager::Observer: | |
50 virtual void OnInfoBarRemoved(infobars::InfoBar* infobar, | |
51 bool animate) OVERRIDE; | |
52 virtual void OnManagerShuttingDown( | |
53 infobars::InfoBarManager* manager) OVERRIDE; | |
54 | |
55 GoogleURLTracker* const google_url_tracker_; | |
56 infobars::InfoBarManager* const infobar_manager_; | |
57 GoogleURLTrackerInfoBarDelegate* infobar_delegate_; | |
58 scoped_ptr<GoogleURLTrackerNavigationHelper> navigation_helper_; | |
59 bool observing_; | |
60 | |
61 DISALLOW_COPY_AND_ASSIGN(GoogleURLTrackerMapEntry); | |
62 }; | |
63 | |
64 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_MAP_ENTRY_H_ | |
OLD | NEW |