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

Side by Side Diff: chrome/browser/ui/search/instant_page.h

Issue 14911005: Move instant support to SearchTabHelper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed instant support code from InstantPage Created 7 years, 7 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_BROWSER_UI_SEARCH_INSTANT_PAGE_H_ 5 #ifndef CHROME_BROWSER_UI_SEARCH_INSTANT_PAGE_H_
6 #define CHROME_BROWSER_UI_SEARCH_INSTANT_PAGE_H_ 6 #define CHROME_BROWSER_UI_SEARCH_INSTANT_PAGE_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/string16.h" 12 #include "base/string16.h"
13 #include "chrome/browser/ui/search/search_model_observer.h"
13 #include "chrome/common/instant_types.h" 14 #include "chrome/common/instant_types.h"
14 #include "chrome/common/omnibox_focus_state.h" 15 #include "chrome/common/omnibox_focus_state.h"
15 #include "content/public/browser/web_contents_observer.h" 16 #include "content/public/browser/web_contents_observer.h"
16 #include "content/public/common/page_transition_types.h" 17 #include "content/public/common/page_transition_types.h"
17 18
18 class GURL; 19 class GURL;
19 20
20 namespace content { 21 namespace content {
21 struct FrameNavigateParams; 22 struct FrameNavigateParams;
22 struct LoadCommittedDetails; 23 struct LoadCommittedDetails;
23 class WebContents; 24 class WebContents;
24 } 25 }
25 26
26 namespace gfx { 27 namespace gfx {
27 class Rect; 28 class Rect;
28 } 29 }
29 30
30 // InstantPage is used to exchange messages with a page that implements the 31 // InstantPage is used to exchange messages with a page that implements the
31 // Instant/Embedded Search API (http://dev.chromium.org/embeddedsearch). 32 // Instant/Embedded Search API (http://dev.chromium.org/embeddedsearch).
32 // InstantPage is not used directly but via one of its derived classes: 33 // InstantPage is not used directly but via one of its derived classes:
33 // InstantOverlay, InstantNTP and InstantTab. 34 // InstantOverlay, InstantNTP and InstantTab.
34 class InstantPage : public content::WebContentsObserver { 35 class InstantPage : public content::WebContentsObserver,
36 public SearchModelObserver {
35 public: 37 public:
36 // InstantPage calls its delegate in response to messages received from the 38 // InstantPage calls its delegate in response to messages received from the
37 // page. Each method is called with the |contents| corresponding to the page 39 // page. Each method is called with the |contents| corresponding to the page
38 // we are observing. 40 // we are observing.
39 class Delegate { 41 class Delegate {
40 public: 42 public:
41 // Called when a RenderView is created, so that state can be initialized. 43 // Called when a RenderView is created, so that state can be initialized.
42 virtual void InstantPageRenderViewCreated( 44 virtual void InstantPageRenderViewCreated(
43 const content::WebContents* contents) = 0; 45 const content::WebContents* contents) = 0;
44 46
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 // by the omnibox dropdown. 150 // by the omnibox dropdown.
149 void SetPopupBounds(const gfx::Rect& bounds); 151 void SetPopupBounds(const gfx::Rect& bounds);
150 152
151 // Tells the page the bounds of the omnibox (in screen coordinates). This is 153 // Tells the page the bounds of the omnibox (in screen coordinates). This is
152 // used by the page to align text or assets properly with the omnibox. 154 // used by the page to align text or assets properly with the omnibox.
153 void SetOmniboxBounds(const gfx::Rect& bounds); 155 void SetOmniboxBounds(const gfx::Rect& bounds);
154 156
155 // Tells the page about the font information. 157 // Tells the page about the font information.
156 void InitializeFonts(); 158 void InitializeFonts();
157 159
158 // Tells the renderer to determine if the page supports the Instant API, which
159 // results in a call to InstantSupportDetermined() when the reply is received.
160 void DetermineIfPageSupportsInstant();
161
162 // Tells the page about the available autocomplete results. 160 // Tells the page about the available autocomplete results.
163 void SendAutocompleteResults( 161 void SendAutocompleteResults(
164 const std::vector<InstantAutocompleteResult>& results); 162 const std::vector<InstantAutocompleteResult>& results);
165 163
166 // Tells the page that the user pressed Up or Down in the omnibox. |count| is 164 // Tells the page that the user pressed Up or Down in the omnibox. |count| is
167 // a repeat count, negative for moving up, positive for moving down. 165 // a repeat count, negative for moving up, positive for moving down.
168 void UpOrDownKeyPressed(int count); 166 void UpOrDownKeyPressed(int count);
169 167
170 // Tells the page that the user pressed Esc key in the omnibox. 168 // Tells the page that the user pressed Esc key in the omnibox.
171 void EscKeyPressed(); 169 void EscKeyPressed();
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 virtual bool ShouldProcessAboutToNavigateMainFrame(); 207 virtual bool ShouldProcessAboutToNavigateMainFrame();
210 virtual bool ShouldProcessSetSuggestions(); 208 virtual bool ShouldProcessSetSuggestions();
211 virtual bool ShouldProcessShowInstantOverlay(); 209 virtual bool ShouldProcessShowInstantOverlay();
212 virtual bool ShouldProcessFocusOmnibox(); 210 virtual bool ShouldProcessFocusOmnibox();
213 virtual bool ShouldProcessNavigateToURL(); 211 virtual bool ShouldProcessNavigateToURL();
214 212
215 private: 213 private:
216 // Overridden from content::WebContentsObserver: 214 // Overridden from content::WebContentsObserver:
217 virtual void RenderViewCreated( 215 virtual void RenderViewCreated(
218 content::RenderViewHost* render_view_host) OVERRIDE; 216 content::RenderViewHost* render_view_host) OVERRIDE;
219 virtual void DidFinishLoad(
220 int64 frame_id,
221 const GURL& validated_url,
222 bool is_main_frame,
223 content::RenderViewHost* render_view_host) OVERRIDE;
224 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 217 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
225 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; 218 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE;
226 virtual void DidCommitProvisionalLoadForFrame( 219 virtual void DidCommitProvisionalLoadForFrame(
227 int64 frame_id, 220 int64 frame_id,
228 bool is_main_frame, 221 bool is_main_frame,
229 const GURL& url, 222 const GURL& url,
230 content::PageTransition transition_type, 223 content::PageTransition transition_type,
231 content::RenderViewHost* render_view_host) OVERRIDE; 224 content::RenderViewHost* render_view_host) OVERRIDE;
232 virtual void DidNavigateMainFrame( 225 virtual void DidNavigateMainFrame(
233 const content::LoadCommittedDetails& details, 226 const content::LoadCommittedDetails& details,
234 const content::FrameNavigateParams& params) OVERRIDE; 227 const content::FrameNavigateParams& params) OVERRIDE;
235 virtual void DidFailProvisionalLoad( 228 virtual void DidFailProvisionalLoad(
236 int64 frame_id, 229 int64 frame_id,
237 bool is_main_frame, 230 bool is_main_frame,
238 const GURL& validated_url, 231 const GURL& validated_url,
239 int error_code, 232 int error_code,
240 const string16& error_description, 233 const string16& error_description,
241 content::RenderViewHost* render_view_host) OVERRIDE; 234 content::RenderViewHost* render_view_host) OVERRIDE;
242 235
236 // Overridden from SearchModelObserver:
237 virtual void ModelChanged(const SearchModel::State& old_state,
238 const SearchModel::State& new_state) OVERRIDE;
239
240 // Helper to look up the SearchModel for this page.
241 SearchModel* GetSearchModel();
242
243 // Update the status of Instant support.
244 void SetSupportsInstant(bool supports_instant);
245
243 void OnSetSuggestions(int page_id, 246 void OnSetSuggestions(int page_id,
244 const std::vector<InstantSuggestion>& suggestions); 247 const std::vector<InstantSuggestion>& suggestions);
245 void OnInstantSupportDetermined(int page_id, bool supports_instant);
246 void OnShowInstantOverlay(int page_id, 248 void OnShowInstantOverlay(int page_id,
247 int height, 249 int height,
248 InstantSizeUnits units); 250 InstantSizeUnits units);
249 void OnFocusOmnibox(int page_id, OmniboxFocusState state); 251 void OnFocusOmnibox(int page_id, OmniboxFocusState state);
250 void OnSearchBoxNavigate(int page_id, 252 void OnSearchBoxNavigate(int page_id,
251 const GURL& url, 253 const GURL& url,
252 content::PageTransition transition, 254 content::PageTransition transition,
253 WindowOpenDisposition disposition); 255 WindowOpenDisposition disposition);
254 void OnDeleteMostVisitedItem(InstantRestrictedID most_visited_item_id); 256 void OnDeleteMostVisitedItem(InstantRestrictedID most_visited_item_id);
255 void OnUndoMostVisitedDeletion(InstantRestrictedID most_visited_item_id); 257 void OnUndoMostVisitedDeletion(InstantRestrictedID most_visited_item_id);
256 void OnUndoAllMostVisitedDeletions(); 258 void OnUndoAllMostVisitedDeletions();
257 259
258 Delegate* const delegate_; 260 Delegate* const delegate_;
259 const std::string instant_url_; 261 const std::string instant_url_;
262 const bool extended_enabled_;
260 bool supports_instant_; 263 bool supports_instant_;
261 bool instant_support_determined_; 264 bool instant_support_determined_;
samarth 2013/05/10 01:32:38 Is this necessary anymore?
kmadhusu 2013/05/13 17:13:24 Removed. Fixed interactive_ui_tests to use support
262 265
263 DISALLOW_COPY_AND_ASSIGN(InstantPage); 266 DISALLOW_COPY_AND_ASSIGN(InstantPage);
264 }; 267 };
265 268
266 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_PAGE_H_ 269 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_PAGE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/search/instant_page.cc » ('j') | chrome/browser/ui/search/instant_page.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698