Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Side by Side Diff: chrome/browser/ui/omnibox/omnibox_controller.h

Issue 14358005: Omnibox refactor, moved OnResultChanged to OmniboxController (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed nits. Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/omnibox/omnibox_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "chrome/browser/autocomplete/autocomplete_controller.h"
10 #include "chrome/browser/autocomplete/autocomplete_controller_delegate.h" 12 #include "chrome/browser/autocomplete/autocomplete_controller_delegate.h"
11 13
12 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
21 namespace gfx {
22 class Rect;
23 }
24
16 // This class controls the various services that can modify the content 25 // This class controls the various services that can modify the content
17 // for the omnibox, including AutocompleteController and InstantController. It 26 // for the omnibox, including AutocompleteController and InstantController. It
18 // is responsible of updating the omnibox content. 27 // is responsible of updating the omnibox content.
19 // TODO(beaudoin): Keep on expanding this class so that OmniboxEditModel no 28 // TODO(beaudoin): Keep on expanding this class so that OmniboxEditModel no
20 // longer needs to hold any reference to AutocompleteController. Also make 29 // longer needs to hold any reference to AutocompleteController. Also make
21 // this the point of contact between InstantController and OmniboxEditModel. 30 // this the point of contact between InstantController and OmniboxEditModel.
22 // As the refactor progresses, keep the class comment up-to-date to 31 // As the refactor progresses, keep the class comment up-to-date to
23 // precisely explain what this class is doing. 32 // precisely explain what this class is doing.
24 class OmniboxController : public AutocompleteControllerDelegate { 33 class OmniboxController : public AutocompleteControllerDelegate {
25 34
26 public: 35 public:
27 OmniboxController(OmniboxEditModel* omnibox_edit_model, Profile* profile); 36 OmniboxController(OmniboxEditModel* omnibox_edit_model, Profile* profile);
28 virtual ~OmniboxController(); 37 virtual ~OmniboxController();
29 38
30 // AutocompleteControllerDelegate: 39 // AutocompleteControllerDelegate:
31 virtual void OnResultChanged(bool default_match_changed) OVERRIDE; 40 virtual void OnResultChanged(bool default_match_changed) OVERRIDE;
32 41
33 AutocompleteController* autocomplete_controller() { 42 AutocompleteController* autocomplete_controller() {
34 return autocomplete_controller_.get(); 43 return autocomplete_controller_.get();
35 } 44 }
36 45
46 void set_popup_model(OmniboxPopupModel* popup_model) {
47 popup_ = popup_model;
48 }
49
50 // TODO(beaudoin): The edit and popup model should be siblings owned by the
51 // LocationBarView, making this accessor unnecessary.
52 OmniboxPopupModel* popup_model() const { return popup_; }
53
54 // Turns off keyword mode for the current match.
55 void ClearPopupKeywordMode() const;
56
57 const AutocompleteResult& result() const {
58 return autocomplete_controller_->result();
59 }
60
61 // TODO(beaudoin): Make private once OmniboxEditModel no longer refers to it.
62 void DoPreconnect(const AutocompleteMatch& match);
63
64 // TODO(beaudoin): Make private once OmniboxEditModel no longer refers to it.
65 // Invoked when the popup has changed its bounds to |bounds|. |bounds| here
66 // is in screen coordinates.
67 void OnPopupBoundsChanged(const gfx::Rect& bounds);
68
37 private: 69 private:
38 // Weak, it owns us. 70 // Weak, it owns us.
39 // TODO(beaudoin): Consider defining a delegate to ease unit testing. 71 // TODO(beaudoin): Consider defining a delegate to ease unit testing.
40 OmniboxEditModel* omnibox_edit_model_; 72 OmniboxEditModel* omnibox_edit_model_;
41 73
74 Profile* profile_;
75
76 OmniboxPopupModel* popup_;
77
42 scoped_ptr<AutocompleteController> autocomplete_controller_; 78 scoped_ptr<AutocompleteController> autocomplete_controller_;
43 79
44 DISALLOW_COPY_AND_ASSIGN(OmniboxController); 80 DISALLOW_COPY_AND_ASSIGN(OmniboxController);
45 }; 81 };
46 82
47 #endif // CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_CONTROLLER_H_ 83 #endif // CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_CONTROLLER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/omnibox/omnibox_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698