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

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

Issue 290453005: Remove Infobars notifications from GoogleURLTrackerMapEntry (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review comments 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 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_infobar_delegate.h"
10 #include "chrome/browser/google/google_url_tracker_navigation_helper.h" 10 #include "chrome/browser/google/google_url_tracker_navigation_helper.h"
11 #include "content/public/browser/notification_observer.h" 11 #include "components/infobars/core/infobar_manager.h"
12 #include "content/public/browser/notification_registrar.h"
13 12
14 class GoogleURLTracker; 13 class GoogleURLTracker;
15 14
16 namespace infobars { 15 namespace infobars {
17 class InfoBarManager; 16 class InfoBarManager;
18 } 17 }
19 18
20 class GoogleURLTrackerMapEntry : public content::NotificationObserver { 19 class GoogleURLTrackerMapEntry : public infobars::InfoBarManager::Observer {
21 public: 20 public:
22 GoogleURLTrackerMapEntry( 21 GoogleURLTrackerMapEntry(
23 GoogleURLTracker* google_url_tracker, 22 GoogleURLTracker* google_url_tracker,
24 infobars::InfoBarManager* infobar_manager, 23 infobars::InfoBarManager* infobar_manager,
25 scoped_ptr<GoogleURLTrackerNavigationHelper> navigation_helper); 24 scoped_ptr<GoogleURLTrackerNavigationHelper> navigation_helper);
26 virtual ~GoogleURLTrackerMapEntry(); 25 virtual ~GoogleURLTrackerMapEntry();
27 26
28 bool has_infobar_delegate() const { return !!infobar_delegate_; } 27 bool has_infobar_delegate() const { return !!infobar_delegate_; }
29 GoogleURLTrackerInfoBarDelegate* infobar_delegate() { 28 GoogleURLTrackerInfoBarDelegate* infobar_delegate() {
30 return infobar_delegate_; 29 return infobar_delegate_;
31 } 30 }
32 void SetInfoBarDelegate(GoogleURLTrackerInfoBarDelegate* infobar_delegate); 31 void SetInfoBarDelegate(GoogleURLTrackerInfoBarDelegate* infobar_delegate);
33 32
34 GoogleURLTrackerNavigationHelper* navigation_helper() { 33 GoogleURLTrackerNavigationHelper* navigation_helper() {
35 // This object gives ownership of |navigation_helper_| to the infobar 34 // This object gives ownership of |navigation_helper_| to the infobar
36 // delegate in SetInfoBarDelegate(). 35 // delegate in SetInfoBarDelegate().
37 return has_infobar_delegate() ? 36 return has_infobar_delegate() ?
38 infobar_delegate_->navigation_helper() : navigation_helper_.get(); 37 infobar_delegate_->navigation_helper() : navigation_helper_.get();
39 } 38 }
40 39
40 const infobars::InfoBarManager* infobar_manager() const {
41 return infobar_manager_;
42 }
43
41 void Close(bool redo_search); 44 void Close(bool redo_search);
42 45
43 private: 46 private:
44 friend class GoogleURLTrackerTest; 47 friend class GoogleURLTrackerTest;
45 48
46 // content::NotificationObserver: 49 // infobars::InfoBarManager::Observer:
47 virtual void Observe(int type, 50 virtual void OnInfoBarRemoved(infobars::InfoBar* infobar,
48 const content::NotificationSource& source, 51 bool animate) OVERRIDE;
49 const content::NotificationDetails& details) OVERRIDE; 52 virtual void OnManagerShuttingDown(
53 infobars::InfoBarManager* manager) OVERRIDE;
50 54
51 content::NotificationRegistrar registrar_;
52 GoogleURLTracker* const google_url_tracker_; 55 GoogleURLTracker* const google_url_tracker_;
53 const infobars::InfoBarManager* const infobar_manager_; 56 infobars::InfoBarManager* const infobar_manager_;
54 GoogleURLTrackerInfoBarDelegate* infobar_delegate_; 57 GoogleURLTrackerInfoBarDelegate* infobar_delegate_;
55 scoped_ptr<GoogleURLTrackerNavigationHelper> navigation_helper_; 58 scoped_ptr<GoogleURLTrackerNavigationHelper> navigation_helper_;
59 bool observing_;
56 60
57 DISALLOW_COPY_AND_ASSIGN(GoogleURLTrackerMapEntry); 61 DISALLOW_COPY_AND_ASSIGN(GoogleURLTrackerMapEntry);
58 }; 62 };
59 63
60 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_MAP_ENTRY_H_ 64 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_MAP_ENTRY_H_
OLDNEW
« no previous file with comments | « chrome/browser/google/google_url_tracker.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