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

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

Issue 11421079: Persist the Instant API to committed search result pages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Kittens live! Created 8 years 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 | Annotate | Revision Log
OLDNEW
(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 #include "chrome/browser/instant/instant_tab.h"
6
7 #include "chrome/browser/instant/instant_controller.h"
8
9 InstantTab::InstantTab(InstantController* controller,
10 content::WebContents* contents)
11 : client_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
12 controller_(controller),
13 contents_(contents),
14 supports_instant_(false) {
15 client_.SetContents(contents);
16 client_.DetermineIfPageSupportsInstant();
Jered 2012/11/29 19:57:05 I am uneasy about Observe() and sending an IPC in
sreeram 2012/12/04 08:10:52 Done.
17 }
18
19 InstantTab::~InstantTab() {
20 }
21
22 void InstantTab::Update(const string16& text, bool verbatim) {
23 client_.Update(text, verbatim);
24 }
25
26 void InstantTab::Submit(const string16& text) {
27 client_.Submit(text);
28 }
29
30 void InstantTab::SendAutocompleteResults(
31 const std::vector<InstantAutocompleteResult>& results) {
32 client_.SendAutocompleteResults(results);
33 }
34
35 void InstantTab::UpOrDownKeyPressed(int count) {
36 client_.UpOrDownKeyPressed(count);
37 }
38
39 void InstantTab::SetSuggestions(
40 const std::vector<InstantSuggestion>& suggestions) {
41 InstantSupportDetermined(true);
42 controller_->SetSuggestions(contents_, suggestions);
43 }
44
45 void InstantTab::InstantSupportDetermined(bool supports_instant) {
46 // If we had already determined that the page supports Instant, nothing to do.
47 if (supports_instant_)
48 return;
49
50 supports_instant_ = supports_instant;
51
52 // If the page doesn't support Instant, stop communicating with it.
53 if (!supports_instant)
54 client_.SetContents(NULL);
55
56 controller_->InstantSupportDetermined(contents_, supports_instant);
57 }
58
59 void InstantTab::ShowInstantPreview(InstantShownReason /* reason */,
60 int /* height */,
61 InstantSizeUnits /* units */) {
62 // The page is a committed tab (i.e., always showing), so nothing to do.
63 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698