OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_INSTANT_INSTANT_TAB_H_ |
| 6 #define CHROME_BROWSER_INSTANT_INSTANT_TAB_H_ |
| 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "base/compiler_specific.h" |
| 12 #include "base/string16.h" |
| 13 #include "chrome/browser/instant/instant_client.h" |
| 14 |
| 15 struct InstantAutocompleteResult; |
| 16 class InstantController; |
| 17 |
| 18 namespace content { |
| 19 class WebContents; |
| 20 } |
| 21 |
| 22 // InstantTab is used to communicate with a committed search results page, i.e., |
| 23 // an actual tab on the tab strip (compare: InstantLoader, which has a preview |
| 24 // page that appears and disappears as the user types in the omnibox). |
| 25 class InstantTab : public InstantClient::Delegate { |
| 26 public: |
| 27 // Doesn't take ownership of either |controller| or |contents|. |
| 28 InstantTab(InstantController* controller, content::WebContents* contents); |
| 29 virtual ~InstantTab(); |
| 30 |
| 31 content::WebContents* contents() const { return contents_; } |
| 32 |
| 33 // Start observing |contents_| for messages. Sends a message to determine if |
| 34 // the page supports the Instant API. |
| 35 void Init(); |
| 36 |
| 37 // Calls through to methods of the same name on InstantClient. |
| 38 void Update(const string16& text, |
| 39 size_t selection_start, |
| 40 size_t selection_end, |
| 41 bool verbatim); |
| 42 void Submit(const string16& text); |
| 43 void SendAutocompleteResults( |
| 44 const std::vector<InstantAutocompleteResult>& results); |
| 45 void UpOrDownKeyPressed(int count); |
| 46 |
| 47 private: |
| 48 // Overridden from InstantClient::Delegate: |
| 49 virtual void SetSuggestions( |
| 50 const std::vector<InstantSuggestion>& suggestions) OVERRIDE; |
| 51 virtual void InstantSupportDetermined(bool supports_instant) OVERRIDE; |
| 52 virtual void ShowInstantPreview(InstantShownReason reason, |
| 53 int height, |
| 54 InstantSizeUnits units) OVERRIDE; |
| 55 |
| 56 InstantClient client_; |
| 57 InstantController* const controller_; |
| 58 content::WebContents* const contents_; |
| 59 bool supports_instant_; |
| 60 |
| 61 DISALLOW_COPY_AND_ASSIGN(InstantTab); |
| 62 }; |
| 63 |
| 64 #endif // CHROME_BROWSER_INSTANT_INSTANT_TAB_H_ |
OLD | NEW |