Home | History | Annotate | Download | only in google
      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.
      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 "content/public/browser/notification_observer.h"
      9 #include "content/public/browser/notification_registrar.h"
     10 
     11 class GoogleURLTracker;
     12 class GoogleURLTrackerInfoBarDelegate;
     13 class InfoBarService;
     14 
     15 namespace content {
     16 class NavigationController;
     17 }
     18 
     19 class GoogleURLTrackerMapEntry : public content::NotificationObserver {
     20  public:
     21   GoogleURLTrackerMapEntry(
     22       GoogleURLTracker* google_url_tracker,
     23       InfoBarService* infobar_service,
     24       const content::NavigationController* navigation_controller);
     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   const content::NavigationController* navigation_controller() const {
     34     return navigation_controller_;
     35   }
     36 
     37   void Close(bool redo_search);
     38 
     39  private:
     40   friend class GoogleURLTrackerTest;
     41 
     42   // content::NotificationObserver:
     43   virtual void Observe(int type,
     44                        const content::NotificationSource& source,
     45                        const content::NotificationDetails& details) OVERRIDE;
     46 
     47   content::NotificationRegistrar registrar_;
     48   GoogleURLTracker* const google_url_tracker_;
     49   const InfoBarService* const infobar_service_;
     50   GoogleURLTrackerInfoBarDelegate* infobar_delegate_;
     51   const content::NavigationController* const navigation_controller_;
     52 
     53   DISALLOW_COPY_AND_ASSIGN(GoogleURLTrackerMapEntry);
     54 };
     55 
     56 #endif  // CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_MAP_ENTRY_H_
     57