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/gtest_prod_util.h" |
12 #include "base/string16.h" | 13 #include "base/string16.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; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 // page to navigate to privileged destinations (e.g. chrome:// URLs) or to | 82 // page to navigate to privileged destinations (e.g. chrome:// URLs) or to |
82 // navigate to URLs that are hidden from the page using Restricted IDs (rid | 83 // navigate to URLs that are hidden from the page using Restricted IDs (rid |
83 // in the API). | 84 // in the API). |
84 virtual void NavigateToURL(const content::WebContents* contents, | 85 virtual void NavigateToURL(const content::WebContents* contents, |
85 const GURL& url, | 86 const GURL& url, |
86 content::PageTransition transition, | 87 content::PageTransition transition, |
87 WindowOpenDisposition disposition, | 88 WindowOpenDisposition disposition, |
88 bool is_search_type) = 0; | 89 bool is_search_type) = 0; |
89 | 90 |
90 // Called when the SearchBox wants to delete a Most Visited item. | 91 // Called when the SearchBox wants to delete a Most Visited item. |
91 virtual void DeleteMostVisitedItem( | 92 virtual void DeleteMostVisitedItem(const GURL& url) = 0; |
92 InstantRestrictedID most_visited_item_id) = 0; | |
93 | 93 |
94 // Called when the SearchBox wants to undo a Most Visited deletion. | 94 // Called when the SearchBox wants to undo a Most Visited deletion. |
95 virtual void UndoMostVisitedDeletion( | 95 virtual void UndoMostVisitedDeletion(const GURL& url) = 0; |
96 InstantRestrictedID most_visited_item_id) = 0; | |
97 | 96 |
98 // Called when the SearchBox wants to undo all Most Visited deletions. | 97 // Called when the SearchBox wants to undo all Most Visited deletions. |
99 virtual void UndoAllMostVisitedDeletions() = 0; | 98 virtual void UndoAllMostVisitedDeletions() = 0; |
100 | 99 |
101 // Called when the page fails to load for whatever reason. | 100 // Called when the page fails to load for whatever reason. |
102 virtual void InstantPageLoadFailed(content::WebContents* contents) = 0; | 101 virtual void InstantPageLoadFailed(content::WebContents* contents) = 0; |
103 | 102 |
104 protected: | 103 protected: |
105 virtual ~Delegate(); | 104 virtual ~Delegate(); |
106 }; | 105 }; |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 // methods. | 210 // methods. |
212 virtual bool ShouldProcessRenderViewCreated(); | 211 virtual bool ShouldProcessRenderViewCreated(); |
213 virtual bool ShouldProcessRenderViewGone(); | 212 virtual bool ShouldProcessRenderViewGone(); |
214 virtual bool ShouldProcessAboutToNavigateMainFrame(); | 213 virtual bool ShouldProcessAboutToNavigateMainFrame(); |
215 virtual bool ShouldProcessSetSuggestions(); | 214 virtual bool ShouldProcessSetSuggestions(); |
216 virtual bool ShouldProcessShowInstantOverlay(); | 215 virtual bool ShouldProcessShowInstantOverlay(); |
217 virtual bool ShouldProcessFocusOmnibox(); | 216 virtual bool ShouldProcessFocusOmnibox(); |
218 virtual bool ShouldProcessNavigateToURL(); | 217 virtual bool ShouldProcessNavigateToURL(); |
219 | 218 |
220 private: | 219 private: |
| 220 FRIEND_TEST_ALL_PREFIXES(InstantPageTest, |
| 221 DispatchRequestToDeleteMostVisitedItem); |
| 222 FRIEND_TEST_ALL_PREFIXES(InstantPageTest, |
| 223 DispatchRequestToUndoMostVisitedDeletion); |
| 224 FRIEND_TEST_ALL_PREFIXES(InstantPageTest, |
| 225 DispatchRequestToUndoAllMostVisitedDeletions); |
| 226 |
221 // Overridden from content::WebContentsObserver: | 227 // Overridden from content::WebContentsObserver: |
222 virtual void RenderViewCreated( | 228 virtual void RenderViewCreated( |
223 content::RenderViewHost* render_view_host) OVERRIDE; | 229 content::RenderViewHost* render_view_host) OVERRIDE; |
224 virtual void DidFinishLoad( | 230 virtual void DidFinishLoad( |
225 int64 frame_id, | 231 int64 frame_id, |
226 const GURL& validated_url, | 232 const GURL& validated_url, |
227 bool is_main_frame, | 233 bool is_main_frame, |
228 content::RenderViewHost* render_view_host) OVERRIDE; | 234 content::RenderViewHost* render_view_host) OVERRIDE; |
229 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 235 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
230 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; | 236 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; |
(...skipping 19 matching lines...) Expand all Loading... |
250 void OnInstantSupportDetermined(int page_id, bool supports_instant); | 256 void OnInstantSupportDetermined(int page_id, bool supports_instant); |
251 void OnShowInstantOverlay(int page_id, | 257 void OnShowInstantOverlay(int page_id, |
252 int height, | 258 int height, |
253 InstantSizeUnits units); | 259 InstantSizeUnits units); |
254 void OnFocusOmnibox(int page_id, OmniboxFocusState state); | 260 void OnFocusOmnibox(int page_id, OmniboxFocusState state); |
255 void OnSearchBoxNavigate(int page_id, | 261 void OnSearchBoxNavigate(int page_id, |
256 const GURL& url, | 262 const GURL& url, |
257 content::PageTransition transition, | 263 content::PageTransition transition, |
258 WindowOpenDisposition disposition, | 264 WindowOpenDisposition disposition, |
259 bool is_search_type); | 265 bool is_search_type); |
260 void OnDeleteMostVisitedItem(InstantRestrictedID most_visited_item_id); | 266 void OnDeleteMostVisitedItem(const GURL& url); |
261 void OnUndoMostVisitedDeletion(InstantRestrictedID most_visited_item_id); | 267 void OnUndoMostVisitedDeletion(const GURL& url); |
262 void OnUndoAllMostVisitedDeletions(); | 268 void OnUndoAllMostVisitedDeletions(); |
263 | 269 |
264 Delegate* const delegate_; | 270 Delegate* const delegate_; |
265 const std::string instant_url_; | 271 const std::string instant_url_; |
266 bool supports_instant_; | 272 bool supports_instant_; |
267 bool instant_support_determined_; | 273 bool instant_support_determined_; |
268 | 274 |
269 DISALLOW_COPY_AND_ASSIGN(InstantPage); | 275 DISALLOW_COPY_AND_ASSIGN(InstantPage); |
270 }; | 276 }; |
271 | 277 |
272 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_PAGE_H_ | 278 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_PAGE_H_ |
OLD | NEW |