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

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: The Great Samarth Merge of 2013 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 // In extended Instant, returns the start-edge margin of the location bar in
58 // adjusted for the page zoom. 58 // screen pixels.
59 int GetStartMargin() const; 59 int GetStartMargin() const;
60 int GetEndMargin() const; 60
61 // In extended Instant, returns the width of the location bar. Otherwise,
62 // returns the popup width.
63 int GetWidth() const;
61 64
62 // Returns the bounds of the omnibox popup in screen coordinates. 65 // Returns the bounds of the omnibox popup in screen coordinates.
63 gfx::Rect GetPopupBounds() const; 66 gfx::Rect GetPopupBounds() const;
64 67
65 const std::vector<InstantAutocompleteResult>& GetAutocompleteResults(); 68 const std::vector<InstantAutocompleteResult>& GetAutocompleteResults();
66 // Searchbox retains ownership of this object. 69 // Searchbox retains ownership of this object.
67 const InstantAutocompleteResult* 70 const InstantAutocompleteResult*
68 GetAutocompleteResultWithId(size_t restricted_id) const; 71 GetAutocompleteResultWithId(size_t restricted_id) const;
69 const ThemeBackgroundInfo& GetThemeBackgroundInfo(); 72 const ThemeBackgroundInfo& GetThemeBackgroundInfo();
70 int GetThemeAreaHeight(); 73 int GetThemeAreaHeight();
71 74
72 private: 75 private:
73 // Overridden from content::RenderViewObserver: 76 // Overridden from content::RenderViewObserver:
74 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 77 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
75 virtual void DidClearWindowObject(WebKit::WebFrame* frame) OVERRIDE; 78 virtual void DidClearWindowObject(WebKit::WebFrame* frame) OVERRIDE;
76 79
77 void OnChange(const string16& query, 80 void OnChange(const string16& query,
78 bool verbatim, 81 bool verbatim,
79 size_t selection_start, 82 size_t selection_start,
80 size_t selection_end); 83 size_t selection_end);
81 void OnSubmit(const string16& query); 84 void OnSubmit(const string16& query);
82 void OnCancel(const string16& query); 85 void OnCancel(const string16& query);
83 void OnPopupResize(const gfx::Rect& bounds); 86 void OnPopupResize(const gfx::Rect& bounds);
84 void OnMarginChange(int start, int end); 87 void OnMarginChange(int margin, int width);
85 void OnDetermineIfPageSupportsInstant(); 88 void OnDetermineIfPageSupportsInstant();
86 void OnAutocompleteResults( 89 void OnAutocompleteResults(
87 const std::vector<InstantAutocompleteResult>& results); 90 const std::vector<InstantAutocompleteResult>& results);
88 void OnUpOrDownKeyPressed(int count); 91 void OnUpOrDownKeyPressed(int count);
89 void OnKeyCaptureChange(bool is_key_capture_enabled); 92 void OnKeyCaptureChange(bool is_key_capture_enabled);
90 void OnModeChanged(const chrome::search::Mode& mode); 93 void OnModeChanged(const chrome::search::Mode& mode);
91 void OnSetDisplayInstantResults(bool display_instant_results); 94 void OnSetDisplayInstantResults(bool display_instant_results);
92 void OnThemeChanged(const ThemeBackgroundInfo& theme_info); 95 void OnThemeChanged(const ThemeBackgroundInfo& theme_info);
93 void OnThemeAreaHeightChanged(int height); 96 void OnThemeAreaHeightChanged(int height);
94 void OnFontInformationReceived(const string16& omnibox_font, 97 void OnFontInformationReceived(const string16& omnibox_font,
95 size_t omnibox_font_size); 98 size_t omnibox_font_size);
96 99
97 // Returns the current zoom factor of the render view or 1 on failure. 100 // Returns the current zoom factor of the render view or 1 on failure.
98 double GetZoom() const; 101 double GetZoom() const;
99 102
100 // Sets the searchbox values to their initial value. 103 // Sets the searchbox values to their initial value.
101 void Reset(); 104 void Reset();
102 105
103 string16 query_; 106 string16 query_;
104 bool verbatim_; 107 bool verbatim_;
105 size_t selection_start_; 108 size_t selection_start_;
106 size_t selection_end_; 109 size_t selection_end_;
107 size_t results_base_; 110 size_t results_base_;
108 int start_margin_; 111 int start_margin_;
109 int end_margin_; 112 int width_;
sreeram 2013/02/14 18:26:57 Why do we need this? It's the same as the popup_bo
melevin 2013/02/19 22:00:49 Yeah I suppose we can reuse that.
110 gfx::Rect popup_bounds_; 113 gfx::Rect popup_bounds_;
111 std::vector<InstantAutocompleteResult> autocomplete_results_; 114 std::vector<InstantAutocompleteResult> autocomplete_results_;
112 size_t last_results_base_; 115 size_t last_results_base_;
113 std::vector<InstantAutocompleteResult> last_autocomplete_results_; 116 std::vector<InstantAutocompleteResult> last_autocomplete_results_;
114 bool is_key_capture_enabled_; 117 bool is_key_capture_enabled_;
115 chrome::search::Mode mode_; 118 chrome::search::Mode mode_;
116 ThemeBackgroundInfo theme_info_; 119 ThemeBackgroundInfo theme_info_;
117 int theme_area_height_; 120 int theme_area_height_;
118 bool display_instant_results_; 121 bool display_instant_results_;
119 string16 omnibox_font_; 122 string16 omnibox_font_;
120 size_t omnibox_font_size_; 123 size_t omnibox_font_size_;
121 124
122 DISALLOW_COPY_AND_ASSIGN(SearchBox); 125 DISALLOW_COPY_AND_ASSIGN(SearchBox);
123 }; 126 };
124 127
125 #endif // CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_ 128 #endif // CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698