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_MAP_ENTRY_H_ | 5 #ifndef CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_MAP_ENTRY_H_ |
6 #define CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_MAP_ENTRY_H_ | 6 #define CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_MAP_ENTRY_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "chrome/browser/google/google_url_tracker_infobar_delegate.h" | |
9 #include "chrome/browser/google/google_url_tracker_navigation_helper.h" | 10 #include "chrome/browser/google/google_url_tracker_navigation_helper.h" |
10 #include "content/public/browser/notification_observer.h" | 11 #include "content/public/browser/notification_observer.h" |
11 #include "content/public/browser/notification_registrar.h" | 12 #include "content/public/browser/notification_registrar.h" |
12 | 13 |
13 class GoogleURLTracker; | 14 class GoogleURLTracker; |
14 class GoogleURLTrackerInfoBarDelegate; | 15 |
15 class InfoBarService; | 16 namespace infobars { |
17 class InfoBarManager; | |
18 } | |
16 | 19 |
17 class GoogleURLTrackerMapEntry : public content::NotificationObserver { | 20 class GoogleURLTrackerMapEntry : public content::NotificationObserver { |
18 public: | 21 public: |
19 GoogleURLTrackerMapEntry( | 22 GoogleURLTrackerMapEntry( |
20 GoogleURLTracker* google_url_tracker, | 23 GoogleURLTracker* google_url_tracker, |
21 InfoBarService* infobar_service, | 24 infobars::InfoBarManager* infobar_manager, |
22 scoped_ptr<GoogleURLTrackerNavigationHelper> navigation_helper); | 25 scoped_ptr<GoogleURLTrackerNavigationHelper> navigation_helper); |
23 virtual ~GoogleURLTrackerMapEntry(); | 26 virtual ~GoogleURLTrackerMapEntry(); |
24 | 27 |
25 bool has_infobar_delegate() const { return !!infobar_delegate_; } | 28 bool has_infobar_delegate() const { return !!infobar_delegate_; } |
26 GoogleURLTrackerInfoBarDelegate* infobar_delegate() { | 29 GoogleURLTrackerInfoBarDelegate* infobar_delegate() { |
27 return infobar_delegate_; | 30 return infobar_delegate_; |
28 } | 31 } |
29 void SetInfoBarDelegate(GoogleURLTrackerInfoBarDelegate* infobar_delegate); | 32 void SetInfoBarDelegate(GoogleURLTrackerInfoBarDelegate* infobar_delegate); |
30 | 33 |
31 GoogleURLTrackerNavigationHelper* navigation_helper() { | 34 GoogleURLTrackerNavigationHelper* navigation_helper() { |
35 // This object gives ownership of |navigation_helper_| to the infobar | |
36 // delegate in |SetInfoBarDelegate()|. | |
Peter Kasting
2014/05/28 22:19:04
Nit: No || around function name
blundell
2014/05/30 09:39:18
Done.
| |
37 if (has_infobar_delegate()) | |
38 return infobar_delegate_->navigation_helper(); | |
32 return navigation_helper_.get(); | 39 return navigation_helper_.get(); |
Peter Kasting
2014/05/28 22:19:04
Nit: Shorter:
return has_infobar_delegate() ?
blundell
2014/05/30 09:39:18
Done.
| |
33 } | 40 } |
34 | 41 |
35 void Close(bool redo_search); | 42 void Close(bool redo_search); |
36 | 43 |
37 private: | 44 private: |
38 friend class GoogleURLTrackerTest; | 45 friend class GoogleURLTrackerTest; |
39 | 46 |
40 // content::NotificationObserver: | 47 // content::NotificationObserver: |
41 virtual void Observe(int type, | 48 virtual void Observe(int type, |
42 const content::NotificationSource& source, | 49 const content::NotificationSource& source, |
43 const content::NotificationDetails& details) OVERRIDE; | 50 const content::NotificationDetails& details) OVERRIDE; |
44 | 51 |
45 content::NotificationRegistrar registrar_; | 52 content::NotificationRegistrar registrar_; |
46 GoogleURLTracker* const google_url_tracker_; | 53 GoogleURLTracker* const google_url_tracker_; |
47 const InfoBarService* const infobar_service_; | 54 const infobars::InfoBarManager* const infobar_manager_; |
48 GoogleURLTrackerInfoBarDelegate* infobar_delegate_; | 55 GoogleURLTrackerInfoBarDelegate* infobar_delegate_; |
49 scoped_ptr<GoogleURLTrackerNavigationHelper> navigation_helper_; | 56 scoped_ptr<GoogleURLTrackerNavigationHelper> navigation_helper_; |
50 | 57 |
51 DISALLOW_COPY_AND_ASSIGN(GoogleURLTrackerMapEntry); | 58 DISALLOW_COPY_AND_ASSIGN(GoogleURLTrackerMapEntry); |
52 }; | 59 }; |
53 | 60 |
54 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_MAP_ENTRY_H_ | 61 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_MAP_ENTRY_H_ |
OLD | NEW |