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/string16.h" | 11 #include "base/string16.h" |
12 #include "base/time.h" | 12 #include "base/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/common/instant_types.h" | |
15 #include "chrome/common/metrics/proto/omnibox_event.pb.h" | 16 #include "chrome/common/metrics/proto/omnibox_event.pb.h" |
16 #include "content/public/common/page_transition_types.h" | 17 #include "content/public/common/page_transition_types.h" |
17 #include "googleurl/src/gurl.h" | 18 #include "googleurl/src/gurl.h" |
18 #include "ui/gfx/native_widget_types.h" | 19 #include "ui/gfx/native_widget_types.h" |
19 #include "webkit/glue/window_open_disposition.h" | 20 #include "webkit/glue/window_open_disposition.h" |
20 | 21 |
21 class AutocompleteController; | 22 class AutocompleteController; |
22 class AutocompleteResult; | 23 class AutocompleteResult; |
23 struct InstantSuggestion; | 24 struct InstantSuggestion; |
24 class OmniboxEditController; | 25 class OmniboxEditController; |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
215 // Called when the view is gaining focus. |control_down| is whether the | 216 // Called when the view is gaining focus. |control_down| is whether the |
216 // control key is down (at the time we're gaining focus). | 217 // control key is down (at the time we're gaining focus). |
217 void OnSetFocus(bool control_down); | 218 void OnSetFocus(bool control_down); |
218 | 219 |
219 // Sets the visibility of the caret in the omnibox, if it has focus. The | 220 // Sets the visibility of the caret in the omnibox, if it has focus. The |
220 // visibility of the caret is reset to visible if any of the following | 221 // visibility of the caret is reset to visible if any of the following |
221 // happens: | 222 // happens: |
222 // - User starts typing in the omnibox | 223 // - User starts typing in the omnibox |
223 // - User clicks in the omnibox | 224 // - User clicks in the omnibox |
224 // - Omnibox loses and then regains focus | 225 // - Omnibox loses and then regains focus |
225 // - SetFocus() is explicitly called again | 226 // - SetFocus() is explicitly called again |
Peter Kasting
2012/12/06 06:02:30
Nit: SetFocus() -> OmniboxView::SetFocus() ?
samarth
2012/12/06 16:15:50
Done.
| |
227 // Note that the last two cases often overlap but can happen independently of | |
228 // each other and so must both be dealt with individually. (For example, if | |
229 // you tab into the omnibox, OnSetFocus will be called but not SetFocus. If | |
230 // the omnibox has invisible focus and you open a second tab, SetFocus will be | |
231 // called but not OnSetFocus.) | |
Peter Kasting
2012/12/06 06:02:30
Rather than write so much here, perhaps we need mo
| |
232 // | |
226 // Caret visibility is tracked per-tab and updates automatically upon | 233 // Caret visibility is tracked per-tab and updates automatically upon |
227 // switching tabs. | 234 // switching tabs. |
228 void SetCaretVisibility(bool visible); | 235 void SetCaretVisibility(bool visible); |
229 | 236 |
230 // Sent before |OnKillFocus| and before the popup is closed. | 237 // Sent before |OnKillFocus| and before the popup is closed. |
231 void OnWillKillFocus(gfx::NativeView view_gaining_focus); | 238 void OnWillKillFocus(gfx::NativeView view_gaining_focus); |
232 | 239 |
233 // Called when the view is losing focus. Resets some state. | 240 // Called when the view is losing focus. Resets some state. |
234 void OnKillFocus(); | 241 void OnKillFocus(); |
235 | 242 |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
400 // current page is the user's home page. | 407 // current page is the user's home page. |
401 metrics::OmniboxEventProto::PageClassification ClassifyPage( | 408 metrics::OmniboxEventProto::PageClassification ClassifyPage( |
402 const GURL& gurl) const; | 409 const GURL& gurl) const; |
403 | 410 |
404 // Sets |match| and |alternate_nav_url| based on classifying |text|. | 411 // Sets |match| and |alternate_nav_url| based on classifying |text|. |
405 // |alternate_nav_url| may be NULL. | 412 // |alternate_nav_url| may be NULL. |
406 void ClassifyStringForPasteAndGo(const string16& text, | 413 void ClassifyStringForPasteAndGo(const string16& text, |
407 AutocompleteMatch* match, | 414 AutocompleteMatch* match, |
408 GURL* alternate_nav_url) const; | 415 GURL* alternate_nav_url) const; |
409 | 416 |
417 // Helper for SetCaretVisibility. |reason| is the reason for change that is | |
418 // passed down to InstantController when we notify it of focus state changes. | |
419 void SetCaretVisibilityInternal(bool visible, | |
420 OmniboxFocusChangeReason reason); | |
421 | |
410 scoped_ptr<AutocompleteController> autocomplete_controller_; | 422 scoped_ptr<AutocompleteController> autocomplete_controller_; |
411 | 423 |
412 OmniboxView* view_; | 424 OmniboxView* view_; |
413 | 425 |
414 OmniboxPopupModel* popup_; | 426 OmniboxPopupModel* popup_; |
415 | 427 |
416 OmniboxEditController* controller_; | 428 OmniboxEditController* controller_; |
417 | 429 |
418 // Whether the edit has focus. | 430 // Whether the edit has focus. |
419 bool has_focus_; | 431 bool has_focus_; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
521 // an exact keyword match. If this is true then keyword mode will be | 533 // an exact keyword match. If this is true then keyword mode will be |
522 // triggered automatically if the input is "<keyword> <search string>". We | 534 // triggered automatically if the input is "<keyword> <search string>". We |
523 // allow this when CreatedKeywordSearchByInsertingSpaceInMiddle() is true. | 535 // allow this when CreatedKeywordSearchByInsertingSpaceInMiddle() is true. |
524 // This has no effect if we're already in keyword mode. | 536 // This has no effect if we're already in keyword mode. |
525 bool allow_exact_keyword_match_; | 537 bool allow_exact_keyword_match_; |
526 | 538 |
527 DISALLOW_COPY_AND_ASSIGN(OmniboxEditModel); | 539 DISALLOW_COPY_AND_ASSIGN(OmniboxEditModel); |
528 }; | 540 }; |
529 | 541 |
530 #endif // CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_EDIT_MODEL_H_ | 542 #endif // CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_EDIT_MODEL_H_ |
OLD | NEW |