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

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: Addressed review comments 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 const content::LoadCommittedDetails& details, 235 const content::LoadCommittedDetails& details,
234 const content::FrameNavigateParams& params) OVERRIDE; 236 const content::FrameNavigateParams& params) OVERRIDE;
235 virtual void DidFailProvisionalLoad( 237 virtual void DidFailProvisionalLoad(
236 int64 frame_id, 238 int64 frame_id,
237 bool is_main_frame, 239 bool is_main_frame,
238 const GURL& validated_url, 240 const GURL& validated_url,
239 int error_code, 241 int error_code,
240 const string16& error_description, 242 const string16& error_description,
241 content::RenderViewHost* render_view_host) OVERRIDE; 243 content::RenderViewHost* render_view_host) OVERRIDE;
242 244
245 // Overridden from SearchModelObserver:
246 virtual void ModelChanged(const SearchModel::State& old_state,
247 const SearchModel::State& new_state) OVERRIDE;
248
249 // Helper to look up the SearchModel for this page.
250 SearchModel* GetSearchModel();
251
252 // Update the status of Instant support.
253 void SetSupportsInstant(bool supports_instant);
254
243 void OnSetSuggestions(int page_id, 255 void OnSetSuggestions(int page_id,
244 const std::vector<InstantSuggestion>& suggestions); 256 const std::vector<InstantSuggestion>& suggestions);
245 void OnInstantSupportDetermined(int page_id, bool supports_instant); 257 void OnInstantSupportDetermined(int page_id, bool supports_instant);
246 void OnShowInstantOverlay(int page_id, 258 void OnShowInstantOverlay(int page_id,
247 int height, 259 int height,
248 InstantSizeUnits units); 260 InstantSizeUnits units);
249 void OnFocusOmnibox(int page_id, OmniboxFocusState state); 261 void OnFocusOmnibox(int page_id, OmniboxFocusState state);
250 void OnSearchBoxNavigate(int page_id, 262 void OnSearchBoxNavigate(int page_id,
251 const GURL& url, 263 const GURL& url,
252 content::PageTransition transition, 264 content::PageTransition transition,
253 WindowOpenDisposition disposition); 265 WindowOpenDisposition disposition);
254 void OnDeleteMostVisitedItem(InstantRestrictedID most_visited_item_id); 266 void OnDeleteMostVisitedItem(InstantRestrictedID most_visited_item_id);
255 void OnUndoMostVisitedDeletion(InstantRestrictedID most_visited_item_id); 267 void OnUndoMostVisitedDeletion(InstantRestrictedID most_visited_item_id);
256 void OnUndoAllMostVisitedDeletions(); 268 void OnUndoAllMostVisitedDeletions();
257 269
258 Delegate* const delegate_; 270 Delegate* const delegate_;
259 const std::string instant_url_; 271 const std::string instant_url_;
272 const bool extended_enabled_;
260 bool supports_instant_; 273 bool supports_instant_;
261 bool instant_support_determined_; 274 bool instant_support_determined_;
262 275
263 DISALLOW_COPY_AND_ASSIGN(InstantPage); 276 DISALLOW_COPY_AND_ASSIGN(InstantPage);
264 }; 277 };
265 278
266 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_PAGE_H_ 279 #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_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698