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_SEARCH_INSTANT_IPC_SENDER_H_ 6 #define CHROME_BROWSER_UI_SEARCH_INSTANT_IPC_SENDER_H_ 7 8 #include <vector> 9 10 #include "base/memory/scoped_ptr.h" 11 #include "chrome/common/instant_types.h" 12 #include "chrome/common/omnibox_focus_state.h" 13 #include "content/public/browser/web_contents_observer.h" 14 15 namespace gfx { 16 class Rect; 17 } 18 19 namespace IPC { 20 class Sender; 21 } 22 23 class InstantIPCSender : public content::WebContentsObserver { 24 public: 25 // Creates a new instance of InstantIPCSender. If |is_incognito| is true, 26 // the instance will only send appropriate IPCs for incognito profiles. 27 static scoped_ptr<InstantIPCSender> Create(bool is_incognito); 28 29 virtual ~InstantIPCSender() {} 30 31 // Sets |web_contents| as the receiver of IPCs. 32 void SetContents(content::WebContents* web_contents); 33 34 // Tells the page that the user pressed Enter in the omnibox. 35 virtual void Submit(const string16& text) {} 36 37 // Tells the page the left and right margins of the omnibox. This is used by 38 // the page to align text or assets properly with the omnibox. 39 virtual void SetOmniboxBounds(const gfx::Rect& bounds) {} 40 41 // Tells the page about the font information. 42 virtual void SetFontInformation(const string16& omnibox_font_name, 43 size_t omnibox_font_size) {} 44 45 // Tells the page information it needs to display promos. 46 virtual void SetPromoInformation(bool is_app_launcher_enabled) {} 47 48 // Tells the page about the current theme background. 49 virtual void SendThemeBackgroundInfo( 50 const ThemeBackgroundInfo& theme_info) {} 51 52 // Tells the page that the omnibox focus has changed. 53 virtual void FocusChanged(OmniboxFocusState state, 54 OmniboxFocusChangeReason reason) {} 55 56 // Tells the page that user input started or stopped. 57 virtual void SetInputInProgress(bool input_in_progress) {} 58 59 // Tells the page about new Most Visited data. 60 virtual void SendMostVisitedItems( 61 const std::vector<InstantMostVisitedItem>& items) {} 62 63 // Tells the page to toggle voice search. 64 virtual void ToggleVoiceSearch() {} 65 66 protected: 67 InstantIPCSender() {} 68 69 private: 70 DISALLOW_COPY_AND_ASSIGN(InstantIPCSender); 71 }; 72 73 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_IPC_SENDER_H_ 74