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

Side by Side Diff: chrome/browser/ui/omnibox/omnibox_edit_model.h

Issue 10732002: Upstream rewrite of Instant. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Replace id with instant_url. Created 8 years, 5 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_UI_OMNIBOX_OMNIBOX_EDIT_MODEL_H_ 5 #ifndef CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_EDIT_MODEL_H_
6 #define CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_EDIT_MODEL_H_ 6 #define CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_EDIT_MODEL_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 // Returns the current autocomplete result. This logic should in the future 208 // Returns the current autocomplete result. This logic should in the future
209 // live in AutocompleteController but resides here for now. This method is 209 // live in AutocompleteController but resides here for now. This method is
210 // used by AutomationProvider::AutocompleteEditGetMatches. 210 // used by AutomationProvider::AutocompleteEditGetMatches.
211 const AutocompleteResult& result() const; 211 const AutocompleteResult& result() const;
212 212
213 // Called when the view is gaining focus. |control_down| is whether the 213 // Called when the view is gaining focus. |control_down| is whether the
214 // control key is down (at the time we're gaining focus). 214 // control key is down (at the time we're gaining focus).
215 void OnSetFocus(bool control_down); 215 void OnSetFocus(bool control_down);
216 216
217 // Sent before |OnKillFocus| and before the popup is closed. 217 // Sent before |OnKillFocus| and before the popup is closed.
218 void OnWillKillFocus(gfx::NativeView view_gaining_focus); 218 void OnWillKillFocus();
219 219
220 // Called when the view is losing focus. Resets some state. 220 // Called when the view is losing focus. Resets some state.
221 void OnKillFocus(); 221 void OnKillFocus();
222 222
223 // Called when the user presses the escape key. Decides what, if anything, to 223 // Called when the user presses the escape key. Decides what, if anything, to
224 // revert about any current edits. Returns whether the key was handled. 224 // revert about any current edits. Returns whether the key was handled.
225 bool OnEscapeKeyPressed(); 225 bool OnEscapeKeyPressed();
226 226
227 // Called when the user presses or releases the control key. Changes state as 227 // Called when the user presses or releases the control key. Changes state as
228 // necessary. 228 // necessary.
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 // Checks whether the user inserted a space into |old_text| and by doing so 366 // Checks whether the user inserted a space into |old_text| and by doing so
367 // created a |new_text| that looks like "<keyword> <search phrase>". 367 // created a |new_text| that looks like "<keyword> <search phrase>".
368 bool CreatedKeywordSearchByInsertingSpaceInMiddle( 368 bool CreatedKeywordSearchByInsertingSpaceInMiddle(
369 const string16& old_text, 369 const string16& old_text,
370 const string16& new_text, 370 const string16& new_text,
371 size_t caret_position) const; 371 size_t caret_position) const;
372 372
373 // Notifies the SearchTabHelper that autocomplete state has changed. 373 // Notifies the SearchTabHelper that autocomplete state has changed.
374 void NotifySearchTabHelper(); 374 void NotifySearchTabHelper();
375 375
376 // Tries to start an instant preview for |match|. Returns true if instant 376 // Tries to start an Instant preview for |match|. Returns true if Instant
377 // processed the match. 377 // processed the match. |suggested_text| should initially contain the current
378 bool DoInstant(const AutocompleteMatch& match, string16* suggested_text); 378 // inline autocomplete text. Instant will replace it to new suggested text
379 // and set |complete_behavior| accordingly.
380 bool DoInstant(const AutocompleteMatch& match,
381 string16* suggested_text,
382 InstantCompleteBehavior* complete_behavior);
379 383
380 // Starts a prerender for the given |match|. 384 // Starts a prerender for the given |match|.
381 void DoPrerender(const AutocompleteMatch& match); 385 void DoPrerender(const AutocompleteMatch& match);
382 386
383 // Starts a DNS prefetch for the given |match|. 387 // Starts a DNS prefetch for the given |match|.
384 void DoPreconnect(const AutocompleteMatch& match); 388 void DoPreconnect(const AutocompleteMatch& match);
385 389
386 // Checks if a given character is a valid space character for accepting 390 // Checks if a given character is a valid space character for accepting
387 // keyword. 391 // keyword.
388 static bool IsSpaceCharForAcceptingKeyword(wchar_t c); 392 static bool IsSpaceCharForAcceptingKeyword(wchar_t c);
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 bool in_revert_; 506 bool in_revert_;
503 507
504 // Indicates if the upcoming autocomplete search is allowed to be treated as 508 // Indicates if the upcoming autocomplete search is allowed to be treated as
505 // an exact keyword match. If this is true then keyword mode will be 509 // an exact keyword match. If this is true then keyword mode will be
506 // triggered automatically if the input is "<keyword> <search string>". We 510 // triggered automatically if the input is "<keyword> <search string>". We
507 // allow this when CreatedKeywordSearchByInsertingSpaceInMiddle() is true. 511 // allow this when CreatedKeywordSearchByInsertingSpaceInMiddle() is true.
508 // This has no effect if we're already in keyword mode. 512 // This has no effect if we're already in keyword mode.
509 bool allow_exact_keyword_match_; 513 bool allow_exact_keyword_match_;
510 514
511 // Last value of InstantCompleteBehavior supplied to |SetSuggestedText|. 515 // Last value of InstantCompleteBehavior supplied to |SetSuggestedText|.
512 InstantCompleteBehavior instant_complete_behavior_; 516 InstantCompleteBehavior instant_complete_behavior_;
sreeram 2012/07/24 14:08:32 We can get rid of this member now.
Jered 2012/07/24 15:24:34 It's referenced in instant_browsertest and seems a
513 517
514 DISALLOW_COPY_AND_ASSIGN(OmniboxEditModel); 518 DISALLOW_COPY_AND_ASSIGN(OmniboxEditModel);
515 }; 519 };
516 520
517 #endif // CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_EDIT_MODEL_H_ 521 #endif // CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_EDIT_MODEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698