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