OLD | NEW |
---|---|
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> |
(...skipping 15 matching lines...) Expand all Loading... | |
26 | 26 |
27 class BrowserInstantController; | 27 class BrowserInstantController; |
28 class InstantService; | 28 class InstantService; |
29 class InstantTab; | 29 class InstantTab; |
30 class Profile; | 30 class Profile; |
31 | 31 |
32 namespace content { | 32 namespace content { |
33 class WebContents; | 33 class WebContents; |
34 } | 34 } |
35 | 35 |
36 namespace gfx { | |
37 class Rect; | |
38 } | |
39 | |
36 // Macro used for logging debug events. |message| should be a std::string. | 40 // Macro used for logging debug events. |message| should be a std::string. |
37 #define LOG_INSTANT_DEBUG_EVENT(controller, message) \ | 41 #define LOG_INSTANT_DEBUG_EVENT(controller, message) \ |
38 controller->LogDebugEvent(message) | 42 controller->LogDebugEvent(message) |
39 | 43 |
40 // InstantController drives Chrome Instant, i.e., the browser implementation of | 44 // InstantController drives Chrome Instant, i.e., the browser implementation of |
41 // the Embedded Search API (see http://dev.chromium.org/embeddedsearch). | 45 // the Embedded Search API (see http://dev.chromium.org/embeddedsearch). |
42 // | 46 // |
43 // In extended mode, InstantController maintains and coordinates an InstantTab | 47 // In extended mode, InstantController maintains and coordinates an InstantTab |
44 // instance of InstantPage. An InstantTab instance points to the currently | 48 // instance of InstantPage. An InstantTab instance points to the currently |
45 // active tab, if it supports the Embedded Search API. InstantTab is backed by a | 49 // active tab, if it supports the Embedded Search API. InstantTab is backed by a |
46 // WebContents and it does not own that WebContents. | 50 // WebContents and it does not own that WebContents. |
47 // | 51 // |
48 // InstantController is owned by Browser via BrowserInstantController. | 52 // InstantController is owned by Browser via BrowserInstantController. |
49 class InstantController : public InstantPage::Delegate { | 53 class InstantController : public InstantPage::Delegate { |
50 public: | 54 public: |
51 InstantController(BrowserInstantController* browser, | 55 InstantController(BrowserInstantController* browser, |
52 bool extended_enabled); | 56 bool extended_enabled); |
53 virtual ~InstantController(); | 57 virtual ~InstantController(); |
54 | 58 |
55 // Sets the stored start-edge margin and width of the omnibox. | 59 // Sets the stored start-edge margin and width of the omnibox. |
56 void SetOmniboxBounds(const gfx::Rect& bounds); | 60 void SetOmniboxBounds(const gfx::Rect& bounds); |
57 | 61 |
62 // Gets the stored start-edge margin and width of the omnibox. | |
63 gfx::Rect GetOmniboxBounds(); | |
samarth
2013/08/06 18:09:32
Make this a simple accessor: omnibox_bounds()
jeremycho
2013/08/06 21:03:04
Done.
| |
64 | |
58 // Notifies |instant_Tab_| to toggle voice search. | 65 // Notifies |instant_Tab_| to toggle voice search. |
59 void ToggleVoiceSearch(); | 66 void ToggleVoiceSearch(); |
60 | 67 |
61 // Called if the browser is navigating to a search URL for |search_terms| with | 68 // Called if the browser is navigating to a search URL for |search_terms| with |
62 // search-term-replacement enabled. If |instant_tab_| can be used to process | 69 // search-term-replacement enabled. If |instant_tab_| can be used to process |
63 // the search, this does so and returns true. Else, returns false. | 70 // the search, this does so and returns true. Else, returns false. |
64 bool SubmitQuery(const string16& search_terms); | 71 bool SubmitQuery(const string16& search_terms); |
65 | 72 |
66 // Called to indicate that the omnibox focus state changed with the given | 73 // Called to indicate that the omnibox focus state changed with the given |
67 // |reason|. If |focus_state| is FOCUS_NONE, |view_gaining_focus| is set to | 74 // |reason|. If |focus_state| is FOCUS_NONE, |view_gaining_focus| is set to |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
218 // its suggestions with the omnibox. | 225 // its suggestions with the omnibox. |
219 gfx::Rect omnibox_bounds_; | 226 gfx::Rect omnibox_bounds_; |
220 | 227 |
221 // List of events and their timestamps, useful in debugging Instant behaviour. | 228 // List of events and their timestamps, useful in debugging Instant behaviour. |
222 mutable std::list<std::pair<int64, std::string> > debug_events_; | 229 mutable std::list<std::pair<int64, std::string> > debug_events_; |
223 | 230 |
224 DISALLOW_COPY_AND_ASSIGN(InstantController); | 231 DISALLOW_COPY_AND_ASSIGN(InstantController); |
225 }; | 232 }; |
226 | 233 |
227 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_CONTROLLER_H_ | 234 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_CONTROLLER_H_ |
OLD | NEW |