Chromium Code Reviews| 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/basictypes.h" | |
| 8 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 9 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 10 #include "chrome/browser/autocomplete/autocomplete_controller_delegate.h" | 11 #include "chrome/browser/autocomplete/autocomplete_controller_delegate.h" |
| 11 | 12 |
| 12 class AutocompleteController; | 13 class AutocompleteController; |
| 14 struct AutocompleteMatch; | |
| 15 class AutocompleteResult; | |
| 16 class GURL; | |
| 13 class OmniboxEditModel; | 17 class OmniboxEditModel; |
| 18 class OmniboxPopupModel; | |
| 14 class Profile; | 19 class Profile; |
| 15 | 20 |
| 16 // This class controls the various services that can modify the content | 21 // This class controls the various services that can modify the content |
| 17 // for the omnibox, including AutocompleteController and InstantController. It | 22 // for the omnibox, including AutocompleteController and InstantController. It |
| 18 // is responsible of updating the omnibox content. | 23 // is responsible of updating the omnibox content. |
| 19 // TODO(beaudoin): Keep on expanding this class so that OmniboxEditModel no | 24 // TODO(beaudoin): Keep on expanding this class so that OmniboxEditModel no |
| 20 // longer needs to hold any reference to AutocompleteController. Also make | 25 // longer needs to hold any reference to AutocompleteController. Also make |
| 21 // this the point of contact between InstantController and OmniboxEditModel. | 26 // this the point of contact between InstantController and OmniboxEditModel. |
| 22 // As the refactor progresses, keep the class comment up-to-date to | 27 // As the refactor progresses, keep the class comment up-to-date to |
| 23 // precisely explain what this class is doing. | 28 // precisely explain what this class is doing. |
| 24 class OmniboxController : public AutocompleteControllerDelegate { | 29 class OmniboxController : public AutocompleteControllerDelegate { |
| 25 | 30 |
| 26 public: | 31 public: |
| 27 OmniboxController(OmniboxEditModel* omnibox_edit_model, Profile* profile); | 32 OmniboxController(OmniboxEditModel* omnibox_edit_model, Profile* profile); |
| 28 virtual ~OmniboxController(); | 33 virtual ~OmniboxController(); |
| 29 | 34 |
| 30 // AutocompleteControllerDelegate: | 35 // AutocompleteControllerDelegate: |
| 31 virtual void OnResultChanged(bool default_match_changed) OVERRIDE; | 36 virtual void OnResultChanged(bool default_match_changed) OVERRIDE; |
| 32 | 37 |
| 33 AutocompleteController* autocomplete_controller() { | 38 AutocompleteController* autocomplete_controller() { |
| 34 return autocomplete_controller_.get(); | 39 return autocomplete_controller_.get(); |
| 35 } | 40 } |
| 36 | 41 |
| 42 void set_popup_model(OmniboxPopupModel* popup_model) { | |
| 43 popup_ = popup_model; | |
| 44 } | |
| 45 | |
| 46 // TODO: The edit and popup should be siblings owned by the LocationBarView, | |
|
Mathieu
2013/05/03 19:09:02
nit: the edit and popup what? be clearer, as it co
beaudoin
2013/05/04 03:06:51
Done.
| |
| 47 // making this accessor unnecessary. | |
| 48 OmniboxPopupModel* popup_model() const { return popup_; } | |
| 49 | |
| 50 // Turns off keyword mode for the current match. | |
| 51 void ClearPopupKeywordMode() const; | |
| 52 | |
| 53 void InfoForCurrentSelection(AutocompleteMatch* match, | |
| 54 GURL* alternate_nav_url) const; | |
| 55 | |
| 56 const AutocompleteResult& result() const; | |
| 57 | |
| 58 // TODO(beaudoin): Make private once OmniboxEditModel no longer refers to it. | |
| 59 void DoPreconnect(const AutocompleteMatch& match); | |
| 60 | |
| 37 private: | 61 private: |
| 38 // Weak, it owns us. | 62 // Weak, it owns us. |
| 39 // TODO(beaudoin): Consider defining a delegate to ease unit testing. | 63 // TODO(beaudoin): Consider defining a delegate to ease unit testing. |
| 40 OmniboxEditModel* omnibox_edit_model_; | 64 OmniboxEditModel* omnibox_edit_model_; |
| 41 | 65 |
| 66 Profile* profile_; | |
| 67 | |
| 68 OmniboxPopupModel* popup_; | |
| 69 | |
| 42 scoped_ptr<AutocompleteController> autocomplete_controller_; | 70 scoped_ptr<AutocompleteController> autocomplete_controller_; |
| 43 | 71 |
| 44 DISALLOW_COPY_AND_ASSIGN(OmniboxController); | 72 DISALLOW_COPY_AND_ASSIGN(OmniboxController); |
| 45 }; | 73 }; |
| 46 | 74 |
| 47 #endif // CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_CONTROLLER_H_ | 75 #endif // CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_CONTROLLER_H_ |
| OLD | NEW |