Chromium Code Reviews| 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_INSTANT_INSTANT_TAB_H_ | 5 #ifndef CHROME_BROWSER_INSTANT_INSTANT_TAB_H_ |
| 6 #define CHROME_BROWSER_INSTANT_INSTANT_TAB_H_ | 6 #define CHROME_BROWSER_INSTANT_INSTANT_TAB_H_ |
| 7 | 7 |
| 8 #include <vector> | |
| 9 | |
| 10 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 11 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 12 #include "base/string16.h" | 10 #include "chrome/browser/instant/instant_page.h" |
| 13 #include "chrome/browser/instant/instant_client.h" | |
| 14 | 11 |
| 15 struct InstantAutocompleteResult; | 12 // InstantTab represents a committed page (i.e. an actual tab on the tab strip) |
| 16 class InstantController; | 13 // that supports the Instant API. |
| 17 | 14 class InstantTab : public InstantPage { |
| 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: | 15 public: |
| 27 // Doesn't take ownership of either |controller| or |contents|. | 16 // Doesn't take ownership of either |delegate|. |
| 28 InstantTab(InstantController* controller, content::WebContents* contents); | 17 explicit InstantTab(InstantPage::Delegate* delegate); |
| 29 virtual ~InstantTab(); | 18 virtual ~InstantTab(); |
| 30 | 19 |
| 31 content::WebContents* contents() const { return contents_; } | 20 // Start observing |contents| for messages. Sends a message to determine if |
| 32 | |
| 33 // Start observing |contents_| for messages. Sends a message to determine if | |
| 34 // the page supports the Instant API. | 21 // the page supports the Instant API. |
| 35 void Init(); | 22 void Init(content::WebContents* contents); |
| 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 SetDisplayInstantResults(bool display_instant_results); | |
| 46 void UpOrDownKeyPressed(int count); | |
| 47 void SetMarginSize(int start, int end); | |
| 48 | 23 |
| 49 private: | 24 private: |
| 50 // Overridden from InstantClient::Delegate: | 25 // Overridden from InstantPage. |
|
dhollowa
2013/01/29 02:37:53
nit: ":"
samarth
2013/01/29 05:42:01
Done.
| |
| 51 virtual void SetSuggestions( | 26 virtual bool ShouldProcessRenderViewGone() const OVERRIDE; |
| 52 const std::vector<InstantSuggestion>& suggestions) OVERRIDE; | 27 virtual bool ShouldProcessAboutToNavigateMainFrame() const OVERRIDE; |
| 53 virtual void InstantSupportDetermined(bool supports_instant) OVERRIDE; | 28 virtual bool ShouldProcessShowInstantPreview() const OVERRIDE; |
| 54 virtual void ShowInstantPreview(InstantShownReason reason, | |
| 55 int height, | |
| 56 InstantSizeUnits units) OVERRIDE; | |
| 57 virtual void StartCapturingKeyStrokes() OVERRIDE; | |
| 58 virtual void StopCapturingKeyStrokes() OVERRIDE; | |
| 59 virtual void RenderViewGone() OVERRIDE; | |
| 60 virtual void AboutToNavigateMainFrame(const GURL& url) OVERRIDE; | |
| 61 virtual void NavigateToURL(const GURL& url, | |
| 62 content::PageTransition transition) OVERRIDE; | |
| 63 | |
| 64 InstantClient client_; | |
| 65 InstantController* const controller_; | |
| 66 content::WebContents* const contents_; | |
| 67 bool supports_instant_; | |
| 68 | 29 |
| 69 DISALLOW_COPY_AND_ASSIGN(InstantTab); | 30 DISALLOW_COPY_AND_ASSIGN(InstantTab); |
| 70 }; | 31 }; |
| 71 | 32 |
| 72 #endif // CHROME_BROWSER_INSTANT_INSTANT_TAB_H_ | 33 #endif // CHROME_BROWSER_INSTANT_INSTANT_TAB_H_ |
| OLD | NEW |