Infobar material design refresh: layout
[chromium-blink-merge.git] / chrome / browser / ui / omnibox / chrome_omnibox_client.h
blob17d8398d652b4023b6d4a00716f809ff0e4b0b0b
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_CHROME_OMNIBOX_CLIENT_H_
6 #define CHROME_BROWSER_UI_OMNIBOX_CHROME_OMNIBOX_CLIENT_H_
8 #include "base/compiler_specific.h"
9 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h"
10 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_service.h"
11 #include "chrome/common/instant_types.h"
12 #include "components/omnibox/browser/omnibox_client.h"
14 class ChromeOmniboxEditController;
15 class OmniboxEditController;
16 class Profile;
18 namespace content {
19 class NavigationController;
22 class ChromeOmniboxClient : public OmniboxClient {
23 public:
24 ChromeOmniboxClient(OmniboxEditController* controller, Profile* profile);
25 ~ChromeOmniboxClient() override;
27 // OmniboxClient.
28 scoped_ptr<AutocompleteProviderClient>
29 CreateAutocompleteProviderClient() override;
30 scoped_ptr<OmniboxNavigationObserver> CreateOmniboxNavigationObserver(
31 const base::string16& text,
32 const AutocompleteMatch& match,
33 const AutocompleteMatch& alternate_nav_match) override;
34 bool CurrentPageExists() const override;
35 const GURL& GetURL() const override;
36 const base::string16& GetTitle() const override;
37 gfx::Image GetFavicon() const override;
38 bool IsInstantNTP() const override;
39 bool IsSearchResultsPage() const override;
40 bool IsLoading() const override;
41 bool IsPasteAndGoEnabled() const override;
42 bool IsNewTabPage(const std::string& url) const override;
43 bool IsHomePage(const std::string& url) const override;
44 const SessionID& GetSessionID() const override;
45 bookmarks::BookmarkModel* GetBookmarkModel() override;
46 TemplateURLService* GetTemplateURLService() override;
47 const AutocompleteSchemeClassifier& GetSchemeClassifier() const override;
48 AutocompleteClassifier* GetAutocompleteClassifier() override;
49 gfx::Image GetIconIfExtensionMatch(
50 const AutocompleteMatch& match) const override;
51 bool ProcessExtensionKeyword(TemplateURL* template_url,
52 const AutocompleteMatch& match,
53 WindowOpenDisposition disposition,
54 OmniboxNavigationObserver* observer) override;
55 void OnInputStateChanged() override;
56 void OnFocusChanged(OmniboxFocusState state,
57 OmniboxFocusChangeReason reason) override;
58 void OnResultChanged(const AutocompleteResult& result,
59 bool default_match_changed,
60 const base::Callback<void(const SkBitmap& bitmap)>&
61 on_bitmap_fetched) override;
62 void OnCurrentMatchChanged(const AutocompleteMatch& match) override;
63 void OnTextChanged(const AutocompleteMatch& current_match,
64 bool user_input_in_progress,
65 base::string16& user_text,
66 const AutocompleteResult& result,
67 bool is_popup_open,
68 bool has_focus) override;
69 void OnInputAccepted(const AutocompleteMatch& match) override;
70 void OnRevert() override;
71 void OnURLOpenedFromOmnibox(OmniboxLog* log) override;
72 void OnBookmarkLaunched() override;
73 void DiscardNonCommittedNavigations() override;
75 private:
76 // Performs prerendering for |match|.
77 void DoPrerender(const AutocompleteMatch& match);
79 // Performs preconnection for |match|.
80 void DoPreconnect(const AutocompleteMatch& match);
82 // Sends the current SearchProvider suggestion to the Instant page if any.
83 void SetSuggestionToPrefetch(const InstantSuggestion& suggestion);
85 void OnBitmapFetched(const BitmapFetchedCallback& callback,
86 const SkBitmap& bitmap);
88 ChromeOmniboxEditController* controller_;
89 Profile* profile_;
90 ChromeAutocompleteSchemeClassifier scheme_classifier_;
91 BitmapFetcherService::RequestId request_id_;
93 DISALLOW_COPY_AND_ASSIGN(ChromeOmniboxClient);
96 #endif // CHROME_BROWSER_UI_OMNIBOX_CHROME_OMNIBOX_CLIENT_H_