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

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

Issue 2739943005: Cleanup: Remove SearchTabHelperDelegate (Closed)
Patch Set: Created 3 years, 9 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
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/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
(...skipping 15 matching lines...) Expand all
26 class WebContents; 26 class WebContents;
27 struct LoadCommittedDetails; 27 struct LoadCommittedDetails;
28 } 28 }
29 29
30 class GURL; 30 class GURL;
31 class InstantService; 31 class InstantService;
32 class InstantTabTest; 32 class InstantTabTest;
33 class OmniboxView; 33 class OmniboxView;
34 class Profile; 34 class Profile;
35 class SearchIPCRouterTest; 35 class SearchIPCRouterTest;
36 class SearchTabHelperDelegate;
37 36
38 // Per-tab search "helper". Acts as the owner and controller of the tab's 37 // Per-tab search "helper". Acts as the owner and controller of the tab's
39 // search UI model. 38 // search UI model.
40 // 39 //
41 // When the page is finished loading, SearchTabHelper determines the instant 40 // When the page is finished loading, SearchTabHelper determines the instant
42 // support for the page. When a navigation entry is committed (except for 41 // support for the page. When a navigation entry is committed (except for
43 // in-page navigations), SearchTabHelper resets the instant support state to 42 // in-page navigations), SearchTabHelper resets the instant support state to
44 // INSTANT_SUPPORT_UNKNOWN and cause support to be determined again. 43 // INSTANT_SUPPORT_UNKNOWN and cause support to be determined again.
45 class SearchTabHelper : public content::WebContentsObserver, 44 class SearchTabHelper : public content::WebContentsObserver,
46 public content::WebContentsUserData<SearchTabHelper>, 45 public content::WebContentsUserData<SearchTabHelper>,
(...skipping 27 matching lines...) Expand all
74 // Tells the page that the user pressed Enter in the omnibox. 73 // Tells the page that the user pressed Enter in the omnibox.
75 void Submit(const base::string16& text, 74 void Submit(const base::string16& text,
76 const EmbeddedSearchRequestParams& params); 75 const EmbeddedSearchRequestParams& params);
77 76
78 // Called when the tab corresponding to |this| instance is activated. 77 // Called when the tab corresponding to |this| instance is activated.
79 void OnTabActivated(); 78 void OnTabActivated();
80 79
81 // Called when the tab corresponding to |this| instance is deactivated. 80 // Called when the tab corresponding to |this| instance is deactivated.
82 void OnTabDeactivated(); 81 void OnTabDeactivated();
83 82
84 void set_delegate(SearchTabHelperDelegate* delegate) { delegate_ = delegate; } 83 // Called when the tab corresponding to |this| instance is attached to a
84 // browser window.
85 void SetOmniboxView(OmniboxView* omnibox_view);
Peter Kasting 2017/03/10 10:19:57 Nit: The comment suggests that this would be named
Marc Treib 2017/03/10 11:30:03 Indeed, that seems much more consistent with the o
85 86
86 SearchIPCRouter& ipc_router_for_testing() { return ipc_router_; } 87 SearchIPCRouter& ipc_router_for_testing() { return ipc_router_; }
87 88
88 private: 89 private:
89 friend class content::WebContentsUserData<SearchTabHelper>; 90 friend class content::WebContentsUserData<SearchTabHelper>;
90 friend class SearchIPCRouterPolicyTest; 91 friend class SearchIPCRouterPolicyTest;
91 friend class SearchIPCRouterTest; 92 friend class SearchIPCRouterTest;
92 93
93 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest, 94 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest,
94 DetermineIfPageSupportsInstant_Local); 95 DetermineIfPageSupportsInstant_Local);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 // results in a call to OnInstantSupportDetermined() when the reply is 170 // results in a call to OnInstantSupportDetermined() when the reply is
170 // received. 171 // received.
171 void DetermineIfPageSupportsInstant(); 172 void DetermineIfPageSupportsInstant();
172 173
173 Profile* profile() const; 174 Profile* profile() const;
174 175
175 // Returns whether input is in progress, i.e. if the omnibox has focus and the 176 // Returns whether input is in progress, i.e. if the omnibox has focus and the
176 // active tab is in mode SEARCH_SUGGESTIONS. 177 // active tab is in mode SEARCH_SUGGESTIONS.
177 bool IsInputInProgress() const; 178 bool IsInputInProgress() const;
178 179
179 // Returns the OmniboxView for |web_contents_| or NULL if not available.
180 OmniboxView* GetOmniboxView() const;
181
182 const bool is_search_enabled_; 180 const bool is_search_enabled_;
183 181
184 // Model object for UI that cares about search state. 182 // Model object for UI that cares about search state.
185 SearchModel model_; 183 SearchModel model_;
186 184
187 content::WebContents* web_contents_; 185 content::WebContents* web_contents_;
188 186
189 SearchIPCRouter ipc_router_; 187 SearchIPCRouter ipc_router_;
190 188
191 InstantService* instant_service_; 189 InstantService* instant_service_;
192 190
193 // Delegate for notifying our owner about the SearchTabHelper state. Not owned 191 OmniboxView* omnibox_view_;
194 // by us.
195 // NULL on iOS and Android because they don't use the Instant framework.
196 SearchTabHelperDelegate* delegate_;
197 192
198 DISALLOW_COPY_AND_ASSIGN(SearchTabHelper); 193 DISALLOW_COPY_AND_ASSIGN(SearchTabHelper);
199 }; 194 };
200 195
201 #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_TAB_HELPER_H_ 196 #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_TAB_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698