Chromium Code Reviews| 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_H_ | 5 #ifndef CHROME_RENDERER_SEARCHBOX_H_ |
| 6 #define CHROME_RENDERER_SEARCHBOX_H_ | 6 #define CHROME_RENDERER_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); | 33 |
| 34 // Sends ViewHostMsg_SetInstantPreviewHeight to the browser. | |
| 35 void SetInstantPreviewHeight(int height, InstantSizeUnits units); | |
| 34 | 36 |
| 35 const string16& value() const { return value_; } | 37 const string16& value() const { return value_; } |
| 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 rid_base() const { return rid_base_; } | |
|
sreeram
2012/08/09 22:13:51
"RID" is too cryptic. Let's make it "results_base"
Shishir
2012/08/10 18:16:57
Done.
| |
| 39 gfx::Rect GetRect(); | 42 gfx::Rect GetRect(); |
| 43 const std::vector<InstantAutocompleteResult>& instant_autocomplete_results() | |
| 44 const { | |
| 45 return instant_autocomplete_results_; | |
| 46 } | |
| 47 int key_code() const { return key_code_; } | |
| 48 const string16& last_query() const { return last_query_; } | |
| 49 const string16& current_url() const { return current_url_; } | |
| 50 bool is_focused() const { return is_focused_; } | |
|
sreeram
2012/08/09 22:13:51
As with the IPCs, let's drop the last_query(), cur
Shishir
2012/08/10 18:16:57
Done.
| |
| 40 | 51 |
| 41 private: | 52 private: |
| 42 // RenderViewObserver implementation. | 53 // RenderViewObserver implementation. |
| 43 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 54 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 44 | 55 |
| 45 void OnChange(const string16& value, | 56 void OnChange(const string16& value, |
| 46 bool verbatim, | 57 bool verbatim, |
| 47 size_t selection_start, | 58 size_t selection_start, |
| 48 size_t selection_end); | 59 size_t selection_end); |
| 49 void OnSubmit(const string16& value); | 60 void OnSubmit(const string16& value); |
| 50 void OnCancel(const string16& value); | 61 void OnCancel(const string16& value); |
| 51 void OnResize(const gfx::Rect& bounds); | 62 void OnResize(const gfx::Rect& bounds); |
| 52 void OnDetermineIfPageSupportsInstant(); | 63 void OnDetermineIfPageSupportsInstant(); |
| 64 void OnInstantAutocompleteResults( | |
|
sreeram
2012/08/09 22:13:51
OnInstantAutocompleteResults -> OnAutocompleteResu
Shishir
2012/08/10 18:16:57
Done.
| |
| 65 const std::vector<InstantAutocompleteResult>& results); | |
| 66 void OnKeyPress(int key_code); | |
| 67 void OnLastQuery(const string16& last_query); | |
| 68 void OnCurrentURL(const string16& current_url); | |
| 69 void OnFocused(); | |
| 70 void OnBlurred(); | |
| 53 | 71 |
| 54 // Sets the searchbox values to their initial value. | 72 // Sets the searchbox values to their initial value. |
| 55 void Reset(); | 73 void Reset(); |
| 56 | 74 |
| 57 string16 value_; | 75 string16 value_; |
| 58 bool verbatim_; | 76 bool verbatim_; |
| 59 size_t selection_start_; | 77 size_t selection_start_; |
| 60 size_t selection_end_; | 78 size_t selection_end_; |
| 79 int rid_base_; | |
| 61 gfx::Rect rect_; | 80 gfx::Rect rect_; |
| 81 std::vector<InstantAutocompleteResult> instant_autocomplete_results_; | |
|
sreeram
2012/08/09 22:13:51
Drop "instant_": std::vector<InstantAutocompleteRe
Shishir
2012/08/10 18:16:57
Done.
| |
| 82 int key_code_; | |
| 83 string16 last_query_; | |
| 84 string16 current_url_; | |
| 85 bool is_focused_; | |
| 62 | 86 |
| 63 DISALLOW_COPY_AND_ASSIGN(SearchBox); | 87 DISALLOW_COPY_AND_ASSIGN(SearchBox); |
| 64 }; | 88 }; |
| 65 | 89 |
| 66 #endif // CHROME_RENDERER_SEARCHBOX_H_ | 90 #endif // CHROME_RENDERER_SEARCHBOX_H_ |
| OLD | NEW |