| 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" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 // Called when the page wants to navigate to |url|. Usually used by the | 65 // Called when the page wants to navigate to |url|. Usually used by the |
| 66 // page to navigate to privileged destinations (e.g. chrome:// URLs) or to | 66 // page to navigate to privileged destinations (e.g. chrome:// URLs) or to |
| 67 // navigate to URLs that are hidden from the page using Restricted IDs (rid | 67 // navigate to URLs that are hidden from the page using Restricted IDs (rid |
| 68 // in the API). | 68 // in the API). |
| 69 virtual void NavigateToURL(const content::WebContents* contents, | 69 virtual void NavigateToURL(const content::WebContents* contents, |
| 70 const GURL& url, | 70 const GURL& url, |
| 71 content::PageTransition transition, | 71 content::PageTransition transition, |
| 72 WindowOpenDisposition disposition, | 72 WindowOpenDisposition disposition, |
| 73 bool is_search_type) = 0; | 73 bool is_search_type) = 0; |
| 74 | 74 |
| 75 // Called when the page wants to paste into the omnibox. |
| 76 virtual void PasteIntoOmnibox(const content::WebContents* contents) = 0; |
| 77 |
| 75 // Called when the SearchBox wants to delete a Most Visited item. | 78 // Called when the SearchBox wants to delete a Most Visited item. |
| 76 virtual void DeleteMostVisitedItem(const GURL& url) = 0; | 79 virtual void DeleteMostVisitedItem(const GURL& url) = 0; |
| 77 | 80 |
| 78 // Called when the SearchBox wants to undo a Most Visited deletion. | 81 // Called when the SearchBox wants to undo a Most Visited deletion. |
| 79 virtual void UndoMostVisitedDeletion(const GURL& url) = 0; | 82 virtual void UndoMostVisitedDeletion(const GURL& url) = 0; |
| 80 | 83 |
| 81 // Called when the SearchBox wants to undo all Most Visited deletions. | 84 // Called when the SearchBox wants to undo all Most Visited deletions. |
| 82 virtual void UndoAllMostVisitedDeletions() = 0; | 85 virtual void UndoAllMostVisitedDeletions() = 0; |
| 83 | 86 |
| 84 // Called when the page fails to load for whatever reason. | 87 // Called when the page fails to load for whatever reason. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 | 129 |
| 127 Profile* profile() const { return profile_; } | 130 Profile* profile() const { return profile_; } |
| 128 | 131 |
| 129 // These functions are called before processing messages received from the | 132 // These functions are called before processing messages received from the |
| 130 // page. By default, all messages are handled, but any derived classes may | 133 // page. By default, all messages are handled, but any derived classes may |
| 131 // choose to ignore some or all of the received messages by overriding these | 134 // choose to ignore some or all of the received messages by overriding these |
| 132 // methods. | 135 // methods. |
| 133 virtual bool ShouldProcessAboutToNavigateMainFrame(); | 136 virtual bool ShouldProcessAboutToNavigateMainFrame(); |
| 134 virtual bool ShouldProcessFocusOmnibox(); | 137 virtual bool ShouldProcessFocusOmnibox(); |
| 135 virtual bool ShouldProcessNavigateToURL(); | 138 virtual bool ShouldProcessNavigateToURL(); |
| 139 virtual bool ShouldProcessPasteIntoOmnibox(); |
| 136 virtual bool ShouldProcessDeleteMostVisitedItem(); | 140 virtual bool ShouldProcessDeleteMostVisitedItem(); |
| 137 virtual bool ShouldProcessUndoMostVisitedDeletion(); | 141 virtual bool ShouldProcessUndoMostVisitedDeletion(); |
| 138 virtual bool ShouldProcessUndoAllMostVisitedDeletions(); | 142 virtual bool ShouldProcessUndoAllMostVisitedDeletions(); |
| 139 | 143 |
| 140 private: | 144 private: |
| 141 FRIEND_TEST_ALL_PREFIXES(InstantPageTest, | 145 FRIEND_TEST_ALL_PREFIXES(InstantPageTest, |
| 142 DispatchRequestToDeleteMostVisitedItem); | 146 DispatchRequestToDeleteMostVisitedItem); |
| 143 FRIEND_TEST_ALL_PREFIXES(InstantPageTest, | 147 FRIEND_TEST_ALL_PREFIXES(InstantPageTest, |
| 144 DispatchRequestToUndoMostVisitedDeletion); | 148 DispatchRequestToUndoMostVisitedDeletion); |
| 145 FRIEND_TEST_ALL_PREFIXES(InstantPageTest, | 149 FRIEND_TEST_ALL_PREFIXES(InstantPageTest, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 | 185 |
| 182 // Update the status of Instant support. | 186 // Update the status of Instant support. |
| 183 void InstantSupportDetermined(bool supports_instant); | 187 void InstantSupportDetermined(bool supports_instant); |
| 184 | 188 |
| 185 void OnFocusOmnibox(int page_id, OmniboxFocusState state); | 189 void OnFocusOmnibox(int page_id, OmniboxFocusState state); |
| 186 void OnSearchBoxNavigate(int page_id, | 190 void OnSearchBoxNavigate(int page_id, |
| 187 const GURL& url, | 191 const GURL& url, |
| 188 content::PageTransition transition, | 192 content::PageTransition transition, |
| 189 WindowOpenDisposition disposition, | 193 WindowOpenDisposition disposition, |
| 190 bool is_search_type); | 194 bool is_search_type); |
| 195 void OnSearchBoxPaste(int page_id); |
| 191 void OnCountMouseover(int page_id); | 196 void OnCountMouseover(int page_id); |
| 192 void OnDeleteMostVisitedItem(int page_id, const GURL& url); | 197 void OnDeleteMostVisitedItem(int page_id, const GURL& url); |
| 193 void OnUndoMostVisitedDeletion(int page_id, const GURL& url); | 198 void OnUndoMostVisitedDeletion(int page_id, const GURL& url); |
| 194 void OnUndoAllMostVisitedDeletions(int page_id); | 199 void OnUndoAllMostVisitedDeletions(int page_id); |
| 195 | 200 |
| 196 void ClearContents(); | 201 void ClearContents(); |
| 197 | 202 |
| 198 // Removes recommended URLs if a matching URL is already open in the Browser, | 203 // Removes recommended URLs if a matching URL is already open in the Browser, |
| 199 // if the Most Visited Tile Placement experiment is enabled, and the client is | 204 // if the Most Visited Tile Placement experiment is enabled, and the client is |
| 200 // in the experiment group. | 205 // in the experiment group. |
| 201 void MaybeRemoveMostVisitedItems(std::vector<InstantMostVisitedItem>* items); | 206 void MaybeRemoveMostVisitedItems(std::vector<InstantMostVisitedItem>* items); |
| 202 | 207 |
| 203 // Returns the InstantService for the |profile_|. | 208 // Returns the InstantService for the |profile_|. |
| 204 InstantService* GetInstantService(); | 209 InstantService* GetInstantService(); |
| 205 | 210 |
| 206 Profile* profile_; | 211 Profile* profile_; |
| 207 Delegate* const delegate_; | 212 Delegate* const delegate_; |
| 208 scoped_ptr<InstantIPCSender> ipc_sender_; | 213 scoped_ptr<InstantIPCSender> ipc_sender_; |
| 209 const std::string instant_url_; | 214 const std::string instant_url_; |
| 210 const bool is_incognito_; | 215 const bool is_incognito_; |
| 211 | 216 |
| 212 DISALLOW_COPY_AND_ASSIGN(InstantPage); | 217 DISALLOW_COPY_AND_ASSIGN(InstantPage); |
| 213 }; | 218 }; |
| 214 | 219 |
| 215 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_PAGE_H_ | 220 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_PAGE_H_ |
| OLD | NEW |