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 struct FrameNavigateParams; |
| 22 struct LoadCommittedDetails; |
21 class WebContents; | 23 class WebContents; |
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: |
(...skipping 53 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 page fails to load for whatever reason. |
| 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 the Instant URL that was loaded for this page. Returns the empty | 108 // Returns the Instant URL that was loaded for this page. Returns the empty |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 bool is_main_frame, | 213 bool is_main_frame, |
209 content::RenderViewHost* render_view_host) OVERRIDE; | 214 content::RenderViewHost* render_view_host) OVERRIDE; |
210 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 215 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
211 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; | 216 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; |
212 virtual void DidCommitProvisionalLoadForFrame( | 217 virtual void DidCommitProvisionalLoadForFrame( |
213 int64 frame_id, | 218 int64 frame_id, |
214 bool is_main_frame, | 219 bool is_main_frame, |
215 const GURL& url, | 220 const GURL& url, |
216 content::PageTransition transition_type, | 221 content::PageTransition transition_type, |
217 content::RenderViewHost* render_view_host) OVERRIDE; | 222 content::RenderViewHost* render_view_host) OVERRIDE; |
| 223 virtual void DidNavigateMainFrame( |
| 224 const content::LoadCommittedDetails& details, |
| 225 const content::FrameNavigateParams& params) OVERRIDE; |
| 226 virtual void DidFailProvisionalLoad( |
| 227 int64 frame_id, |
| 228 bool is_main_frame, |
| 229 const GURL& validated_url, |
| 230 int error_code, |
| 231 const string16& error_description, |
| 232 content::RenderViewHost* render_view_host) OVERRIDE; |
218 | 233 |
219 void OnSetSuggestions(int page_id, | 234 void OnSetSuggestions(int page_id, |
220 const std::vector<InstantSuggestion>& suggestions); | 235 const std::vector<InstantSuggestion>& suggestions); |
221 void OnInstantSupportDetermined(int page_id, bool supports_instant); | 236 void OnInstantSupportDetermined(int page_id, bool supports_instant); |
222 void OnShowInstantOverlay(int page_id, | 237 void OnShowInstantOverlay(int page_id, |
223 int height, | 238 int height, |
224 InstantSizeUnits units); | 239 InstantSizeUnits units); |
225 void OnFocusOmnibox(int page_id, OmniboxFocusState state); | 240 void OnFocusOmnibox(int page_id, OmniboxFocusState state); |
226 void OnSearchBoxNavigate(int page_id, | 241 void OnSearchBoxNavigate(int page_id, |
227 const GURL& url, | 242 const GURL& url, |
228 content::PageTransition transition, | 243 content::PageTransition transition, |
229 WindowOpenDisposition disposition); | 244 WindowOpenDisposition disposition); |
230 void OnDeleteMostVisitedItem(InstantRestrictedID most_visited_item_id); | 245 void OnDeleteMostVisitedItem(InstantRestrictedID most_visited_item_id); |
231 void OnUndoMostVisitedDeletion(InstantRestrictedID most_visited_item_id); | 246 void OnUndoMostVisitedDeletion(InstantRestrictedID most_visited_item_id); |
232 void OnUndoAllMostVisitedDeletions(); | 247 void OnUndoAllMostVisitedDeletions(); |
233 | 248 |
234 Delegate* const delegate_; | 249 Delegate* const delegate_; |
235 const std::string instant_url_; | 250 const std::string instant_url_; |
236 bool supports_instant_; | 251 bool supports_instant_; |
237 | 252 |
238 DISALLOW_COPY_AND_ASSIGN(InstantPage); | 253 DISALLOW_COPY_AND_ASSIGN(InstantPage); |
239 }; | 254 }; |
240 | 255 |
241 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_PAGE_H_ | 256 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_PAGE_H_ |
OLD | NEW |