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

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

Issue 11824050: InstantExtended: Committed NTP (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Undo to fix blacklisting. Created 7 years, 10 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
« no previous file with comments | « chrome/browser/instant/instant_tab.h ('k') | chrome/browser/instant/instant_test_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "chrome/browser/instant/instant_tab.h" 5 #include "chrome/browser/instant/instant_tab.h"
6 6
7 #include "chrome/browser/instant/instant_controller.h" 7 InstantTab::InstantTab(InstantPage::Delegate* delegate)
8 8 : InstantPage(delegate) {
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 } 9 }
16 10
17 InstantTab::~InstantTab() { 11 InstantTab::~InstantTab() {
18 } 12 }
19 13
20 void InstantTab::Init() { 14 void InstantTab::Init(content::WebContents* contents) {
21 client_.SetContents(contents_); 15 SetContents(contents);
22 client_.DetermineIfPageSupportsInstant(); 16 DetermineIfPageSupportsInstant();
23 } 17 }
24 18
25 void InstantTab::Update(const string16& text, 19 bool InstantTab::ShouldProcessSetSuggestions() {
26 size_t selection_start, 20 return true;
27 size_t selection_end,
28 bool verbatim) {
29 client_.Update(text, selection_start, selection_end, verbatim);
30 } 21 }
31 22
32 void InstantTab::Submit(const string16& text) { 23 bool InstantTab::ShouldProcessStartCapturingKeyStrokes() {
33 client_.Submit(text); 24 return true;
34 } 25 }
35 26
36 void InstantTab::SendAutocompleteResults( 27 bool InstantTab::ShouldProcessStopCapturingKeyStrokes() {
37 const std::vector<InstantAutocompleteResult>& results) { 28 return true;
38 client_.SendAutocompleteResults(results);
39 } 29 }
40 30
41 void InstantTab::SetDisplayInstantResults(bool display_instant_results) { 31 bool InstantTab::ShouldProcessNavigateToURL() {
42 client_.SetDisplayInstantResults(display_instant_results); 32 return true;
43 } 33 }
44
45 void InstantTab::UpOrDownKeyPressed(int count) {
46 client_.UpOrDownKeyPressed(count);
47 }
48
49 void InstantTab::SetMarginSize(int start, int end) {
50 client_.SetMarginSize(start, end);
51 }
52
53 void InstantTab::InitializeFonts() {
54 client_.InitializeFonts();
55 }
56
57 void InstantTab::SetSuggestions(
58 const std::vector<InstantSuggestion>& suggestions) {
59 InstantSupportDetermined(true);
60 controller_->SetSuggestions(contents_, suggestions);
61 }
62
63 void InstantTab::InstantSupportDetermined(bool supports_instant) {
64 // If we had already determined that the page supports Instant, nothing to do.
65 if (supports_instant_)
66 return;
67
68 supports_instant_ = supports_instant;
69
70 // If the page doesn't support Instant, stop communicating with it.
71 if (!supports_instant)
72 client_.SetContents(NULL);
73
74 controller_->InstantSupportDetermined(contents_, supports_instant);
75 }
76
77 void InstantTab::ShowInstantPreview(InstantShownReason /* reason */,
78 int /* height */,
79 InstantSizeUnits /* units */) {
80 // The page is a committed tab (i.e., always showing), so nothing to do.
81 }
82
83 void InstantTab::StartCapturingKeyStrokes() {
84 // We don't honor this call from committed tabs.
85 }
86
87 void InstantTab::StopCapturingKeyStrokes() {
88 // We don't honor this call from committed tabs.
89 }
90
91 void InstantTab::RenderViewGone() {
92 // For a commit page, a crash should not be handled differently.
93 }
94
95 void InstantTab::AboutToNavigateMainFrame(const GURL& url) {
96 // The client is a committed tab, navigations will happen as expected.
97 }
98
99 void InstantTab::NavigateToURL(const GURL& url,
100 content::PageTransition transition) {
101 controller_->NavigateToURL(url, transition);
102 }
103
104 void InstantTab::RenderViewCreated() {
105 }
OLDNEW
« no previous file with comments | « chrome/browser/instant/instant_tab.h ('k') | chrome/browser/instant/instant_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698