OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_CONTROLLER_H_ |
6 #define CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_CONTROLLER_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "chrome/browser/autocomplete/autocomplete_controller_delegate.h" | 10 #include "chrome/browser/autocomplete/autocomplete_controller_delegate.h" |
11 | 11 |
12 class AutocompleteController; | 12 class AutocompleteController; |
| 13 struct AutocompleteMatch; |
| 14 class AutocompleteResult; |
| 15 class GURL; |
13 class OmniboxEditModel; | 16 class OmniboxEditModel; |
| 17 class OmniboxPopupModel; |
14 class Profile; | 18 class Profile; |
15 | 19 |
16 // This class sits between the OmniboxEditModel and AutocompleteController. | 20 // This class sits between the OmniboxEditModel and AutocompleteController. |
17 // TODO(beaudoin): Keep on expanding this class so that OmniboxEditModel no | 21 // TODO(beaudoin): Keep on expanding this class so that OmniboxEditModel no |
18 // longer need to hold any reference to AutocompleteController. Also make | 22 // longer need to hold any reference to AutocompleteController. Also make |
19 // this the point of contact between InstantController and OmniboxEditModel. | 23 // this the point of contact between InstantController and OmniboxEditModel. |
20 class OmniboxController : public AutocompleteControllerDelegate { | 24 class OmniboxController : public AutocompleteControllerDelegate { |
21 | 25 |
22 public: | 26 public: |
23 OmniboxController(OmniboxEditModel* omnibox_edit_model, | 27 OmniboxController(OmniboxEditModel* omnibox_edit_model, |
24 Profile* profile); | 28 Profile* profile); |
25 virtual ~OmniboxController(); | 29 virtual ~OmniboxController(); |
26 | 30 |
27 AutocompleteController* autocomplete_controller() const { | 31 AutocompleteController* autocomplete_controller() const { |
28 return autocomplete_controller_.get(); | 32 return autocomplete_controller_.get(); |
29 } | 33 } |
30 | 34 |
31 // AutocompleteControllerDelegate: | 35 // AutocompleteControllerDelegate: |
32 virtual void OnResultChanged(bool default_match_changed) OVERRIDE; | 36 virtual void OnResultChanged(bool default_match_changed) OVERRIDE; |
33 | 37 |
| 38 void set_popup_model(OmniboxPopupModel* popup_model) { |
| 39 popup_ = popup_model; |
| 40 } |
| 41 |
| 42 // TODO: The edit and popup should be siblings owned by the LocationBarView, |
| 43 // making this accessor unnecessary. |
| 44 OmniboxPopupModel* popup_model() const { return popup_; } |
| 45 |
| 46 void ClearPopupKeywordMode() const; |
| 47 |
| 48 void InfoForCurrentSelection(AutocompleteMatch* match, |
| 49 GURL* alternate_nav_url) const; |
| 50 |
| 51 const AutocompleteResult& result() const; |
| 52 |
| 53 // TODO(beaudoin): Make private once OmniboxEditModel no longer refers to it. |
| 54 void DoPreconnect(const AutocompleteMatch& match); |
| 55 |
34 private: | 56 private: |
35 // Weak, it owns us. | 57 // Weak, it owns us. |
36 // TODO(beaudoin): When we have a clearer picture of the interface between | 58 // TODO(beaudoin): When we have a clearer picture of the interface between |
37 // this and OmniboxEditModel define and use a Delegate interface instead. | 59 // this and OmniboxEditModel define and use a Delegate interface instead. |
38 OmniboxEditModel* omnibox_edit_model_; | 60 OmniboxEditModel* omnibox_edit_model_; |
39 | 61 |
| 62 Profile* profile_; |
| 63 |
| 64 OmniboxPopupModel* popup_; |
| 65 |
40 scoped_ptr<AutocompleteController> autocomplete_controller_; | 66 scoped_ptr<AutocompleteController> autocomplete_controller_; |
41 | 67 |
42 DISALLOW_COPY_AND_ASSIGN(OmniboxController); | 68 DISALLOW_COPY_AND_ASSIGN(OmniboxController); |
43 }; | 69 }; |
44 | 70 |
45 #endif // CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_CONTROLLER_H_ | 71 #endif // CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_CONTROLLER_H_ |
OLD | NEW |