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

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

Issue 11359198: Implement the Instant extended API startMargin, endMargin, and rtl properties and the onmarginchang… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 | Annotate | Revision Log
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 26 matching lines...) Expand all
37 InstantSizeUnits units); 37 InstantSizeUnits units);
38 38
39 bool is_focused() const { return is_focused_; } 39 bool is_focused() const { return is_focused_; }
40 const string16& query() const { return query_; } 40 const string16& query() const { return query_; }
41 bool verbatim() const { return verbatim_; } 41 bool verbatim() const { return verbatim_; }
42 size_t selection_start() const { return selection_start_; } 42 size_t selection_start() const { return selection_start_; }
43 size_t selection_end() const { return selection_end_; } 43 size_t selection_end() const { return selection_end_; }
44 int results_base() const { return results_base_; } 44 int results_base() const { return results_base_; }
45 bool active_tab_is_ntp() const { return active_tab_is_ntp_; } 45 bool active_tab_is_ntp() const { return active_tab_is_ntp_; }
46 46
47 gfx::Rect GetRect(); 47 // These functions return the start/end margins of the page text area
48 // adjusted for the page zoom.
49 int GetStartMargin();
50 int GetEndMargin();
51
52 // Returns the bounds of the Searchbox popup in screen coordinates.
53 gfx::Rect GetPopupBounds();
54
48 const std::vector<InstantAutocompleteResult>& GetAutocompleteResults(); 55 const std::vector<InstantAutocompleteResult>& GetAutocompleteResults();
49 // Searchbox retains ownership of this object. 56 // Searchbox retains ownership of this object.
50 const InstantAutocompleteResult* 57 const InstantAutocompleteResult*
51 GetAutocompleteResultWithId(size_t restricted_id) const; 58 GetAutocompleteResultWithId(size_t restricted_id) const;
52 59
53 private: 60 private:
54 // RenderViewObserver implementation. 61 // RenderViewObserver implementation.
55 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 62 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
56 63
57 void OnChange(const string16& query, 64 void OnChange(const string16& query,
58 bool verbatim, 65 bool verbatim,
59 size_t selection_start, 66 size_t selection_start,
60 size_t selection_end); 67 size_t selection_end);
61 void OnSubmit(const string16& query); 68 void OnSubmit(const string16& query);
62 void OnCancel(const string16& query); 69 void OnCancel(const string16& query);
63 void OnResize(const gfx::Rect& bounds); 70 void OnPopupResize(const gfx::Rect& bounds);
71 void OnMarginChange(int start, int end);
64 void OnDetermineIfPageSupportsInstant(); 72 void OnDetermineIfPageSupportsInstant();
65 void OnAutocompleteResults( 73 void OnAutocompleteResults(
66 const std::vector<InstantAutocompleteResult>& results); 74 const std::vector<InstantAutocompleteResult>& results);
67 void OnUpOrDownKeyPressed(int count); 75 void OnUpOrDownKeyPressed(int count);
68 void OnFocus(); 76 void OnFocus();
69 void OnBlur(); 77 void OnBlur();
70 void OnActiveTabModeChanged(bool active_tab_is_ntp); 78 void OnActiveTabModeChanged(bool active_tab_is_ntp);
71 79
80 // Returns the current zoom factor of the render view or 1 on failure.
81 double GetZoom();
82
72 // Sets the searchbox values to their initial value. 83 // Sets the searchbox values to their initial value.
73 void Reset(); 84 void Reset();
74 85
75 string16 query_; 86 string16 query_;
76 bool verbatim_; 87 bool verbatim_;
77 size_t selection_start_; 88 size_t selection_start_;
78 size_t selection_end_; 89 size_t selection_end_;
79 size_t results_base_; 90 size_t results_base_;
80 gfx::Rect rect_; 91 int start_margin_;
92 int end_margin_;
93 gfx::Rect popup_bounds_;
81 std::vector<InstantAutocompleteResult> autocomplete_results_; 94 std::vector<InstantAutocompleteResult> autocomplete_results_;
82 size_t last_results_base_; 95 size_t last_results_base_;
83 std::vector<InstantAutocompleteResult> last_autocomplete_results_; 96 std::vector<InstantAutocompleteResult> last_autocomplete_results_;
84 bool is_focused_; 97 bool is_focused_;
85 bool active_tab_is_ntp_; 98 bool active_tab_is_ntp_;
86 99
87 DISALLOW_COPY_AND_ASSIGN(SearchBox); 100 DISALLOW_COPY_AND_ASSIGN(SearchBox);
88 }; 101 };
89 102
90 #endif // CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_ 103 #endif // CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698