OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_RENDERER_SEARCHBOX_SEARCHBOX_H_ | 5 #ifndef CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_ |
6 #define CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_ | 6 #define CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 class Message; | 22 class Message; |
23 } | 23 } |
24 | 24 |
25 class SearchBox : public content::RenderViewObserver, | 25 class SearchBox : public content::RenderViewObserver, |
26 public content::RenderViewObserverTracker<SearchBox> { | 26 public content::RenderViewObserverTracker<SearchBox> { |
27 public: | 27 public: |
28 explicit SearchBox(content::RenderView* render_view); | 28 explicit SearchBox(content::RenderView* render_view); |
29 virtual ~SearchBox(); | 29 virtual ~SearchBox(); |
30 | 30 |
31 // Sends ViewHostMsg_SetSuggestions to the browser. | 31 // Sends ViewHostMsg_SetSuggestions to the browser. |
32 void SetSuggestions(const std::vector<string16>& suggestions, | 32 void SetSuggestions(const std::vector<InstantSuggestion>& suggestions); |
33 InstantCompleteBehavior behavior); | |
34 | 33 |
35 const string16& value() const { return value_; } | 34 // Sends ViewHostMsg_SetInstantPreviewHeight to the browser. |
| 35 void SetInstantPreviewHeight(int height, InstantSizeUnits units); |
| 36 |
| 37 const string16& query() const { return query_; } |
36 bool verbatim() const { return verbatim_; } | 38 bool verbatim() const { return verbatim_; } |
37 size_t selection_start() const { return selection_start_; } | 39 size_t selection_start() const { return selection_start_; } |
38 size_t selection_end() const { return selection_end_; } | 40 size_t selection_end() const { return selection_end_; } |
| 41 int results_base() const { return results_base_; } |
39 gfx::Rect GetRect(); | 42 gfx::Rect GetRect(); |
| 43 const std::vector<InstantAutocompleteResult>& autocomplete_results() const { |
| 44 return autocomplete_results_; |
| 45 } |
| 46 int key_code() const { return key_code_; } |
40 | 47 |
41 private: | 48 private: |
42 // RenderViewObserver implementation. | 49 // RenderViewObserver implementation. |
43 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 50 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
44 | 51 |
45 void OnChange(const string16& value, | 52 void OnChange(const string16& query, |
46 bool verbatim, | 53 bool verbatim, |
47 size_t selection_start, | 54 size_t selection_start, |
48 size_t selection_end); | 55 size_t selection_end); |
49 void OnSubmit(const string16& value); | 56 void OnSubmit(const string16& query); |
50 void OnCancel(const string16& value); | 57 void OnCancel(const string16& query); |
51 void OnResize(const gfx::Rect& bounds); | 58 void OnResize(const gfx::Rect& bounds); |
52 void OnDetermineIfPageSupportsInstant(); | 59 void OnDetermineIfPageSupportsInstant(); |
| 60 void OnAutocompleteResults( |
| 61 const std::vector<InstantAutocompleteResult>& results); |
| 62 void OnKeyPress(int key_code); |
53 | 63 |
54 // Sets the searchbox values to their initial value. | 64 // Sets the searchbox values to their initial value. |
55 void Reset(); | 65 void Reset(); |
56 | 66 |
57 string16 value_; | 67 string16 query_; |
58 bool verbatim_; | 68 bool verbatim_; |
59 size_t selection_start_; | 69 size_t selection_start_; |
60 size_t selection_end_; | 70 size_t selection_end_; |
| 71 int results_base_; |
61 gfx::Rect rect_; | 72 gfx::Rect rect_; |
| 73 std::vector<InstantAutocompleteResult> autocomplete_results_; |
| 74 int key_code_; |
62 | 75 |
63 DISALLOW_COPY_AND_ASSIGN(SearchBox); | 76 DISALLOW_COPY_AND_ASSIGN(SearchBox); |
64 }; | 77 }; |
65 | 78 |
66 #endif // CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_ | 79 #endif // CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_ |
OLD | NEW |