Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(384)

Side by Side Diff: chrome/browser/ui/search/search_tab_helper.h

Issue 222923007: Implement SearchTabHelperDelegate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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_SEARCH_TAB_HELPER_H_ 5 #ifndef CHROME_BROWSER_UI_SEARCH_SEARCH_TAB_HELPER_H_
6 #define CHROME_BROWSER_UI_SEARCH_SEARCH_TAB_HELPER_H_ 6 #define CHROME_BROWSER_UI_SEARCH_SEARCH_TAB_HELPER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 12 matching lines...) Expand all
23 namespace content { 23 namespace content {
24 class WebContents; 24 class WebContents;
25 struct LoadCommittedDetails; 25 struct LoadCommittedDetails;
26 } 26 }
27 27
28 class GURL; 28 class GURL;
29 class InstantPageTest; 29 class InstantPageTest;
30 class InstantService; 30 class InstantService;
31 class Profile; 31 class Profile;
32 class SearchIPCRouterTest; 32 class SearchIPCRouterTest;
33 class SearchTabHelperDelegate;
33 34
34 // Per-tab search "helper". Acts as the owner and controller of the tab's 35 // Per-tab search "helper". Acts as the owner and controller of the tab's
35 // search UI model. 36 // search UI model.
36 // 37 //
37 // When the page is finished loading, SearchTabHelper determines the instant 38 // When the page is finished loading, SearchTabHelper determines the instant
38 // support for the page. When a navigation entry is committed (except for 39 // support for the page. When a navigation entry is committed (except for
39 // in-page navigations), SearchTabHelper resets the instant support state to 40 // in-page navigations), SearchTabHelper resets the instant support state to
40 // INSTANT_SUPPORT_UNKNOWN and cause support to be determined again. 41 // INSTANT_SUPPORT_UNKNOWN and cause support to be determined again.
41 class SearchTabHelper : public content::WebContentsObserver, 42 class SearchTabHelper : public content::WebContentsObserver,
42 public content::WebContentsUserData<SearchTabHelper>, 43 public content::WebContentsUserData<SearchTabHelper>,
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 86
86 // Called when the tab corresponding to |this| instance is deactivated. 87 // Called when the tab corresponding to |this| instance is deactivated.
87 void OnTabDeactivated(); 88 void OnTabDeactivated();
88 89
89 // Tells the page to toggle voice search. 90 // Tells the page to toggle voice search.
90 void ToggleVoiceSearch(); 91 void ToggleVoiceSearch();
91 92
92 // Returns true if the underlying page is a search results page. 93 // Returns true if the underlying page is a search results page.
93 bool IsSearchResultsPage(); 94 bool IsSearchResultsPage();
94 95
96 void set_delegate(SearchTabHelperDelegate* delegate) { delegate_ = delegate; }
97
95 private: 98 private:
96 friend class content::WebContentsUserData<SearchTabHelper>; 99 friend class content::WebContentsUserData<SearchTabHelper>;
97 friend class InstantPageTest; 100 friend class InstantPageTest;
98 friend class SearchIPCRouterPolicyTest; 101 friend class SearchIPCRouterPolicyTest;
99 friend class SearchIPCRouterTest; 102 friend class SearchIPCRouterTest;
100 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest, 103 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest,
101 DetermineIfPageSupportsInstant_Local); 104 DetermineIfPageSupportsInstant_Local);
102 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest, 105 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest,
103 DetermineIfPageSupportsInstant_NonLocal); 106 DetermineIfPageSupportsInstant_NonLocal);
104 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest, 107 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest,
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 int position, const base::string16& provider) OVERRIDE; 177 int position, const base::string16& provider) OVERRIDE;
175 virtual void PasteIntoOmnibox(const base::string16& text) OVERRIDE; 178 virtual void PasteIntoOmnibox(const base::string16& text) OVERRIDE;
176 virtual void OnChromeIdentityCheck(const base::string16& identity) OVERRIDE; 179 virtual void OnChromeIdentityCheck(const base::string16& identity) OVERRIDE;
177 180
178 // Overridden from InstantServiceObserver: 181 // Overridden from InstantServiceObserver:
179 virtual void ThemeInfoChanged(const ThemeBackgroundInfo& theme_info) OVERRIDE; 182 virtual void ThemeInfoChanged(const ThemeBackgroundInfo& theme_info) OVERRIDE;
180 virtual void MostVisitedItemsChanged( 183 virtual void MostVisitedItemsChanged(
181 const std::vector<InstantMostVisitedItem>& items) OVERRIDE; 184 const std::vector<InstantMostVisitedItem>& items) OVERRIDE;
182 virtual void OmniboxStartMarginChanged(int omnibox_start_margin) OVERRIDE; 185 virtual void OmniboxStartMarginChanged(int omnibox_start_margin) OVERRIDE;
183 186
184 // Removes recommended URLs if a matching URL is already open in the Browser,
185 // if the Most Visited Tile Placement experiment is enabled, and the client is
186 // in the experiment group.
187 void MaybeRemoveMostVisitedItems(std::vector<InstantMostVisitedItem>* items);
188
189 // Sets the mode of the model based on the current URL of web_contents(). 187 // Sets the mode of the model based on the current URL of web_contents().
190 // Only updates the origin part of the mode if |update_origin| is true, 188 // Only updates the origin part of the mode if |update_origin| is true,
191 // otherwise keeps the current origin. If |is_preloaded_ntp| is true, the mode 189 // otherwise keeps the current origin. If |is_preloaded_ntp| is true, the mode
192 // is set to NTP regardless of the current URL; this is used to ensure that 190 // is set to NTP regardless of the current URL; this is used to ensure that
193 // InstantController can bind InstantTab to new tab pages immediately. 191 // InstantController can bind InstantTab to new tab pages immediately.
194 void UpdateMode(bool update_origin, bool is_preloaded_ntp); 192 void UpdateMode(bool update_origin, bool is_preloaded_ntp);
195 193
196 // Tells the renderer to determine if the page supports the Instant API, which 194 // Tells the renderer to determine if the page supports the Instant API, which
197 // results in a call to OnInstantSupportDetermined() when the reply is 195 // results in a call to OnInstantSupportDetermined() when the reply is
198 // received. 196 // received.
(...skipping 16 matching lines...) Expand all
215 213
216 // Model object for UI that cares about search state. 214 // Model object for UI that cares about search state.
217 SearchModel model_; 215 SearchModel model_;
218 216
219 content::WebContents* web_contents_; 217 content::WebContents* web_contents_;
220 218
221 SearchIPCRouter ipc_router_; 219 SearchIPCRouter ipc_router_;
222 220
223 InstantService* instant_service_; 221 InstantService* instant_service_;
224 222
223 // Delegate for notifying our owner about the SearchTabHelper state. Not owned
224 // by us.
225 // NULL on iOS and Android because they don't use the Instant framework.
226 SearchTabHelperDelegate* delegate_;
227
225 DISALLOW_COPY_AND_ASSIGN(SearchTabHelper); 228 DISALLOW_COPY_AND_ASSIGN(SearchTabHelper);
226 }; 229 };
227 230
228 #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_TAB_HELPER_H_ 231 #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_TAB_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698