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

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

Issue 10539064: TabContentsWrapper -> TabContents, part 18. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_
6 #define CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_ 6 #define CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 12 matching lines...) Expand all
23 #include "ui/gfx/native_widget_types.h" 23 #include "ui/gfx/native_widget_types.h"
24 #include "ui/gfx/rect.h" 24 #include "ui/gfx/rect.h"
25 25
26 struct AutocompleteMatch; 26 struct AutocompleteMatch;
27 class InstantDelegate; 27 class InstantDelegate;
28 class InstantLoader; 28 class InstantLoader;
29 class InstantTest; 29 class InstantTest;
30 class PrefService; 30 class PrefService;
31 class Profile; 31 class Profile;
32 class TabContents; 32 class TabContents;
33 typedef TabContents TabContentsWrapper;
34 class TemplateURL; 33 class TemplateURL;
35 34
36 // InstantController maintains a WebContents that is intended to give a preview 35 // InstantController maintains a WebContents that is intended to give a preview
37 // of a URL. InstantController is owned by Browser. 36 // of a URL. InstantController is owned by Browser.
38 // 37 //
39 // At any time the WebContents maintained by InstantController may be destroyed 38 // At any time the WebContents maintained by InstantController may be destroyed
40 // by way of |DestroyPreviewContents|, which results in |HideInstant| being 39 // by way of |DestroyPreviewContents|, which results in |HideInstant| being
41 // invoked on the delegate. Similarly the preview may be committed at any time 40 // invoked on the delegate. Similarly the preview may be committed at any time
42 // by invoking |CommitCurrentPreview|, which results in |CommitInstant| 41 // by invoking |CommitCurrentPreview|, which results in |CommitInstant|
43 // being invoked on the delegate. Also see |PrepareForCommit| below. 42 // being invoked on the delegate. Also see |PrepareForCommit| below.
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 // return value of false means that there is no valid preview to commit. This 116 // return value of false means that there is no valid preview to commit. This
118 // is used by Browser, when the user presses <Enter>, to decide whether to 117 // is used by Browser, when the user presses <Enter>, to decide whether to
119 // load the omnibox contents through Instant or otherwise. This is needed 118 // load the omnibox contents through Instant or otherwise. This is needed
120 // because calls to |Update| don't necessarily result in a preview being 119 // because calls to |Update| don't necessarily result in a preview being
121 // shown, such as in the HIDDEN and SILENT modes. 120 // shown, such as in the HIDDEN and SILENT modes.
122 bool PrepareForCommit(); 121 bool PrepareForCommit();
123 122
124 // Invoked when the user does some gesture that should trigger making the 123 // Invoked when the user does some gesture that should trigger making the
125 // current previewed page the permanent page. Returns the TCW that contains 124 // current previewed page the permanent page. Returns the TCW that contains
126 // the committed preview. 125 // the committed preview.
127 TabContentsWrapper* CommitCurrentPreview(InstantCommitType type); 126 TabContents* CommitCurrentPreview(InstantCommitType type);
128 127
129 // Accepts the currently showing instant preview, if any, and returns true. 128 // Accepts the currently showing instant preview, if any, and returns true.
130 // Returns false if there is no instant preview showing. 129 // Returns false if there is no instant preview showing.
131 bool CommitIfCurrent(); 130 bool CommitIfCurrent();
132 131
133 // Sets InstantController so that when the mouse is released the preview is 132 // Sets InstantController so that when the mouse is released the preview is
134 // committed. 133 // committed.
135 void SetCommitOnMouseUp(); 134 void SetCommitOnMouseUp();
136 135
137 bool commit_on_mouse_up() const { return commit_on_mouse_up_; } 136 bool commit_on_mouse_up() const { return commit_on_mouse_up_; }
(...skipping 10 matching lines...) Expand all
148 // default search engine, in anticipation of the user typing a query. 147 // default search engine, in anticipation of the user typing a query.
149 void OnAutocompleteGotFocus(); 148 void OnAutocompleteGotFocus();
150 149
151 // Releases the preview WebContents passing ownership to the caller. This is 150 // Releases the preview WebContents passing ownership to the caller. This is
152 // intended to be called when the preview WebContents is committed. This does 151 // intended to be called when the preview WebContents is committed. This does
153 // not notify the delegate. |tab_contents| is the underlying tab onto which 152 // not notify the delegate. |tab_contents| is the underlying tab onto which
154 // the preview will be committed. It can be NULL when the underlying tab is 153 // the preview will be committed. It can be NULL when the underlying tab is
155 // irrelevant, for example when |type| is INSTANT_COMMIT_DESTROY. 154 // irrelevant, for example when |type| is INSTANT_COMMIT_DESTROY.
156 // WARNING: be sure and invoke CompleteRelease after adding the returned 155 // WARNING: be sure and invoke CompleteRelease after adding the returned
157 // WebContents to a tabstrip. 156 // WebContents to a tabstrip.
158 TabContentsWrapper* ReleasePreviewContents(InstantCommitType type, 157 TabContents* ReleasePreviewContents(InstantCommitType type,
159 TabContentsWrapper* tab_contents); 158 TabContents* tab_contents);
160 159
161 // Does cleanup after the preview contents has been added to the tabstrip. 160 // Does cleanup after the preview contents has been added to the tabstrip.
162 // Invoke this if you explicitly invoke ReleasePreviewContents. 161 // Invoke this if you explicitly invoke ReleasePreviewContents.
163 void CompleteRelease(TabContentsWrapper* tab); 162 void CompleteRelease(TabContents* tab);
164 163
165 // The preview TabContentsWrapper; may be null. 164 // The preview TabContents; may be null.
166 TabContentsWrapper* GetPreviewContents() const; 165 TabContents* GetPreviewContents() const;
167 166
168 // Returns true if the preview TabContentsWrapper is ready to be displayed. In 167 // Returns true if the preview TabContents is ready to be displayed. In
169 // some situations this may return false yet GetPreviewContents() returns 168 // some situations this may return false yet GetPreviewContents() returns
170 // non-NULL. 169 // non-NULL.
171 bool is_displayable() const { return is_displayable_; } 170 bool is_displayable() const { return is_displayable_; }
172 171
173 // Returns the transition type of the last AutocompleteMatch passed to Update. 172 // Returns the transition type of the last AutocompleteMatch passed to Update.
174 content::PageTransition last_transition_type() const { 173 content::PageTransition last_transition_type() const {
175 return last_transition_type_; 174 return last_transition_type_;
176 } 175 }
177 176
178 // InstantLoaderDelegate 177 // InstantLoaderDelegate
(...skipping 14 matching lines...) Expand all
193 private: 192 private:
194 friend class InstantTest; 193 friend class InstantTest;
195 194
196 typedef std::set<std::string> HostBlacklist; 195 typedef std::set<std::string> HostBlacklist;
197 196
198 // Updates |is_displayable_| and if necessary notifies the delegate. 197 // Updates |is_displayable_| and if necessary notifies the delegate.
199 void UpdateIsDisplayable(); 198 void UpdateIsDisplayable();
200 199
201 // Updates InstantLoaderManager and its current InstantLoader. This is invoked 200 // Updates InstantLoaderManager and its current InstantLoader. This is invoked
202 // internally from Update. 201 // internally from Update.
203 void UpdateLoader(TabContentsWrapper* tab_contents, 202 void UpdateLoader(TabContents* tab_contents,
204 const TemplateURL* template_url, 203 const TemplateURL* template_url,
205 const GURL& url, 204 const GURL& url,
206 content::PageTransition transition_type, 205 content::PageTransition transition_type,
207 const string16& user_text, 206 const string16& user_text,
208 bool verbatim, 207 bool verbatim,
209 string16* suggested_text); 208 string16* suggested_text);
210 209
211 // Returns true if |template_url| is a valid TemplateURL for use by instant. 210 // Returns true if |template_url| is a valid TemplateURL for use by instant.
212 bool IsValidInstantTemplateURL(const TemplateURL* template_url); 211 bool IsValidInstantTemplateURL(const TemplateURL* template_url);
213 212
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 // The most recent user_text passed to |Update|. 268 // The most recent user_text passed to |Update|.
270 string16 last_user_text_; 269 string16 last_user_text_;
271 270
272 // See the enum description above. 271 // See the enum description above.
273 const Mode mode_; 272 const Mode mode_;
274 273
275 DISALLOW_COPY_AND_ASSIGN(InstantController); 274 DISALLOW_COPY_AND_ASSIGN(InstantController);
276 }; 275 };
277 276
278 #endif // CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_ 277 #endif // CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/instant/instant_browsertest.cc ('k') | chrome/browser/instant/instant_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698