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

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

Issue 609493002: Propagate the search request params from the browser to the Instant search base page to fix the embe (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 1 month 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_INSTANT_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_UI_SEARCH_INSTANT_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_SEARCH_INSTANT_CONTROLLER_H_ 6 #define CHROME_BROWSER_UI_SEARCH_INSTANT_CONTROLLER_H_
7 7
8 #include <list> 8 #include <list>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "base/gtest_prod_util.h" 14 #include "base/gtest_prod_util.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/strings/string16.h" 16 #include "base/strings/string16.h"
17 #include "chrome/browser/ui/search/instant_page.h" 17 #include "chrome/browser/ui/search/instant_page.h"
18 #include "chrome/common/search_types.h" 18 #include "chrome/common/search_types.h"
19 #include "ui/gfx/native_widget_types.h" 19 #include "ui/gfx/native_widget_types.h"
20 20
21 class BrowserInstantController; 21 class BrowserInstantController;
22 class GURL; 22 class GURL;
23 class InstantService; 23 class InstantService;
24 class InstantTab; 24 class InstantTab;
25 class Profile; 25 class Profile;
26 struct EmbeddedSearchRequestParams;
26 27
27 namespace content { 28 namespace content {
28 class WebContents; 29 class WebContents;
29 } 30 }
30 31
31 // Macro used for logging debug events. |message| should be a std::string. 32 // Macro used for logging debug events. |message| should be a std::string.
32 #define LOG_INSTANT_DEBUG_EVENT(controller, message) \ 33 #define LOG_INSTANT_DEBUG_EVENT(controller, message) \
33 controller->LogDebugEvent(message) 34 controller->LogDebugEvent(message)
34 35
35 // InstantController drives Chrome Instant, i.e., the browser implementation of 36 // InstantController drives Chrome Instant, i.e., the browser implementation of
36 // the Embedded Search API (see http://dev.chromium.org/embeddedsearch). 37 // the Embedded Search API (see http://dev.chromium.org/embeddedsearch).
37 // 38 //
38 // In extended mode, InstantController maintains and coordinates an InstantTab 39 // In extended mode, InstantController maintains and coordinates an InstantTab
39 // instance of InstantPage. An InstantTab instance points to the currently 40 // instance of InstantPage. An InstantTab instance points to the currently
40 // active tab, if it supports the Embedded Search API. InstantTab is backed by a 41 // active tab, if it supports the Embedded Search API. InstantTab is backed by a
41 // WebContents and it does not own that WebContents. 42 // WebContents and it does not own that WebContents.
42 // 43 //
43 // InstantController is owned by Browser via BrowserInstantController. 44 // InstantController is owned by Browser via BrowserInstantController.
44 class InstantController : public InstantPage::Delegate { 45 class InstantController : public InstantPage::Delegate {
45 public: 46 public:
46 explicit InstantController(BrowserInstantController* browser); 47 explicit InstantController(BrowserInstantController* browser);
47 ~InstantController() override; 48 ~InstantController() override;
48 49
49 // Called if the browser is navigating to a search URL for |search_terms| with 50 // Called if the browser is navigating to a search URL for |search_terms| with
50 // search-term-replacement enabled. If |instant_tab_| can be used to process 51 // search-term-replacement enabled. If |instant_tab_| can be used to process
51 // the search, this does so and returns true. Else, returns false. 52 // the search, this does so and returns true. Else, returns false.
52 bool SubmitQuery(const base::string16& search_terms); 53 bool SubmitQuery(const base::string16& search_terms,
54 const EmbeddedSearchRequestParams& params);
53 55
54 // The search mode in the active tab has changed. Bind |instant_tab_| if the 56 // The search mode in the active tab has changed. Bind |instant_tab_| if the
55 // |new_mode| reflects an Instant search results page. 57 // |new_mode| reflects an Instant search results page.
56 void SearchModeChanged(const SearchMode& old_mode, 58 void SearchModeChanged(const SearchMode& old_mode,
57 const SearchMode& new_mode); 59 const SearchMode& new_mode);
58 60
59 // The user switched tabs. Bind |instant_tab_| if the newly active tab is an 61 // The user switched tabs. Bind |instant_tab_| if the newly active tab is an
60 // Instant search results page. 62 // Instant search results page.
61 void ActiveTabChanged(); 63 void ActiveTabChanged();
62 64
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 // The search model mode for the active tab. 146 // The search model mode for the active tab.
145 SearchMode search_mode_; 147 SearchMode search_mode_;
146 148
147 // List of events and their timestamps, useful in debugging Instant behaviour. 149 // List of events and their timestamps, useful in debugging Instant behaviour.
148 mutable std::list<std::pair<int64, std::string> > debug_events_; 150 mutable std::list<std::pair<int64, std::string> > debug_events_;
149 151
150 DISALLOW_COPY_AND_ASSIGN(InstantController); 152 DISALLOW_COPY_AND_ASSIGN(InstantController);
151 }; 153 };
152 154
153 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_CONTROLLER_H_ 155 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_CONTROLLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser_instant_controller.cc ('k') | chrome/browser/ui/search/instant_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698