Chromium Code Reviews| Index: chrome/browser/ui/omnibox/omnibox_controller.h |
| diff --git a/chrome/browser/ui/omnibox/omnibox_controller.h b/chrome/browser/ui/omnibox/omnibox_controller.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..cfd2fc705936d9f7ebd2065910d9f53419d9187c |
| --- /dev/null |
| +++ b/chrome/browser/ui/omnibox/omnibox_controller.h |
| @@ -0,0 +1,45 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_CONTROLLER_H_ |
| +#define CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_CONTROLLER_H_ |
| + |
| +#include "base/basictypes.h" |
|
Peter Kasting
2013/04/25 18:24:55
Is this #include needed?
beaudoin
2013/04/25 19:14:57
Gone. Done.
|
| +#include "base/compiler_specific.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "chrome/browser/autocomplete/autocomplete_controller_delegate.h" |
| + |
| +class AutocompleteController; |
| +class OmniboxEditModel; |
| +class Profile; |
| + |
| +// This class sits between the OmniboxEditModel and AutocompleteController. |
|
Peter Kasting
2013/04/25 18:24:55
Nit: This comment isn't really informative about w
beaudoin
2013/04/25 20:34:51
I was torn between describing what this class will
|
| +// TODO(beaudoin): Keep on expanding this class so that OmniboxEditModel no |
| +// longer needs to hold any reference to AutocompleteController. Also make |
| +// this the point of contact between InstantController and OmniboxEditModel. |
| +class OmniboxController : public AutocompleteControllerDelegate { |
| + |
| + public: |
| + OmniboxController(OmniboxEditModel* omnibox_edit_model, Profile* profile); |
| + virtual ~OmniboxController(); |
| + |
| + AutocompleteController* autocomplete_controller() const { |
|
Peter Kasting
2013/04/25 18:24:55
Const methods must not return non-const pointers.
beaudoin
2013/04/25 20:34:51
The exact same method is defined in omnibox_edit_m
Peter Kasting
2013/04/25 20:52:09
I'd probably skip the TODO. I doubt we can avoid
beaudoin
2013/04/25 23:51:33
Done.
|
| + return autocomplete_controller_.get(); |
| + } |
| + |
| + // AutocompleteControllerDelegate: |
|
Peter Kasting
2013/04/25 18:24:55
I suggest putting overrides above non-overrides.
beaudoin
2013/04/25 20:34:51
Done.
|
| + virtual void OnResultChanged(bool default_match_changed) OVERRIDE; |
| + |
| + private: |
| + // Weak, it owns us. |
| + // TODO(beaudoin): When we have a clearer picture of the interface between |
| + // this and OmniboxEditModel define and use a Delegate interface instead. |
|
Peter Kasting
2013/04/25 18:24:55
Why? Is there a real win in defining such an inte
beaudoin
2013/04/25 20:34:51
Such an interface may make unit tests easier. In t
Peter Kasting
2013/04/25 20:52:09
Ah. That's a reasonable justification. Maybe jus
|
| + OmniboxEditModel* omnibox_edit_model_; |
| + |
| + scoped_ptr<AutocompleteController> autocomplete_controller_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(OmniboxController); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_CONTROLLER_H_ |