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

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

Issue 8298005: Fixes bug in instant where we would end up incorrectly using the (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Tweak Created 9 years, 2 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 const AutocompleteMatch& match, 81 const AutocompleteMatch& match,
82 const string16& user_text, 82 const string16& user_text,
83 bool verbatim, 83 bool verbatim,
84 string16* suggested_text); 84 string16* suggested_text);
85 85
86 // Sets the bounds of the omnibox (in screen coordinates). The bounds are 86 // Sets the bounds of the omnibox (in screen coordinates). The bounds are
87 // remembered until the preview is committed or destroyed. This is only used 87 // remembered until the preview is committed or destroyed. This is only used
88 // when showing results for a search provider that supports instant. 88 // when showing results for a search provider that supports instant.
89 void SetOmniboxBounds(const gfx::Rect& bounds); 89 void SetOmniboxBounds(const gfx::Rect& bounds);
90 90
91 // Destroys the preview TabContents. Does nothing if the preview TabContents 91 // Notifies the delegate to hide the preview and destroys the preview
92 // has not been created. 92 // TabContents. Does nothing if the preview TabContents has not been created.
93 void DestroyPreviewContents(); 93 void DestroyPreviewContents();
94 94
95 // Destroys the current loaders but remains active. 95 // Notifies the delegate to hide the preview but leaves it around in hopes it
96 void DestroyPreviewContentsAndLeaveActive(); 96 // can be subsequently used. The preview will not be used until Update() (with
97 // valid parameters) is invoked.
98 void Hide();
97 99
98 // Returns true if we're showing the last URL passed to |Update|. If this is 100 // Returns true if we're showing the last URL passed to |Update|. If this is
99 // false a commit does not result in committing the last url passed to update. 101 // false a commit does not result in committing the last url passed to update.
100 // A return value of false happens if we're in the process of determining if 102 // A return value of false happens if we're in the process of determining if
101 // the page supports instant. 103 // the page supports instant.
102 bool IsCurrent(); 104 bool IsCurrent();
103 105
104 // Returns true if the caller should proceed with committing the preview. A 106 // Returns true if the caller should proceed with committing the preview. A
105 // return value of false means that there is no valid preview to commit. This 107 // return value of false means that there is no valid preview to commit. This
106 // is used by Browser, when the user presses <Enter>, to decide whether to 108 // is used by Browser, when the user presses <Enter>, to decide whether to
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 // Does cleanup after the preview contents has been added to the tabstrip. 144 // Does cleanup after the preview contents has been added to the tabstrip.
143 // Invoke this if you explicitly invoke ReleasePreviewContents. 145 // Invoke this if you explicitly invoke ReleasePreviewContents.
144 void CompleteRelease(TabContentsWrapper* tab); 146 void CompleteRelease(TabContentsWrapper* tab);
145 147
146 // TabContents the match is being shown for. 148 // TabContents the match is being shown for.
147 TabContentsWrapper* tab_contents() const { return tab_contents_; } 149 TabContentsWrapper* tab_contents() const { return tab_contents_; }
148 150
149 // The preview TabContents; may be null. 151 // The preview TabContents; may be null.
150 TabContentsWrapper* GetPreviewContents(); 152 TabContentsWrapper* GetPreviewContents();
151 153
152 // Returns true if |Update| has been invoked without a corresponding call to
153 // |DestroyPreviewContents| or |CommitCurrentPreview|.
154 bool is_active() const { return is_active_; }
155
156 // Returns true if the preview TabContents is ready to be displayed. In some 154 // Returns true if the preview TabContents is ready to be displayed. In some
157 // situations this may return false yet GetPreviewContents() returns non-NULL. 155 // situations this may return false yet GetPreviewContents() returns non-NULL.
158 bool is_displayable() const { return is_displayable_; } 156 bool is_displayable() const { return is_displayable_; }
159 157
160 // Returns the transition type of the last AutocompleteMatch passed to Update. 158 // Returns the transition type of the last AutocompleteMatch passed to Update.
161 content::PageTransition last_transition_type() const { 159 content::PageTransition last_transition_type() const {
162 return last_transition_type_; 160 return last_transition_type_;
163 } 161 }
164 162
165 // InstantLoaderDelegate 163 // InstantLoaderDelegate
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 void ScheduleDestroy(InstantLoader* loader); 216 void ScheduleDestroy(InstantLoader* loader);
219 217
220 // Destroys all loaders scheduled for destruction in |ScheduleForDestroy|. 218 // Destroys all loaders scheduled for destruction in |ScheduleForDestroy|.
221 void DestroyLoaders(); 219 void DestroyLoaders();
222 220
223 InstantDelegate* delegate_; 221 InstantDelegate* delegate_;
224 222
225 // The TabContents last passed to |Update|. 223 // The TabContents last passed to |Update|.
226 TabContentsWrapper* tab_contents_; 224 TabContentsWrapper* tab_contents_;
227 225
228 // See description above getter for details.
229 bool is_active_;
230
231 scoped_ptr<InstantLoader> loader_;
232
233 // True if |loader_| is ready to be displayed. 226 // True if |loader_| is ready to be displayed.
234 bool is_displayable_; 227 bool is_displayable_;
235 228
229 // Set to true in Hide() and false in UpdateLoader(). Used when we persist
230 // the |loader_|, but it isn't up to date.
231 bool is_out_of_date_;
232
233 scoped_ptr<InstantLoader> loader_;
234
236 // See description above setter. 235 // See description above setter.
237 gfx::Rect omnibox_bounds_; 236 gfx::Rect omnibox_bounds_;
238 237
239 // See description above CommitOnMouseUp. 238 // See description above CommitOnMouseUp.
240 bool commit_on_mouse_up_; 239 bool commit_on_mouse_up_;
241 240
242 // See description above getter. 241 // See description above getter.
243 content::PageTransition last_transition_type_; 242 content::PageTransition last_transition_type_;
244 243
245 // The IDs of any search engines that don't support instant. We assume all 244 // The IDs of any search engines that don't support instant. We assume all
(...skipping 11 matching lines...) Expand all
257 // The URL of the most recent match passed to |Update|. 256 // The URL of the most recent match passed to |Update|.
258 GURL last_url_; 257 GURL last_url_;
259 258
260 // The most recent user_text passed to |Update|. 259 // The most recent user_text passed to |Update|.
261 string16 last_user_text_; 260 string16 last_user_text_;
262 261
263 DISALLOW_COPY_AND_ASSIGN(InstantController); 262 DISALLOW_COPY_AND_ASSIGN(InstantController);
264 }; 263 };
265 264
266 #endif // CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_ 265 #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