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

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

Issue 232023004: Ensures the autocomplete_controller input is saved and restored when changing tabs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed broken browser test. Created 6 years, 8 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
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/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/strings/string16.h" 11 #include "base/strings/string16.h"
12 #include "chrome/browser/autocomplete/autocomplete_controller.h" 12 #include "chrome/browser/autocomplete/autocomplete_controller.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_input.h" 14 #include "chrome/browser/autocomplete/autocomplete_input.h"
15 #include "chrome/browser/autocomplete/autocomplete_match.h" 15 #include "chrome/browser/autocomplete/autocomplete_match.h"
16 16
17 struct AutocompleteMatch; 17 struct AutocompleteMatch;
18 class AutocompleteResult; 18 class AutocompleteResult;
19 class GURL;
20 class InstantController; 19 class InstantController;
21 class OmniboxEditModel; 20 class OmniboxEditModel;
22 class OmniboxPopupModel; 21 class OmniboxPopupModel;
23 class Profile; 22 class Profile;
24 23
25 namespace gfx { 24 namespace gfx {
26 class Rect; 25 class Rect;
27 } 26 }
28 27
29 // This class controls the various services that can modify the content 28 // This class controls the various services that can modify the content
30 // for the omnibox, including AutocompleteController and InstantController. It 29 // for the omnibox, including AutocompleteController and InstantController. It
31 // is responsible of updating the omnibox content. 30 // is responsible of updating the omnibox content.
32 // TODO(beaudoin): Keep on expanding this class so that OmniboxEditModel no 31 // TODO(beaudoin): Keep on expanding this class so that OmniboxEditModel no
33 // longer needs to hold any reference to AutocompleteController. Also make 32 // longer needs to hold any reference to AutocompleteController. Also make
34 // this the point of contact between InstantController and OmniboxEditModel. 33 // this the point of contact between InstantController and OmniboxEditModel.
35 // As the refactor progresses, keep the class comment up-to-date to 34 // As the refactor progresses, keep the class comment up-to-date to
36 // precisely explain what this class is doing. 35 // precisely explain what this class is doing.
37 class OmniboxController : public AutocompleteControllerDelegate { 36 class OmniboxController : public AutocompleteControllerDelegate {
38 public: 37 public:
39 OmniboxController(OmniboxEditModel* omnibox_edit_model, 38 OmniboxController(OmniboxEditModel* omnibox_edit_model,
40 Profile* profile); 39 Profile* profile);
41 virtual ~OmniboxController(); 40 virtual ~OmniboxController();
42 41
43 // |current_url| is only set for mobile ports. 42 // The |current_url| field of input is only set for mobile ports.
44 void StartAutocomplete( 43 void StartAutocomplete(const AutocompleteInput& input) const;
45 base::string16 user_text,
46 size_t cursor_position,
47 const GURL& current_url,
48 AutocompleteInput::PageClassification current_page_classification,
49 bool prevent_inline_autocomplete,
50 bool prefer_keyword,
51 bool allow_exact_keyword_match) const;
52 44
53 // AutocompleteControllerDelegate: 45 // AutocompleteControllerDelegate:
54 virtual void OnResultChanged(bool default_match_changed) OVERRIDE; 46 virtual void OnResultChanged(bool default_match_changed) OVERRIDE;
55 47
56 AutocompleteController* autocomplete_controller() { 48 AutocompleteController* autocomplete_controller() {
57 return autocomplete_controller_.get(); 49 return autocomplete_controller_.get();
58 } 50 }
59 51
60 // Set |current_match_| to an invalid value, indicating that we do not yet 52 // Set |current_match_| to an invalid value, indicating that we do not yet
61 // have a valid match for the current text in the omnibox. 53 // have a valid match for the current text in the omnibox.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 // TODO(beaudoin): This AutocompleteMatch is used to let the OmniboxEditModel 87 // TODO(beaudoin): This AutocompleteMatch is used to let the OmniboxEditModel
96 // know what it should display. Not every field is required for that purpose, 88 // know what it should display. Not every field is required for that purpose,
97 // but the ones specifically needed are unclear. We should therefore spend 89 // but the ones specifically needed are unclear. We should therefore spend
98 // some time to extract these fields and use a tighter structure here. 90 // some time to extract these fields and use a tighter structure here.
99 AutocompleteMatch current_match_; 91 AutocompleteMatch current_match_;
100 92
101 DISALLOW_COPY_AND_ASSIGN(OmniboxController); 93 DISALLOW_COPY_AND_ASSIGN(OmniboxController);
102 }; 94 };
103 95
104 #endif // CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_CONTROLLER_H_ 96 #endif // CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_CONTROLLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_controller.h ('k') | chrome/browser/ui/omnibox/omnibox_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698