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

Side by Side Diff: chrome/browser/instant/instant_tab.h

Issue 11824050: InstantExtended: Committed NTP (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update Created 7 years, 11 months 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_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> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/string16.h" 12 #include "base/string16.h"
13 #include "chrome/browser/instant/instant_client.h" 13 #include "chrome/browser/instant/instant_page.h"
14 14
15 struct InstantAutocompleteResult; 15 struct InstantAutocompleteResult;
16 class InstantController; 16 class InstantController;
17 17
18 namespace content { 18 namespace content {
19 class WebContents; 19 class WebContents;
20 } 20 }
21 21
22 // InstantTab is used to communicate with a committed search results page, i.e., 22 // InstantTab represents a committed page (i.e. an actual tab on the tab strip)
23 // an actual tab on the tab strip (compare: InstantLoader, which has a preview 23 // that supports the Instant API.
24 // page that appears and disappears as the user types in the omnibox). 24 class InstantTab : public InstantPage {
25 class InstantTab : public InstantClient::Delegate {
26 public: 25 public:
27 // Doesn't take ownership of either |controller| or |contents|. 26 // Doesn't take ownership of either |controller| or |contents|.
28 InstantTab(InstantController* controller, content::WebContents* contents); 27 InstantTab(InstantController* controller, content::WebContents* contents);
29 virtual ~InstantTab(); 28 virtual ~InstantTab();
30 29
31 content::WebContents* contents() const { return contents_; }
32
33 // Start observing |contents_| for messages. Sends a message to determine if 30 // Start observing |contents_| for messages. Sends a message to determine if
34 // the page supports the Instant API. 31 // the page supports the Instant API.
35 void Init(); 32 void Init();
36 33
37 // Calls through to methods of the same name on InstantClient. 34 // Overriden from InstantPage.
38 void Update(const string16& text, 35 virtual content::WebContents* contents() const OVERRIDE {
39 size_t selection_start, 36 return contents_;
40 size_t selection_end, 37 }
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 38
49 private: 39 private:
50 // Overridden from InstantClient::Delegate: 40 // Overridden from InstantAPIWrapper::Controller.
51 virtual void SetSuggestions( 41 virtual void OnUpdate() OVERRIDE;
52 const std::vector<InstantSuggestion>& suggestions) OVERRIDE; 42 virtual bool OnRenderViewGone() const OVERRIDE;
53 virtual void InstantSupportDetermined(bool supports_instant) OVERRIDE; 43 virtual bool OnAboutToNavigateMainFrame() const OVERRIDE;
54 virtual void ShowInstantPreview(InstantShownReason reason, 44 virtual bool OnSetSuggestions() const OVERRIDE;
55 int height, 45 virtual bool OnShowInstantPreview() const OVERRIDE;
56 InstantSizeUnits units) OVERRIDE; 46 virtual bool OnStartCapturingKeyStrokes() const OVERRIDE;
57 virtual void StartCapturingKeyStrokes() OVERRIDE; 47 virtual bool OnStopCapturingKeyStrokes() const OVERRIDE;
58 virtual void StopCapturingKeyStrokes() OVERRIDE; 48 virtual bool OnNavigateToURL() const 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 49
64 InstantClient client_;
65 InstantController* const controller_;
66 content::WebContents* const contents_; 50 content::WebContents* const contents_;
67 bool supports_instant_;
68 51
69 DISALLOW_COPY_AND_ASSIGN(InstantTab); 52 DISALLOW_COPY_AND_ASSIGN(InstantTab);
70 }; 53 };
71 54
72 #endif // CHROME_BROWSER_INSTANT_INSTANT_TAB_H_ 55 #endif // CHROME_BROWSER_INSTANT_INSTANT_TAB_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698