Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(485)

Side by Side Diff: chrome/renderer/searchbox/searchbox.h

Issue 10809063: Adding Javascript support for the Extended Searchbox API. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Syncing to pickup moved searchbox code. Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 results_base() const { return results_base_; }
39 gfx::Rect GetRect(); 42 gfx::Rect GetRect();
43 const std::vector<InstantAutocompleteResult>& autocomplete_results()
44 const {
sreeram 2012/08/13 16:37:08 The const seems to fit on the previous line, no?
Shishir 2012/08/13 18:11:12 Done.
45 return autocomplete_results_;
46 }
47 int key_code() const { return key_code_; }
40 48
41 private: 49 private:
42 // RenderViewObserver implementation. 50 // RenderViewObserver implementation.
43 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 51 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
44 52
45 void OnChange(const string16& value, 53 void OnChange(const string16& value,
46 bool verbatim, 54 bool verbatim,
47 size_t selection_start, 55 size_t selection_start,
48 size_t selection_end); 56 size_t selection_end);
49 void OnSubmit(const string16& value); 57 void OnSubmit(const string16& value);
50 void OnCancel(const string16& value); 58 void OnCancel(const string16& value);
51 void OnResize(const gfx::Rect& bounds); 59 void OnResize(const gfx::Rect& bounds);
52 void OnDetermineIfPageSupportsInstant(); 60 void OnDetermineIfPageSupportsInstant();
61 void OnAutocompleteResults(
62 const std::vector<InstantAutocompleteResult>& results);
63 void OnKeyPress(int key_code);
53 64
54 // Sets the searchbox values to their initial value. 65 // Sets the searchbox values to their initial value.
55 void Reset(); 66 void Reset();
56 67
57 string16 value_; 68 string16 value_;
58 bool verbatim_; 69 bool verbatim_;
59 size_t selection_start_; 70 size_t selection_start_;
60 size_t selection_end_; 71 size_t selection_end_;
72 int results_base_;
61 gfx::Rect rect_; 73 gfx::Rect rect_;
74 std::vector<InstantAutocompleteResult> autocomplete_results_;
75 int key_code_;
62 76
63 DISALLOW_COPY_AND_ASSIGN(SearchBox); 77 DISALLOW_COPY_AND_ASSIGN(SearchBox);
64 }; 78 };
65 79
66 #endif // CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_ 80 #endif // CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698