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

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

Issue 293503003: Eliminate dependence of GoogleURLTracker et al. on InfoBarService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Response to review Created 6 years, 6 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_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() {
32 return navigation_helper_.get(); 35 // This object gives ownership of |navigation_helper_| to the infobar
36 // delegate in SetInfoBarDelegate().
37 return has_infobar_delegate() ?
38 infobar_delegate_->navigation_helper() : navigation_helper_.get();
33 } 39 }
34 40
35 void Close(bool redo_search); 41 void Close(bool redo_search);
36 42
37 private: 43 private:
38 friend class GoogleURLTrackerTest; 44 friend class GoogleURLTrackerTest;
39 45
40 // content::NotificationObserver: 46 // content::NotificationObserver:
41 virtual void Observe(int type, 47 virtual void Observe(int type,
42 const content::NotificationSource& source, 48 const content::NotificationSource& source,
43 const content::NotificationDetails& details) OVERRIDE; 49 const content::NotificationDetails& details) OVERRIDE;
44 50
45 content::NotificationRegistrar registrar_; 51 content::NotificationRegistrar registrar_;
46 GoogleURLTracker* const google_url_tracker_; 52 GoogleURLTracker* const google_url_tracker_;
47 const InfoBarService* const infobar_service_; 53 const infobars::InfoBarManager* const infobar_manager_;
48 GoogleURLTrackerInfoBarDelegate* infobar_delegate_; 54 GoogleURLTrackerInfoBarDelegate* infobar_delegate_;
49 scoped_ptr<GoogleURLTrackerNavigationHelper> navigation_helper_; 55 scoped_ptr<GoogleURLTrackerNavigationHelper> navigation_helper_;
50 56
51 DISALLOW_COPY_AND_ASSIGN(GoogleURLTrackerMapEntry); 57 DISALLOW_COPY_AND_ASSIGN(GoogleURLTrackerMapEntry);
52 }; 58 };
53 59
54 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_MAP_ENTRY_H_ 60 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_MAP_ENTRY_H_
OLDNEW
« no previous file with comments | « chrome/browser/google/google_url_tracker_infobar_delegate.cc ('k') | chrome/browser/google/google_url_tracker_map_entry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698