| OLD | NEW |
| 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 #ifndef COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_EDIT_MODEL_H_ | 5 #ifndef COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_EDIT_MODEL_H_ |
| 6 #define COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_EDIT_MODEL_H_ | 6 #define COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_EDIT_MODEL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 | 11 |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
| 15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 16 #include "components/metrics/proto/omnibox_event.pb.h" | 16 #include "components/metrics/proto/omnibox_event.pb.h" |
| 17 #include "components/omnibox/browser/autocomplete_controller.h" |
| 17 #include "components/omnibox/browser/autocomplete_controller_delegate.h" | 18 #include "components/omnibox/browser/autocomplete_controller_delegate.h" |
| 18 #include "components/omnibox/browser/autocomplete_input.h" | 19 #include "components/omnibox/browser/autocomplete_input.h" |
| 19 #include "components/omnibox/browser/autocomplete_match.h" | 20 #include "components/omnibox/browser/autocomplete_match.h" |
| 20 #include "components/omnibox/browser/omnibox_controller.h" | 21 #include "components/omnibox/browser/omnibox_controller.h" |
| 21 #include "components/omnibox/common/omnibox_focus_state.h" | 22 #include "components/omnibox/common/omnibox_focus_state.h" |
| 22 #include "ui/base/window_open_disposition.h" | 23 #include "ui/base/window_open_disposition.h" |
| 23 #include "ui/gfx/native_widget_types.h" | 24 #include "ui/gfx/native_widget_types.h" |
| 24 #include "url/gurl.h" | 25 #include "url/gurl.h" |
| 25 | 26 |
| 26 class AutocompleteController; | |
| 27 class AutocompleteResult; | 27 class AutocompleteResult; |
| 28 class OmniboxClient; | 28 class OmniboxClient; |
| 29 class OmniboxEditController; | 29 class OmniboxEditController; |
| 30 class OmniboxPopupModel; | 30 class OmniboxPopupModel; |
| 31 class OmniboxView; | 31 class OmniboxView; |
| 32 | 32 |
| 33 namespace gfx { | 33 namespace gfx { |
| 34 class Image; | 34 class Image; |
| 35 class Rect; | 35 class Rect; |
| 36 } | 36 } |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 // contents/selection have changed since it was | 370 // contents/selection have changed since it was |
| 371 // depressed. If the user now hits enter, we assume | 371 // depressed. If the user now hits enter, we assume |
| 372 // he simply hasn't released the key, rather than that | 372 // he simply hasn't released the key, rather than that |
| 373 // he intended to hit "ctrl-enter". | 373 // he intended to hit "ctrl-enter". |
| 374 }; | 374 }; |
| 375 | 375 |
| 376 // Returns true if a query to an autocomplete provider is currently | 376 // Returns true if a query to an autocomplete provider is currently |
| 377 // in progress. This logic should in the future live in | 377 // in progress. This logic should in the future live in |
| 378 // AutocompleteController but resides here for now. This method is used by | 378 // AutocompleteController but resides here for now. This method is used by |
| 379 // AutomationProvider::AutocompleteEditIsQueryInProgress. | 379 // AutomationProvider::AutocompleteEditIsQueryInProgress. |
| 380 bool query_in_progress() const; | 380 bool query_in_progress() const { return !autocomplete_controller()->done(); } |
| 381 |
| 382 // Returns true if the popup exists and is open. (This is a convenience |
| 383 // wrapper for the benefit of test code, which may not have a popup model.) |
| 384 bool PopupIsOpen() const; |
| 381 | 385 |
| 382 // Called whenever user_text_ should change. | 386 // Called whenever user_text_ should change. |
| 383 void InternalSetUserText(const base::string16& text); | 387 void InternalSetUserText(const base::string16& text); |
| 384 | 388 |
| 385 // Turns off keyword mode for the current match. | 389 // Turns off keyword mode for the current match. |
| 386 void ClearPopupKeywordMode() const; | 390 void ClearPopupKeywordMode() const; |
| 387 | 391 |
| 388 // Conversion between user text and display text. User text is the text the | 392 // Conversion between user text and display text. User text is the text the |
| 389 // user has input. Display text is the text being shown in the edit. The | 393 // user has input. Display text is the text being shown in the edit. The |
| 390 // two are different if a keyword is selected. | 394 // two are different if a keyword is selected. |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 | 564 |
| 561 // The input that was sent to the AutocompleteController. Since no | 565 // The input that was sent to the AutocompleteController. Since no |
| 562 // autocomplete query is started after a tab switch, it is possible for this | 566 // autocomplete query is started after a tab switch, it is possible for this |
| 563 // |input_| to differ from the one currently stored in AutocompleteController. | 567 // |input_| to differ from the one currently stored in AutocompleteController. |
| 564 AutocompleteInput input_; | 568 AutocompleteInput input_; |
| 565 | 569 |
| 566 DISALLOW_COPY_AND_ASSIGN(OmniboxEditModel); | 570 DISALLOW_COPY_AND_ASSIGN(OmniboxEditModel); |
| 567 }; | 571 }; |
| 568 | 572 |
| 569 #endif // COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_EDIT_MODEL_H_ | 573 #endif // COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_EDIT_MODEL_H_ |
| OLD | NEW |