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

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

Issue 14608004: Move instant support to SearchTabHelper. Fix InstantTab reset. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Guard instant-extended-only bits. 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 class WebContents; 22 class WebContents;
22 } 23 }
23 24
24 namespace gfx { 25 namespace gfx {
25 class Rect; 26 class Rect;
26 } 27 }
27 28
28 // InstantPage is used to exchange messages with a page that implements the 29 // InstantPage is used to exchange messages with a page that implements the
29 // Instant/Embedded Search API (http://dev.chromium.org/embeddedsearch). 30 // Instant/Embedded Search API (http://dev.chromium.org/embeddedsearch).
30 // InstantPage is not used directly but via one of its derived classes: 31 // InstantPage is not used directly but via one of its derived classes:
31 // InstantOverlay, InstantNTP and InstantTab. 32 // InstantOverlay, InstantNTP and InstantTab.
32 class InstantPage : public content::WebContentsObserver { 33 class InstantPage : public content::WebContentsObserver,
34 public SearchModelObserver {
33 public: 35 public:
34 // InstantPage calls its delegate in response to messages received from the 36 // InstantPage calls its delegate in response to messages received from the
35 // page. Each method is called with the |contents| corresponding to the page 37 // page. Each method is called with the |contents| corresponding to the page
36 // we are observing. 38 // we are observing.
37 class Delegate { 39 class Delegate {
38 public: 40 public:
39 // Called when a RenderView is created, so that state can be initialized. 41 // Called when a RenderView is created, so that state can be initialized.
40 virtual void InstantPageRenderViewCreated( 42 virtual void InstantPageRenderViewCreated(
41 const content::WebContents* contents) = 0; 43 const content::WebContents* contents) = 0;
42 44
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 content::RenderViewHost* render_view_host) OVERRIDE; 211 content::RenderViewHost* render_view_host) OVERRIDE;
210 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 212 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
211 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; 213 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE;
212 virtual void DidCommitProvisionalLoadForFrame( 214 virtual void DidCommitProvisionalLoadForFrame(
213 int64 frame_id, 215 int64 frame_id,
214 bool is_main_frame, 216 bool is_main_frame,
215 const GURL& url, 217 const GURL& url,
216 content::PageTransition transition_type, 218 content::PageTransition transition_type,
217 content::RenderViewHost* render_view_host) OVERRIDE; 219 content::RenderViewHost* render_view_host) OVERRIDE;
218 220
221 // Overridden from SearchModelObserver:
222 virtual void ModelChanged(const SearchModel::State& old_state,
223 const SearchModel::State& new_state) OVERRIDE;
224
225 // Helper to look up the SearchModel for this page.
226 SearchModel* GetSearchModel();
227
228 // Update the status of Instant support.
229 void SetSupportsInstant(bool supports_instant);
230
219 void OnSetSuggestions(int page_id, 231 void OnSetSuggestions(int page_id,
220 const std::vector<InstantSuggestion>& suggestions); 232 const std::vector<InstantSuggestion>& suggestions);
221 void OnInstantSupportDetermined(int page_id, bool supports_instant); 233 void OnInstantSupportDetermined(int page_id, bool supports_instant);
222 void OnShowInstantOverlay(int page_id, 234 void OnShowInstantOverlay(int page_id,
223 int height, 235 int height,
224 InstantSizeUnits units); 236 InstantSizeUnits units);
225 void OnFocusOmnibox(int page_id, OmniboxFocusState state); 237 void OnFocusOmnibox(int page_id, OmniboxFocusState state);
226 void OnSearchBoxNavigate(int page_id, 238 void OnSearchBoxNavigate(int page_id,
227 const GURL& url, 239 const GURL& url,
228 content::PageTransition transition, 240 content::PageTransition transition,
229 WindowOpenDisposition disposition); 241 WindowOpenDisposition disposition);
230 void OnDeleteMostVisitedItem(InstantRestrictedID most_visited_item_id); 242 void OnDeleteMostVisitedItem(InstantRestrictedID most_visited_item_id);
231 void OnUndoMostVisitedDeletion(InstantRestrictedID most_visited_item_id); 243 void OnUndoMostVisitedDeletion(InstantRestrictedID most_visited_item_id);
232 void OnUndoAllMostVisitedDeletions(); 244 void OnUndoAllMostVisitedDeletions();
233 245
234 Delegate* const delegate_; 246 Delegate* const delegate_;
235 const std::string instant_url_; 247 const std::string instant_url_;
248 const bool extended_enabled_;
236 bool supports_instant_; 249 bool supports_instant_;
237 250
238 DISALLOW_COPY_AND_ASSIGN(InstantPage); 251 DISALLOW_COPY_AND_ASSIGN(InstantPage);
239 }; 252 };
240 253
241 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_PAGE_H_ 254 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_PAGE_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/search/instant_controller.cc ('k') | chrome/browser/ui/search/instant_page.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698