OLD | NEW |
(Empty) | |
| 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_INSTANT_INSTANT_CONTROLLER_IMPL_H_ |
| 6 #define CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_IMPL_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/string16.h" |
| 12 #include "base/timer.h" |
| 13 #include "chrome/browser/instant/instant_controller.h" |
| 14 #include "chrome/browser/instant/instant_service_observer.h" |
| 15 #include "content/public/common/page_transition_types.h" |
| 16 #include "googleurl/src/gurl.h" |
| 17 #include "ui/gfx/rect.h" |
| 18 |
| 19 class InstantOverlay; |
| 20 class InstantOverlayModel; |
| 21 class InstantService; |
| 22 class Profile; |
| 23 |
| 24 namespace chrome { |
| 25 class BrowserInstantController; |
| 26 } |
| 27 |
| 28 class InstantControllerImpl : public InstantController, |
| 29 public InstantServiceObserver { |
| 30 public: |
| 31 InstantControllerImpl(chrome::BrowserInstantController* browser, |
| 32 Profile* profile); |
| 33 |
| 34 private: |
| 35 virtual ~InstantControllerImpl(); |
| 36 |
| 37 // Overridden from InstantController: |
| 38 virtual bool Update(const AutocompleteMatch& match, |
| 39 const string16& user_text, |
| 40 const string16& full_text, |
| 41 size_t selection_start, |
| 42 size_t selection_end, |
| 43 bool verbatim, |
| 44 bool user_input_in_progress, |
| 45 bool omnibox_popup_is_open, |
| 46 bool escape_pressed, |
| 47 bool is_keyword_search) OVERRIDE; |
| 48 virtual void HandleAutocompleteResults( |
| 49 const std::vector<AutocompleteProvider*>& providers) OVERRIDE; |
| 50 virtual bool OnUpOrDownKeyPressed(int count) OVERRIDE; |
| 51 virtual void OnCancel(const AutocompleteMatch& match, |
| 52 const string16& full_text) OVERRIDE; |
| 53 virtual bool IsOverlayingSearchResults() const OVERRIDE; |
| 54 virtual content::WebContents* GetOverlayContents() const OVERRIDE; |
| 55 virtual const InstantOverlayModel* model() const OVERRIDE; |
| 56 virtual void AddOverlayModelObserver( |
| 57 InstantOverlayModelObserver* observer) OVERRIDE; |
| 58 virtual void RemoveOverlayModelObserver( |
| 59 InstantOverlayModelObserver* observer) OVERRIDE; |
| 60 virtual bool CommitIfPossible(InstantCommitType type) OVERRIDE; |
| 61 virtual scoped_ptr<content::WebContents> ReleaseNTPContents() OVERRIDE; |
| 62 virtual void SetPopupBounds(const gfx::Rect& bounds) OVERRIDE; |
| 63 virtual void SetOmniboxBounds(const gfx::Rect& bounds) OVERRIDE; |
| 64 virtual void OmniboxFocusChanged(OmniboxFocusState state, |
| 65 OmniboxFocusChangeReason reason, |
| 66 gfx::NativeView view_gaining_focus) OVERRIDE; |
| 67 virtual void TabDeactivated(content::WebContents* contents) OVERRIDE; |
| 68 virtual void SearchModeChanged(const chrome::search::Mode& old_mode, |
| 69 const chrome::search::Mode& new_mode) OVERRIDE; |
| 70 virtual void ActiveTabChanged() OVERRIDE; |
| 71 virtual void SwappedOverlayContents() OVERRIDE; |
| 72 virtual void FocusedOverlayContents() OVERRIDE; |
| 73 virtual void RenderViewGone(const content::WebContents* contents) OVERRIDE; |
| 74 virtual void InitSearchBox(const content::WebContents* contents) OVERRIDE; |
| 75 virtual void InstantSupportDetermined( |
| 76 const content::WebContents* contents) OVERRIDE; |
| 77 virtual void SetSuggestion(const content::WebContents* contents, |
| 78 const InstantSuggestion& suggestion) OVERRIDE; |
| 79 virtual void NavigateToURL(const content::WebContents* contents, |
| 80 const GURL& url, |
| 81 content::PageTransition transition, |
| 82 WindowOpenDisposition disposition) OVERRIDE; |
| 83 virtual void ShowOverlay(const content::WebContents* contents, |
| 84 int height, |
| 85 InstantSizeUnits height_units) OVERRIDE; |
| 86 virtual void SetFocusState(const content::WebContents* contents, |
| 87 OmniboxFocusState focus_state) OVERRIDE; |
| 88 virtual void DeleteMostVisitedItem(const content::WebContents* contents, |
| 89 const GURL& url) OVERRIDE; |
| 90 virtual void UndoMostVisitedItemDeletion(const content::WebContents* contents, |
| 91 const GURL& url) OVERRIDE; |
| 92 virtual void UndoAllMostVisitedItemDeletions( |
| 93 const content::WebContents* contents) OVERRIDE; |
| 94 |
| 95 // Overridden from InstantServiceObserver: |
| 96 virtual void InstantStatusChanged() OVERRIDE; |
| 97 virtual void ThemeInfoChanged() OVERRIDE; |
| 98 virtual void MostVisitedItemsChanged() OVERRIDE; |
| 99 |
| 100 bool IsOverlayBeingCommitted() const; |
| 101 void ShowOverlay(); |
| 102 void HideOverlay(); |
| 103 void SendPopupBoundsToPage(); |
| 104 |
| 105 chrome::BrowserInstantController* const browser_; |
| 106 InstantService* const service_; |
| 107 scoped_ptr<InstantOverlay> overlay_; |
| 108 scoped_ptr<InstantOverlayModel> model_; |
| 109 |
| 110 string16 last_omnibox_text_; |
| 111 bool last_verbatim_; |
| 112 content::PageTransition last_transition_type_; |
| 113 GURL url_for_history_; |
| 114 |
| 115 gfx::Rect popup_bounds_; // Current popup bounds. |
| 116 gfx::Rect last_popup_bounds_; // Last popup bounds sent to the page. |
| 117 base::OneShotTimer<InstantControllerImpl> update_bounds_timer_; |
| 118 |
| 119 DISALLOW_COPY_AND_ASSIGN(InstantControllerImpl); |
| 120 }; |
| 121 |
| 122 #endif // CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_IMPL_H_ |
OLD | NEW |