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

Unified Diff: chrome/browser/ui/webui/omnibox/omnibox_ui_handler.h

Issue 222543004: Makes chrome://omnibox use mojo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: get working with mojo changes 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/omnibox/omnibox_ui_handler.h
diff --git a/chrome/browser/ui/webui/omnibox/omnibox_ui_handler.h b/chrome/browser/ui/webui/omnibox/omnibox_ui_handler.h
index de477f1b3ea77bb7754cca3db48f2283b8efa79c..9538110820ae35949e34d56c8cdd6b0d1dea52ec 100644
--- a/chrome/browser/ui/webui/omnibox/omnibox_ui_handler.h
+++ b/chrome/browser/ui/webui/omnibox/omnibox_ui_handler.h
@@ -12,62 +12,35 @@
#include "chrome/browser/autocomplete/autocomplete_controller_delegate.h"
#include "chrome/browser/autocomplete/autocomplete_input.h"
#include "chrome/browser/autocomplete/autocomplete_match.h"
-#include "content/public/browser/web_ui_message_handler.h"
+#include "chrome/browser/ui/webui/mojo_web_ui_handler.h"
+#include "chrome/browser/ui/webui/omnibox/omnibox.mojom.h"
+#include "mojo/public/cpp/bindings/remote_ptr.h"
class AutocompleteController;
class Profile;
-namespace base {
-class ListValue;
-}
-
-// UI Handler for chrome://omnibox/
-// It listens for calls from javascript to StartOmniboxQuery() and
-// passes those calls to its private AutocompleteController. It also
-// listens for updates from the AutocompleteController to OnResultChanged()
-// and passes those results on calling back into the Javascript to
-// update the page.
+// Implementation of OmniboxUIHandlerMojo. StartOmniboxQuery() calls to a
+// private AutocompleteController. It also listens for updates from the
+// AutocompleteController to OnResultChanged() and passes those results to
+// the OmniboxPage.
class OmniboxUIHandler : public AutocompleteControllerDelegate,
- public content::WebUIMessageHandler {
+ public OmniboxUIHandlerMojo,
+ public MojoWebUIHandler {
public:
- explicit OmniboxUIHandler(Profile* profile);
+ OmniboxUIHandler(ScopedOmniboxPageHandle handle, Profile* profile);
virtual ~OmniboxUIHandler();
- // AutocompleteControllerDelegate implementation.
- // Gets called when the result set of the AutocompleteController changes.
- // We transform the AutocompleteResult into a Javascript object and
- // call the Javascript function gotNewAutocompleteResult with it.
- // |default_match_changed| is given to us by the AutocompleteController
- // but we don't need it. It's ignored.
+ // AutocompleteControllerDelegate overrides:
virtual void OnResultChanged(bool default_match_changed) OVERRIDE;
- protected:
- // WebUIMessageHandler implementation.
- // Register our handler to get callbacks from javascript for
- // startOmniboxQuery().
- virtual void RegisterMessages() OVERRIDE;
+ // OmniboxUIHandlerMojo overrides:
+ virtual void StartOmniboxQuery(const mojo::String& input_string,
+ int32_t cursor_position,
+ bool prevent_inline_autocomplete,
+ bool prefer_keyword,
+ int32_t page_classification) OVERRIDE;
private:
- // Gets called from the javascript when a user enters text into the
- // chrome://omnibox/ text box and clicks submit or hits enter.
- // |input| is expected to be a four-element list:
- // - first element: input string.
- // - second element: the cursor position.
- // - third element: boolean indicating whether we should set
- // prevent_inline_autocomplete or not.
- // - fourth element: boolean indicating whether we should set prefer_keyword
- // - fifth element: current page classification value (enum
- // PageClassification from omnibox_event.proto)
- void StartOmniboxQuery(const base::ListValue* input);
-
- // Helper function for OnResultChanged().
- // Takes an iterator over AutocompleteMatches and packages them into
- // the DictionaryValue output, all stored under the given prefix.
- void AddResultToDictionary(const std::string& prefix,
- ACMatches::const_iterator result_it,
- ACMatches::const_iterator end,
- base::DictionaryValue* output);
-
// Looks up whether the hostname is a typed host (i.e., has received
// typed visits). Return true if the lookup succeeded; if so, the
// value of |is_typed_host| is set appropriately.
@@ -77,6 +50,8 @@ class OmniboxUIHandler : public AutocompleteControllerDelegate,
// next query.
void ResetController();
+ mojo::RemotePtr<OmniboxPage> page_;
+
// The omnibox AutocompleteController that collects/sorts/dup-
// eliminates the results as they come in.
scoped_ptr<AutocompleteController> controller_;
« no previous file with comments | « chrome/browser/ui/webui/omnibox/omnibox_ui.cc ('k') | chrome/browser/ui/webui/omnibox/omnibox_ui_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698