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 "base/memory/scoped_ptr.h" 9 #include "chrome/common/omnibox_focus_state.h" 10 #include "content/public/browser/web_contents_observer.h" 11 12 namespace gfx { 13 class Rect; 14 } 15 16 namespace IPC { 17 class Sender; 18 } 19 20 class InstantIPCSender : public content::WebContentsObserver { 21 public: 22 // Creates a new instance of InstantIPCSender. If |is_incognito| is true, 23 // the instance will only send appropriate IPCs for incognito profiles. 24 static scoped_ptr<InstantIPCSender> Create(bool is_incognito); 25 ~InstantIPCSender()26 virtual ~InstantIPCSender() {} 27 28 // Sets |web_contents| as the receiver of IPCs. 29 void SetContents(content::WebContents* web_contents); 30 31 32 // Tells the page the left and right margins of the omnibox. This is used by 33 // the page to align text or assets properly with the omnibox. SetOmniboxBounds(const gfx::Rect & bounds)34 virtual void SetOmniboxBounds(const gfx::Rect& bounds) {} 35 36 // Tells the page that the omnibox focus has changed. FocusChanged(OmniboxFocusState state,OmniboxFocusChangeReason reason)37 virtual void FocusChanged(OmniboxFocusState state, 38 OmniboxFocusChangeReason reason) {} 39 40 // Tells the page that user input started or stopped. SetInputInProgress(bool input_in_progress)41 virtual void SetInputInProgress(bool input_in_progress) {} 42 43 protected: InstantIPCSender()44 InstantIPCSender() {} 45 46 private: 47 DISALLOW_COPY_AND_ASSIGN(InstantIPCSender); 48 }; 49 50 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_IPC_SENDER_H_ 51