OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_UI_SEARCH_INSTANT_IPC_SENDER_H_ | 5 #ifndef CHROME_BROWSER_UI_SEARCH_INSTANT_IPC_SENDER_H_ |
6 #define CHROME_BROWSER_UI_SEARCH_INSTANT_IPC_SENDER_H_ | 6 #define CHROME_BROWSER_UI_SEARCH_INSTANT_IPC_SENDER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 public: | 24 public: |
25 // Creates a new instance of InstantIPCSender. If |is_incognito| is true, | 25 // Creates a new instance of InstantIPCSender. If |is_incognito| is true, |
26 // the instance will only send appropriate IPCs for incognito profiles. | 26 // the instance will only send appropriate IPCs for incognito profiles. |
27 static scoped_ptr<InstantIPCSender> Create(bool is_incognito); | 27 static scoped_ptr<InstantIPCSender> Create(bool is_incognito); |
28 | 28 |
29 virtual ~InstantIPCSender() {} | 29 virtual ~InstantIPCSender() {} |
30 | 30 |
31 // Sets |web_contents| as the receiver of IPCs. | 31 // Sets |web_contents| as the receiver of IPCs. |
32 void SetContents(content::WebContents* web_contents); | 32 void SetContents(content::WebContents* web_contents); |
33 | 33 |
34 // Tells the page that the user typed |text| into the omnibox. If |verbatim| | |
35 // is false, the page predicts the query the user means to type and fetches | |
36 // results for the prediction. If |verbatim| is true, |text| is taken as the | |
37 // exact query (no prediction is made). |selection_start| and |selection_end| | |
38 // mark the inline autocompleted portion (i.e., blue highlighted text). The | |
39 // omnibox caret (cursor) is at |selection_end|. | |
40 virtual void Update(const string16& text, | |
41 size_t selection_start, | |
42 size_t selection_end, | |
43 bool verbatim) {} | |
44 | |
45 // Tells the page that the user pressed Enter in the omnibox. | 34 // Tells the page that the user pressed Enter in the omnibox. |
46 virtual void Submit(const string16& text) {} | 35 virtual void Submit(const string16& text) {} |
47 | 36 |
48 // Tells the page that the user clicked on it. Nothing is being cancelled; the | |
49 // poor choice of name merely reflects the IPC of the same (poor) name. | |
50 virtual void Cancel(const string16& text) {} | |
51 | |
52 // Tells the page the bounds of the omnibox dropdown (in screen coordinates). | |
53 // This is used by the page to offset the results to avoid them being covered | |
54 // by the omnibox dropdown. | |
55 virtual void SetPopupBounds(const gfx::Rect& bounds) {} | |
56 | |
57 // Tells the page the bounds of the omnibox (in screen coordinates). This is | 37 // Tells the page the bounds of the omnibox (in screen coordinates). This is |
58 // used by the page to align text or assets properly with the omnibox. | 38 // used by the page to align text or assets properly with the omnibox. |
59 virtual void SetOmniboxBounds(const gfx::Rect& bounds) {} | 39 virtual void SetOmniboxBounds(const gfx::Rect& bounds) {} |
60 | 40 |
61 // Tells the page about the font information. | 41 // Tells the page about the font information. |
62 virtual void SetFontInformation(const string16& omnibox_font_name, | 42 virtual void SetFontInformation(const string16& omnibox_font_name, |
63 size_t omnibox_font_size) {} | 43 size_t omnibox_font_size) {} |
64 | 44 |
65 // Tells the page information it needs to display promos. | 45 // Tells the page information it needs to display promos. |
66 virtual void SetPromoInformation(bool is_app_launcher_enabled) {} | 46 virtual void SetPromoInformation(bool is_app_launcher_enabled) {} |
67 | 47 |
68 // Tells the page about the available autocomplete results. | |
69 virtual void SendAutocompleteResults( | |
70 const std::vector<InstantAutocompleteResult>& results) {} | |
71 | |
72 // Tells the page that the user pressed Up or Down in the omnibox. |count| is | |
73 // a repeat count, negative for moving up, positive for moving down. | |
74 virtual void UpOrDownKeyPressed(int count) {} | |
75 | |
76 // Tells the page that the user pressed Esc key in the omnibox. | |
77 virtual void EscKeyPressed() {} | |
78 | |
79 // Tells the page that the user pressed Esc in the omnibox after having | |
80 // arrowed down in the suggestions. The page should reset the selection to | |
81 // the first suggestion. Arguments are the same as those for Update(). | |
82 virtual void CancelSelection(const string16& user_text, | |
83 size_t selection_start, | |
84 size_t selection_end, | |
85 bool verbatim) {} | |
86 | |
87 // Tells the page about the current theme background. | 48 // Tells the page about the current theme background. |
88 virtual void SendThemeBackgroundInfo( | 49 virtual void SendThemeBackgroundInfo( |
89 const ThemeBackgroundInfo& theme_info) {} | 50 const ThemeBackgroundInfo& theme_info) {} |
90 | 51 |
91 // Tells the page whether it is allowed to display Instant results. | |
92 virtual void SetDisplayInstantResults(bool display_instant_results) {} | |
93 | |
94 // Tells the page that the omnibox focus has changed. | 52 // Tells the page that the omnibox focus has changed. |
95 virtual void FocusChanged(OmniboxFocusState state, | 53 virtual void FocusChanged(OmniboxFocusState state, |
96 OmniboxFocusChangeReason reason) {} | 54 OmniboxFocusChangeReason reason) {} |
97 | 55 |
98 // Tells the page that user input started or stopped. | 56 // Tells the page that user input started or stopped. |
99 virtual void SetInputInProgress(bool input_in_progress) {} | 57 virtual void SetInputInProgress(bool input_in_progress) {} |
100 | 58 |
101 // Tells the page about new Most Visited data. | 59 // Tells the page about new Most Visited data. |
102 virtual void SendMostVisitedItems( | 60 virtual void SendMostVisitedItems( |
103 const std::vector<InstantMostVisitedItem>& items) {} | 61 const std::vector<InstantMostVisitedItem>& items) {} |
104 | 62 |
105 // Tells the page to toggle voice search. | 63 // Tells the page to toggle voice search. |
106 virtual void ToggleVoiceSearch() {} | 64 virtual void ToggleVoiceSearch() {} |
107 | 65 |
108 protected: | 66 protected: |
109 InstantIPCSender() {} | 67 InstantIPCSender() {} |
110 | 68 |
111 private: | 69 private: |
112 DISALLOW_COPY_AND_ASSIGN(InstantIPCSender); | 70 DISALLOW_COPY_AND_ASSIGN(InstantIPCSender); |
113 }; | 71 }; |
114 | 72 |
115 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_IPC_SENDER_H_ | 73 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_IPC_SENDER_H_ |
OLD | NEW |