OLD | NEW |
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_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_H_ | 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_H_ |
6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_H_ | 6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/string16.h" | 10 #include "base/string16.h" |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 | 331 |
332 // Invoked when the popup is going to change its bounds to |bounds|. | 332 // Invoked when the popup is going to change its bounds to |bounds|. |
333 void PopupBoundsChangedTo(const gfx::Rect& bounds); | 333 void PopupBoundsChangedTo(const gfx::Rect& bounds); |
334 | 334 |
335 #if defined(UNIT_TEST) | 335 #if defined(UNIT_TEST) |
336 InstantCompleteBehavior instant_complete_behavior() const { | 336 InstantCompleteBehavior instant_complete_behavior() const { |
337 return instant_complete_behavior_; | 337 return instant_complete_behavior_; |
338 } | 338 } |
339 #endif | 339 #endif |
340 | 340 |
| 341 // Checks if a given character is a valid space character for accepting |
| 342 // keyword. |
| 343 static bool IsSpaceCharForAcceptingKeyword(wchar_t c); |
| 344 |
341 private: | 345 private: |
342 enum PasteState { | 346 enum PasteState { |
343 NONE, // Most recent edit was not a paste. | 347 NONE, // Most recent edit was not a paste. |
344 PASTING, // In the middle of doing a paste. We need this intermediate | 348 PASTING, // In the middle of doing a paste. We need this intermediate |
345 // state because OnPaste() does the actual detection of | 349 // state because OnPaste() does the actual detection of |
346 // paste, but OnAfterPossibleChange() has to update the | 350 // paste, but OnAfterPossibleChange() has to update the |
347 // paste state for every edit. If OnPaste() set the state | 351 // paste state for every edit. If OnPaste() set the state |
348 // directly to PASTED, OnAfterPossibleChange() wouldn't know | 352 // directly to PASTED, OnAfterPossibleChange() wouldn't know |
349 // whether that represented the current edit or a past one. | 353 // whether that represented the current edit or a past one. |
350 PASTED, // Most recent edit was a paste. | 354 PASTED, // Most recent edit was a paste. |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 // Tries to start an instant preview for |match|. Returns true if instant is | 429 // Tries to start an instant preview for |match|. Returns true if instant is |
426 // supported. |suggested_text| must be non-NULL. | 430 // supported. |suggested_text| must be non-NULL. |
427 bool DoInstant(const AutocompleteMatch& match, string16* suggested_text); | 431 bool DoInstant(const AutocompleteMatch& match, string16* suggested_text); |
428 | 432 |
429 // Starts a prerender for the given |match|. | 433 // Starts a prerender for the given |match|. |
430 void DoPrerender(const AutocompleteMatch& match); | 434 void DoPrerender(const AutocompleteMatch& match); |
431 | 435 |
432 // Starts a DNS prefetch for the given |match|. | 436 // Starts a DNS prefetch for the given |match|. |
433 void DoPreconnect(const AutocompleteMatch& match); | 437 void DoPreconnect(const AutocompleteMatch& match); |
434 | 438 |
435 // Checks if a given character is a valid space character for accepting | |
436 // keyword. | |
437 static bool IsSpaceCharForAcceptingKeyword(wchar_t c); | |
438 | |
439 scoped_ptr<AutocompleteController> autocomplete_controller_; | 439 scoped_ptr<AutocompleteController> autocomplete_controller_; |
440 | 440 |
441 OmniboxView* view_; | 441 OmniboxView* view_; |
442 | 442 |
443 AutocompletePopupModel* popup_; | 443 AutocompletePopupModel* popup_; |
444 | 444 |
445 AutocompleteEditController* controller_; | 445 AutocompleteEditController* controller_; |
446 | 446 |
447 // Whether the edit has focus. | 447 // Whether the edit has focus. |
448 bool has_focus_; | 448 bool has_focus_; |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 // Last value of InstantCompleteBehavior supplied to |SetSuggestedText|. | 555 // Last value of InstantCompleteBehavior supplied to |SetSuggestedText|. |
556 InstantCompleteBehavior instant_complete_behavior_; | 556 InstantCompleteBehavior instant_complete_behavior_; |
557 | 557 |
558 // Used to determine what network actions to take in different circumstances. | 558 // Used to determine what network actions to take in different circumstances. |
559 NetworkActionPredictor network_action_predictor_; | 559 NetworkActionPredictor network_action_predictor_; |
560 | 560 |
561 DISALLOW_COPY_AND_ASSIGN(AutocompleteEditModel); | 561 DISALLOW_COPY_AND_ASSIGN(AutocompleteEditModel); |
562 }; | 562 }; |
563 | 563 |
564 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_H_ | 564 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_H_ |
OLD | NEW |