- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / omnibox / omnibox_current_page_delegate.h
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.
4
5 #ifndef CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_CURRENT_PAGE_DELEGATE_H_
6 #define CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_CURRENT_PAGE_DELEGATE_H_
7
8 #include "base/basictypes.h"
9 #include "ui/base/window_open_disposition.h"
10
11 class GURL;
12 class SessionID;
13 class TemplateURL;
14 struct AutocompleteMatch;
15
16 namespace content {
17 class NavigationController;
18 }
19
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 {
25  public:
26   virtual ~OmniboxCurrentPageDelegate() {}
27
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;
31
32   // Returns the URL of the current page.
33   virtual const GURL& GetURL() const = 0;
34
35   // Returns true if the visible entry is a New Tab Page rendered by Instant.
36   virtual bool IsInstantNTP() const = 0;
37
38   // Returns true if the committed entry is a search results page.
39   virtual bool IsSearchResultsPage() const = 0;
40
41   // Returns whether the current page is loading.
42   virtual bool IsLoading() const = 0;
43
44   // Returns the NavigationController for the current page.
45   virtual content::NavigationController& GetNavigationController() const = 0;
46
47   // Returns the session ID of the current page.
48   virtual const SessionID& GetSessionID() const = 0;
49
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;
56
57   // Notifies the SearchTabHelper, if one exists, of relevant changes to the
58   // omnibox state.
59   virtual void NotifySearchTabHelper(bool user_input_in_progress,
60                                      bool cancelling) = 0;
61
62   // Performs prerendering for |match|.
63   virtual void DoPrerender(const AutocompleteMatch& match) = 0;
64 };
65
66 #endif  // CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_CURRENT_PAGE_DELEGATE_H_