| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_INSTANT_INSTANT_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_ | 6 #define CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 // Returns the transition type of the last AutocompleteMatch passed to Update. | 149 // Returns the transition type of the last AutocompleteMatch passed to Update. |
| 150 content::PageTransition last_transition_type() const { | 150 content::PageTransition last_transition_type() const { |
| 151 return last_transition_type_; | 151 return last_transition_type_; |
| 152 } | 152 } |
| 153 | 153 |
| 154 // InstantLoaderDelegate: | 154 // InstantLoaderDelegate: |
| 155 virtual void SetSuggestions( | 155 virtual void SetSuggestions( |
| 156 InstantLoader* loader, | 156 InstantLoader* loader, |
| 157 const std::vector<InstantSuggestion>& suggestions) OVERRIDE; | 157 const std::vector<InstantSuggestion>& suggestions) OVERRIDE; |
| 158 virtual void CommitInstantLoader(InstantLoader* loader) OVERRIDE; | 158 virtual void CommitInstantLoader(InstantLoader* loader) OVERRIDE; |
| 159 virtual void SetInstantPreviewHeight(InstantLoader* loader, |
| 160 int height, |
| 161 InstantSizeUnits units) OVERRIDE; |
| 159 virtual void InstantLoaderPreviewLoaded(InstantLoader* loader) OVERRIDE; | 162 virtual void InstantLoaderPreviewLoaded(InstantLoader* loader) OVERRIDE; |
| 160 virtual void InstantSupportDetermined(InstantLoader* loader, | 163 virtual void InstantSupportDetermined(InstantLoader* loader, |
| 161 bool supports_instant) OVERRIDE; | 164 bool supports_instant) OVERRIDE; |
| 162 virtual void SwappedTabContents(InstantLoader* loader) OVERRIDE; | 165 virtual void SwappedTabContents(InstantLoader* loader) OVERRIDE; |
| 163 virtual void InstantLoaderContentsFocused(InstantLoader* loader) OVERRIDE; | 166 virtual void InstantLoaderContentsFocused(InstantLoader* loader) OVERRIDE; |
| 164 | 167 |
| 165 #if defined(UNIT_TEST) | 168 #if defined(UNIT_TEST) |
| 166 // Accessors used only in tests. | 169 // Accessors used only in tests. |
| 167 bool is_showing() const { return is_showing_; } | 170 bool is_showing() const { return is_showing_; } |
| 168 InstantLoader* loader() const { return loader_.get(); } | 171 InstantLoader* loader() const { return loader_.get(); } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 186 // If the |loader_| is not showing, it is deleted and recreated. Else the | 189 // If the |loader_| is not showing, it is deleted and recreated. Else the |
| 187 // refresh is skipped and the next refresh is scheduled. | 190 // refresh is skipped and the next refresh is scheduled. |
| 188 void OnStaleLoader(); | 191 void OnStaleLoader(); |
| 189 | 192 |
| 190 // Calls OnStaleLoader if |stale_loader_timer_| is not running. | 193 // Calls OnStaleLoader if |stale_loader_timer_| is not running. |
| 191 void MaybeOnStaleLoader(); | 194 void MaybeOnStaleLoader(); |
| 192 | 195 |
| 193 // Destroys the |loader_| and its preview contents. | 196 // Destroys the |loader_| and its preview contents. |
| 194 void DeleteLoader(); | 197 void DeleteLoader(); |
| 195 | 198 |
| 196 // Counterpart to Hide(). Asks the |delegate_| to display the preview. | 199 // Counterpart to Hide(). Asks the |delegate_| to display the preview with |
| 197 void Show(); | 200 // the given |height|. |
| 201 void Show(int height, InstantSizeUnits units); |
| 198 | 202 |
| 199 // Send the omnibox dropdown bounds to the page. | 203 // Send the omnibox dropdown bounds to the page. |
| 200 void SendBoundsToPage(); | 204 void SendBoundsToPage(); |
| 201 | 205 |
| 202 // If |template_url| is a valid TemplateURL for use with Instant, fills in | 206 // If |template_url| is a valid TemplateURL for use with Instant, fills in |
| 203 // |instant_url| and returns true; returns false otherwise. | 207 // |instant_url| and returns true; returns false otherwise. |
| 204 // Note: If the command-line switch kInstantURL is set, this method uses its | 208 // Note: If the command-line switch kInstantURL is set, this method uses its |
| 205 // value for |instant_url| and returns true without examining |template_url|. | 209 // value for |instant_url| and returns true without examining |template_url|. |
| 206 bool GetInstantURL(const TemplateURL* template_url, | 210 bool GetInstantURL(const TemplateURL* template_url, |
| 207 std::string* instant_url) const; | 211 std::string* instant_url) const; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 // Search terms extraction (for autocomplete history matches) doesn't work | 276 // Search terms extraction (for autocomplete history matches) doesn't work |
| 273 // on Instant URLs. So, whenever the user commits an Instant search, we add | 277 // on Instant URLs. So, whenever the user commits an Instant search, we add |
| 274 // an equivalent non-Instant search URL to history, so that the search shows | 278 // an equivalent non-Instant search URL to history, so that the search shows |
| 275 // up in autocomplete history matches. | 279 // up in autocomplete history matches. |
| 276 GURL url_for_history_; | 280 GURL url_for_history_; |
| 277 | 281 |
| 278 DISALLOW_COPY_AND_ASSIGN(InstantController); | 282 DISALLOW_COPY_AND_ASSIGN(InstantController); |
| 279 }; | 283 }; |
| 280 | 284 |
| 281 #endif // CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_ | 285 #endif // CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_ |
| OLD | NEW |