• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2014 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 COMPONENTS_GOOGLE_CORE_BROWSER_GOOGLE_URL_TRACKER_NAVIGATION_HELPER_H_
6 #define COMPONENTS_GOOGLE_CORE_BROWSER_GOOGLE_URL_TRACKER_NAVIGATION_HELPER_H_
7 
8 #include "base/macros.h"
9 #include "ui/base/window_open_disposition.h"
10 
11 class GoogleURLTracker;
12 class GURL;
13 
14 // Interface via which GoogleURLTracker communicates with its driver.
15 // TODO(blundell): Rename this class to GoogleURLTrackerDriver.
16 // crbug.com/373221
17 class GoogleURLTrackerNavigationHelper {
18  public:
19   explicit GoogleURLTrackerNavigationHelper(
20       GoogleURLTracker* google_url_tracker);
21   virtual ~GoogleURLTrackerNavigationHelper();
22 
23   // Enables or disables listening for navigation commits.
24   // OnNavigationCommitted will be called for each navigation commit if
25   // listening is enabled.
26   virtual void SetListeningForNavigationCommit(bool listen) = 0;
27 
28   // Returns whether or not this object is currently listening for navigation
29   // commits.
30   virtual bool IsListeningForNavigationCommit() = 0;
31 
32   // Enables or disables listening for tab destruction. OnTabClosed will be
33   // called on tab destruction if listening is enabled.
34   virtual void SetListeningForTabDestruction(bool listen) = 0;
35 
36   // Returns whether or not this object is currently listening for tab
37   // destruction.
38   virtual bool IsListeningForTabDestruction() = 0;
39 
40   // Opens |url| with the given window disposition.
41   virtual void OpenURL(GURL url,
42                        WindowOpenDisposition disposition,
43                        bool user_clicked_on_link) = 0;
44 
45  protected:
google_url_tracker()46   GoogleURLTracker* google_url_tracker() { return google_url_tracker_; }
47 
48  private:
49   GoogleURLTracker* google_url_tracker_;
50 
51   DISALLOW_COPY_AND_ASSIGN(GoogleURLTrackerNavigationHelper);
52 };
53 
54 #endif  // COMPONENTS_GOOGLE_CORE_BROWSER_GOOGLE_URL_TRACKER_NAVIGATION_HELPER_H_
55