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

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

Issue 12047107: Change the SearchBox API from using the start/end margins of the location bar to using the start ma… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync to r180728 Created 7 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 bool verbatim() const { return verbatim_; } 47 bool verbatim() const { return verbatim_; }
48 size_t selection_start() const { return selection_start_; } 48 size_t selection_start() const { return selection_start_; }
49 size_t selection_end() const { return selection_end_; } 49 size_t selection_end() const { return selection_end_; }
50 int results_base() const { return results_base_; } 50 int results_base() const { return results_base_; }
51 const chrome::search::Mode& mode() const { return mode_; } 51 const chrome::search::Mode& mode() const { return mode_; }
52 bool is_key_capture_enabled() const { return is_key_capture_enabled_; } 52 bool is_key_capture_enabled() const { return is_key_capture_enabled_; }
53 bool display_instant_results() const { return display_instant_results_; } 53 bool display_instant_results() const { return display_instant_results_; }
54 const string16& omnibox_font() const { return omnibox_font_; } 54 const string16& omnibox_font() const { return omnibox_font_; }
55 size_t omnibox_font_size() const { return omnibox_font_size_; } 55 size_t omnibox_font_size() const { return omnibox_font_size_; }
56 56
57 // These functions return the start/end margins of the page text area, 57 // These functions return the start-edge margin and width of the location bar,
58 // adjusted for the page zoom. 58 // adjusted for the page zoom.
59 int GetStartMargin() const; 59 int GetLocationBarMargin() const;
60 int GetEndMargin() const; 60 int GetLocationBarWidth() const;
61 61
62 // Returns the bounds of the omnibox popup in screen coordinates. 62 // Returns the bounds of the omnibox popup in screen coordinates.
63 gfx::Rect GetPopupBounds() const; 63 gfx::Rect GetPopupBounds() const;
64 64
65 const std::vector<InstantAutocompleteResult>& GetAutocompleteResults(); 65 const std::vector<InstantAutocompleteResult>& GetAutocompleteResults();
66 // Searchbox retains ownership of this object. 66 // Searchbox retains ownership of this object.
67 const InstantAutocompleteResult* 67 const InstantAutocompleteResult*
68 GetAutocompleteResultWithId(size_t restricted_id) const; 68 GetAutocompleteResultWithId(size_t restricted_id) const;
69 const ThemeBackgroundInfo& GetThemeBackgroundInfo(); 69 const ThemeBackgroundInfo& GetThemeBackgroundInfo();
70 int GetThemeAreaHeight(); 70 int GetThemeAreaHeight();
71 71
72 private: 72 private:
73 // Overridden from content::RenderViewObserver: 73 // Overridden from content::RenderViewObserver:
74 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 74 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
75 virtual void DidClearWindowObject(WebKit::WebFrame* frame) OVERRIDE; 75 virtual void DidClearWindowObject(WebKit::WebFrame* frame) OVERRIDE;
76 76
77 void OnChange(const string16& query, 77 void OnChange(const string16& query,
78 bool verbatim, 78 bool verbatim,
79 size_t selection_start, 79 size_t selection_start,
80 size_t selection_end); 80 size_t selection_end);
81 void OnSubmit(const string16& query); 81 void OnSubmit(const string16& query);
82 void OnCancel(const string16& query); 82 void OnCancel(const string16& query);
83 void OnPopupResize(const gfx::Rect& bounds); 83 void OnPopupResize(const gfx::Rect& bounds);
84 void OnMarginChange(int start, int end); 84 void OnMarginChange(int margin, int width);
85 void OnDetermineIfPageSupportsInstant(); 85 void OnDetermineIfPageSupportsInstant();
86 void OnAutocompleteResults( 86 void OnAutocompleteResults(
87 const std::vector<InstantAutocompleteResult>& results); 87 const std::vector<InstantAutocompleteResult>& results);
88 void OnUpOrDownKeyPressed(int count); 88 void OnUpOrDownKeyPressed(int count);
89 void OnKeyCaptureChange(bool is_key_capture_enabled); 89 void OnKeyCaptureChange(bool is_key_capture_enabled);
90 void OnModeChanged(const chrome::search::Mode& mode); 90 void OnModeChanged(const chrome::search::Mode& mode);
91 void OnSetDisplayInstantResults(bool display_instant_results); 91 void OnSetDisplayInstantResults(bool display_instant_results);
92 void OnThemeChanged(const ThemeBackgroundInfo& theme_info); 92 void OnThemeChanged(const ThemeBackgroundInfo& theme_info);
93 void OnThemeAreaHeightChanged(int height); 93 void OnThemeAreaHeightChanged(int height);
94 void OnFontInformationReceived(const string16& omnibox_font, 94 void OnFontInformationReceived(const string16& omnibox_font,
95 size_t omnibox_font_size); 95 size_t omnibox_font_size);
96 96
97 // Returns the current zoom factor of the render view or 1 on failure. 97 // Returns the current zoom factor of the render view or 1 on failure.
98 double GetZoom() const; 98 double GetZoom() const;
99 99
100 // Sets the searchbox values to their initial value. 100 // Sets the searchbox values to their initial value.
101 void Reset(); 101 void Reset();
102 102
103 string16 query_; 103 string16 query_;
104 bool verbatim_; 104 bool verbatim_;
105 size_t selection_start_; 105 size_t selection_start_;
106 size_t selection_end_; 106 size_t selection_end_;
107 size_t results_base_; 107 size_t results_base_;
108 int start_margin_; 108 int location_bar_margin_;
109 int end_margin_; 109 int location_bar_width_;
110 gfx::Rect popup_bounds_; 110 gfx::Rect popup_bounds_;
111 std::vector<InstantAutocompleteResult> autocomplete_results_; 111 std::vector<InstantAutocompleteResult> autocomplete_results_;
112 size_t last_results_base_; 112 size_t last_results_base_;
113 std::vector<InstantAutocompleteResult> last_autocomplete_results_; 113 std::vector<InstantAutocompleteResult> last_autocomplete_results_;
114 bool is_key_capture_enabled_; 114 bool is_key_capture_enabled_;
115 chrome::search::Mode mode_; 115 chrome::search::Mode mode_;
116 ThemeBackgroundInfo theme_info_; 116 ThemeBackgroundInfo theme_info_;
117 int theme_area_height_; 117 int theme_area_height_;
118 bool display_instant_results_; 118 bool display_instant_results_;
119 string16 omnibox_font_; 119 string16 omnibox_font_;
120 size_t omnibox_font_size_; 120 size_t omnibox_font_size_;
121 121
122 DISALLOW_COPY_AND_ASSIGN(SearchBox); 122 DISALLOW_COPY_AND_ASSIGN(SearchBox);
123 }; 123 };
124 124
125 #endif // CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_ 125 #endif // CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698