OLD | NEW |
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/common/instant_types.h" | 13 #include "chrome/common/instant_types.h" |
14 #include "chrome/common/omnibox_focus_state.h" | 14 #include "chrome/common/omnibox_focus_state.h" |
15 #include "content/public/browser/web_contents_observer.h" | 15 #include "content/public/browser/web_contents_observer.h" |
16 #include "content/public/common/page_transition_types.h" | 16 #include "content/public/common/page_transition_types.h" |
17 | 17 |
18 class GURL; | 18 class GURL; |
19 | 19 |
20 namespace content { | 20 namespace content { |
21 class WebContents; | 21 class WebContents; |
| 22 struct FrameNavigateParams; |
| 23 struct LoadCommittedDetails; |
22 } | 24 } |
23 | 25 |
24 namespace gfx { | 26 namespace gfx { |
25 class Rect; | 27 class Rect; |
26 } | 28 } |
27 | 29 |
28 // InstantPage is used to exchange messages with a page that implements the | 30 // InstantPage is used to exchange messages with a page that implements the |
29 // Instant/Embedded Search API (http://dev.chromium.org/embeddedsearch). | 31 // Instant/Embedded Search API (http://dev.chromium.org/embeddedsearch). |
30 // InstantPage is not used directly but via one of its derived classes: | 32 // InstantPage is not used directly but via one of its derived classes: |
31 // InstantOverlay, InstantNTP and InstantTab. | 33 // InstantOverlay, InstantNTP and InstantTab. |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 virtual void DeleteMostVisitedItem( | 86 virtual void DeleteMostVisitedItem( |
85 InstantRestrictedID most_visited_item_id) = 0; | 87 InstantRestrictedID most_visited_item_id) = 0; |
86 | 88 |
87 // Called when the SearchBox wants to undo a Most Visited deletion. | 89 // Called when the SearchBox wants to undo a Most Visited deletion. |
88 virtual void UndoMostVisitedDeletion( | 90 virtual void UndoMostVisitedDeletion( |
89 InstantRestrictedID most_visited_item_id) = 0; | 91 InstantRestrictedID most_visited_item_id) = 0; |
90 | 92 |
91 // Called when the SearchBox wants to undo all Most Visited deletions. | 93 // Called when the SearchBox wants to undo all Most Visited deletions. |
92 virtual void UndoAllMostVisitedDeletions() = 0; | 94 virtual void UndoAllMostVisitedDeletions() = 0; |
93 | 95 |
| 96 // Called when the preloaded NTP is ready for display. |
| 97 virtual void InstantPageLoadFailed(content::WebContents* contents) = 0; |
| 98 |
94 protected: | 99 protected: |
95 virtual ~Delegate(); | 100 virtual ~Delegate(); |
96 }; | 101 }; |
97 | 102 |
98 virtual ~InstantPage(); | 103 virtual ~InstantPage(); |
99 | 104 |
100 // The WebContents corresponding to the page we're talking to. May be NULL. | 105 // The WebContents corresponding to the page we're talking to. May be NULL. |
101 content::WebContents* contents() const { return web_contents(); } | 106 content::WebContents* contents() const { return web_contents(); } |
102 | 107 |
103 // Returns true if the page is known to support the Instant API. This starts | 108 // Returns true if the page is known to support the Instant API. This starts |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 bool is_main_frame, | 209 bool is_main_frame, |
205 content::RenderViewHost* render_view_host) OVERRIDE; | 210 content::RenderViewHost* render_view_host) OVERRIDE; |
206 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 211 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
207 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; | 212 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; |
208 virtual void DidCommitProvisionalLoadForFrame( | 213 virtual void DidCommitProvisionalLoadForFrame( |
209 int64 frame_id, | 214 int64 frame_id, |
210 bool is_main_frame, | 215 bool is_main_frame, |
211 const GURL& url, | 216 const GURL& url, |
212 content::PageTransition transition_type, | 217 content::PageTransition transition_type, |
213 content::RenderViewHost* render_view_host) OVERRIDE; | 218 content::RenderViewHost* render_view_host) OVERRIDE; |
| 219 virtual void DidNavigateAnyFrame( |
| 220 const content::LoadCommittedDetails& details, |
| 221 const content::FrameNavigateParams& params) OVERRIDE; |
| 222 |
| 223 virtual void DidFailProvisionalLoad( |
| 224 int64 frame_id, |
| 225 bool is_main_frame, |
| 226 const GURL& validated_url, |
| 227 int error_code, |
| 228 const string16& error_description, |
| 229 content::RenderViewHost* render_view_host) OVERRIDE; |
214 | 230 |
215 void OnSetSuggestions(int page_id, | 231 void OnSetSuggestions(int page_id, |
216 const std::vector<InstantSuggestion>& suggestions); | 232 const std::vector<InstantSuggestion>& suggestions); |
217 void OnInstantSupportDetermined(int page_id, bool supports_instant); | 233 void OnInstantSupportDetermined(int page_id, bool supports_instant); |
218 void OnShowInstantOverlay(int page_id, | 234 void OnShowInstantOverlay(int page_id, |
219 int height, | 235 int height, |
220 InstantSizeUnits units); | 236 InstantSizeUnits units); |
221 void OnFocusOmnibox(int page_id, OmniboxFocusState state); | 237 void OnFocusOmnibox(int page_id, OmniboxFocusState state); |
222 void OnSearchBoxNavigate(int page_id, | 238 void OnSearchBoxNavigate(int page_id, |
223 const GURL& url, | 239 const GURL& url, |
224 content::PageTransition transition, | 240 content::PageTransition transition, |
225 WindowOpenDisposition disposition); | 241 WindowOpenDisposition disposition); |
226 void OnDeleteMostVisitedItem(InstantRestrictedID most_visited_item_id); | 242 void OnDeleteMostVisitedItem(InstantRestrictedID most_visited_item_id); |
227 void OnUndoMostVisitedDeletion(InstantRestrictedID most_visited_item_id); | 243 void OnUndoMostVisitedDeletion(InstantRestrictedID most_visited_item_id); |
228 void OnUndoAllMostVisitedDeletions(); | 244 void OnUndoAllMostVisitedDeletions(); |
229 | 245 |
230 Delegate* const delegate_; | 246 Delegate* const delegate_; |
231 bool supports_instant_; | 247 bool supports_instant_; |
232 | 248 |
233 DISALLOW_COPY_AND_ASSIGN(InstantPage); | 249 DISALLOW_COPY_AND_ASSIGN(InstantPage); |
234 }; | 250 }; |
235 | 251 |
236 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_PAGE_H_ | 252 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_PAGE_H_ |
OLD | NEW |