| 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 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" |
| 11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
| 12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "chrome/browser/autocomplete/autocomplete_controller_delegate.h" | 13 #include "chrome/browser/autocomplete/autocomplete_controller_delegate.h" |
| 14 #include "chrome/browser/autocomplete/autocomplete_match.h" | 14 #include "chrome/browser/autocomplete/autocomplete_match.h" |
| 15 #include "chrome/browser/ui/omnibox/omnibox_controller.h" | 15 #include "chrome/browser/ui/omnibox/omnibox_controller.h" |
| 16 #include "chrome/common/metrics/proto/omnibox_event.pb.h" | |
| 17 #include "chrome/common/omnibox_focus_state.h" | 16 #include "chrome/common/omnibox_focus_state.h" |
| 18 #include "content/public/common/page_transition_types.h" | 17 #include "content/public/common/page_transition_types.h" |
| 19 #include "ui/base/window_open_disposition.h" | 18 #include "ui/base/window_open_disposition.h" |
| 20 #include "ui/gfx/native_widget_types.h" | 19 #include "ui/gfx/native_widget_types.h" |
| 21 #include "url/gurl.h" | 20 #include "url/gurl.h" |
| 22 | 21 |
| 23 class AutocompleteController; | 22 class AutocompleteController; |
| 24 class AutocompleteResult; | 23 class AutocompleteResult; |
| 25 class OmniboxCurrentPageDelegate; | 24 class OmniboxCurrentPageDelegate; |
| 26 class OmniboxEditController; | 25 class OmniboxEditController; |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 size_t caret_position) const; | 379 size_t caret_position) const; |
| 381 | 380 |
| 382 // Checks if a given character is a valid space character for accepting | 381 // Checks if a given character is a valid space character for accepting |
| 383 // keyword. | 382 // keyword. |
| 384 static bool IsSpaceCharForAcceptingKeyword(wchar_t c); | 383 static bool IsSpaceCharForAcceptingKeyword(wchar_t c); |
| 385 | 384 |
| 386 // Classify the current page being viewed as, for example, the new tab | 385 // Classify the current page being viewed as, for example, the new tab |
| 387 // page or a normal web page. Used for logging omnibox events for | 386 // page or a normal web page. Used for logging omnibox events for |
| 388 // UMA opted-in users. Examines the user's profile to determine if the | 387 // UMA opted-in users. Examines the user's profile to determine if the |
| 389 // current page is the user's home page. | 388 // current page is the user's home page. |
| 390 metrics::OmniboxEventProto::PageClassification ClassifyPage() const; | 389 AutocompleteInput::PageClassification ClassifyPage() const; |
| 391 | 390 |
| 392 // Sets |match| and |alternate_nav_url| based on classifying |text|. | 391 // Sets |match| and |alternate_nav_url| based on classifying |text|. |
| 393 // |alternate_nav_url| may be NULL. | 392 // |alternate_nav_url| may be NULL. |
| 394 void ClassifyStringForPasteAndGo(const string16& text, | 393 void ClassifyStringForPasteAndGo(const string16& text, |
| 395 AutocompleteMatch* match, | 394 AutocompleteMatch* match, |
| 396 GURL* alternate_nav_url) const; | 395 GURL* alternate_nav_url) const; |
| 397 | 396 |
| 398 // If focus_state_ does not match |state|, we update it and notify the | 397 // If focus_state_ does not match |state|, we update it and notify the |
| 399 // InstantController about the change (passing along the |reason| for the | 398 // InstantController about the change (passing along the |reason| for the |
| 400 // change). If the caret visibility changes, we call ApplyCaretVisibility() on | 399 // change). If the caret visibility changes, we call ApplyCaretVisibility() on |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 // an exact keyword match. If this is true then keyword mode will be | 507 // an exact keyword match. If this is true then keyword mode will be |
| 509 // triggered automatically if the input is "<keyword> <search string>". We | 508 // triggered automatically if the input is "<keyword> <search string>". We |
| 510 // allow this when CreatedKeywordSearchByInsertingSpaceInMiddle() is true. | 509 // allow this when CreatedKeywordSearchByInsertingSpaceInMiddle() is true. |
| 511 // This has no effect if we're already in keyword mode. | 510 // This has no effect if we're already in keyword mode. |
| 512 bool allow_exact_keyword_match_; | 511 bool allow_exact_keyword_match_; |
| 513 | 512 |
| 514 DISALLOW_COPY_AND_ASSIGN(OmniboxEditModel); | 513 DISALLOW_COPY_AND_ASSIGN(OmniboxEditModel); |
| 515 }; | 514 }; |
| 516 | 515 |
| 517 #endif // CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_EDIT_MODEL_H_ | 516 #endif // CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_EDIT_MODEL_H_ |
| OLD | NEW |