1 // Copyright 2013 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.
5 #ifndef CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_CURRENT_PAGE_DELEGATE_H_
6 #define CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_CURRENT_PAGE_DELEGATE_H_
8 #include "base/basictypes.h"
9 #include "ui/base/window_open_disposition.h"
14 struct AutocompleteMatch
;
17 class NavigationController
;
20 // A class that abstracts omnibox functionality that depends on the current
21 // tab/page (e.g., getting information about the current page, retrieving
22 // objects associated with the current tab, or performing operations that rely
23 // on such objects under the hood).
24 class OmniboxCurrentPageDelegate
{
26 virtual ~OmniboxCurrentPageDelegate() {}
28 // Returns whether there is any associated current page. For example, during
29 // startup or shutdown, the omnibox may exist but have no attached page.
30 virtual bool CurrentPageExists() const = 0;
32 // Returns the URL of the current page.
33 virtual const GURL
& GetURL() const = 0;
35 // Returns true if the visible entry is a New Tab Page rendered by Instant.
36 virtual bool IsInstantNTP() const = 0;
38 // Returns true if the committed entry is a search results page.
39 virtual bool IsSearchResultsPage() const = 0;
41 // Returns whether the current page is loading.
42 virtual bool IsLoading() const = 0;
44 // Returns the NavigationController for the current page.
45 virtual content::NavigationController
& GetNavigationController() const = 0;
47 // Returns the session ID of the current page.
48 virtual const SessionID
& GetSessionID() const = 0;
50 // Checks whether |template_url| is an extension keyword; if so, asks the
51 // ExtensionOmniboxEventRouter to process |match| for it and returns true.
52 // Otherwise returns false.
53 virtual bool ProcessExtensionKeyword(TemplateURL
* template_url
,
54 const AutocompleteMatch
& match
,
55 WindowOpenDisposition disposition
) = 0;
57 // Notifies the SearchTabHelper, if one exists, of relevant changes to the
59 virtual void NotifySearchTabHelper(bool user_input_in_progress
,
62 // Performs prerendering for |match|.
63 virtual void DoPrerender(const AutocompleteMatch
& match
) = 0;
66 #endif // CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_CURRENT_PAGE_DELEGATE_H_