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

Unified Diff: chrome/renderer/searchbox/searchbox.h

Issue 2086223002: Convert instant search messages to Mojo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge Created 4 years, 2 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/renderer/searchbox/searchbox.h
diff --git a/chrome/renderer/searchbox/searchbox.h b/chrome/renderer/searchbox/searchbox.h
index 51ea59bb096b63acc9cffecc9c6d8d46b8573b40..0eed8f9eec3b0a3fdac422c33226d46b93cc3a88 100644
--- a/chrome/renderer/searchbox/searchbox.h
+++ b/chrome/renderer/searchbox/searchbox.h
@@ -10,12 +10,14 @@
#include "base/macros.h"
#include "base/strings/string16.h"
+#include "chrome/common/instant.mojom.h"
#include "chrome/common/search/instant_types.h"
#include "chrome/common/search/ntp_logging_events.h"
#include "chrome/renderer/instant_restricted_id_cache.h"
#include "components/omnibox/common/omnibox_focus_state.h"
#include "content/public/renderer/render_view_observer.h"
#include "content/public/renderer/render_view_observer_tracker.h"
+#include "mojo/public/cpp/bindings/associated_binding.h"
#include "ui/base/window_open_disposition.h"
#include "url/gurl.h"
@@ -24,7 +26,8 @@ class RenderView;
}
class SearchBox : public content::RenderViewObserver,
- public content::RenderViewObserverTracker<SearchBox> {
+ public content::RenderViewObserverTracker<SearchBox>,
+ public chrome::mojom::SearchBox {
public:
enum ImageSourceType {
NONE = -1,
@@ -50,22 +53,22 @@ class SearchBox : public content::RenderViewObserver,
explicit SearchBox(content::RenderView* render_view);
~SearchBox() override;
- // Sends ChromeViewHostMsg_LogEvent to the browser.
+ // Sends LogEvent to the browser.
void LogEvent(NTPLoggingEventType event);
- // Sends ChromeViewHostMsg_LogMostVisitedImpression to the browser.
+ // Sends LogMostVisitedImpression to the browser.
void LogMostVisitedImpression(int position, NTPLoggingTileSource tile_source);
- // Sends ChromeViewHostMsg_LogMostVisitedNavigation to the browser.
+ // Sends LogMostVisitedNavigation to the browser.
void LogMostVisitedNavigation(int position, NTPLoggingTileSource tile_source);
- // Sends ChromeViewHostMsg_ChromeIdentityCheck to the browser.
+ // Sends ChromeIdentityCheck to the browser.
void CheckIsUserSignedInToChromeAs(const base::string16& identity);
- // Sends ChromeViewHostMsg_HistorySyncCheck to the browser.
+ // Sends HistorySyncCheck to the browser.
void CheckIsUserSyncingHistory();
- // Sends ChromeViewHostMsg_SearchBoxDeleteMostVisitedItem to the browser.
+ // Sends SearchBoxDeleteMostVisitedItem to the browser.
void DeleteMostVisitedItem(InstantRestrictedID most_visited_item_id);
// Generates the image URL of |type| for the most visited item specified in
@@ -107,7 +110,7 @@ class SearchBox : public content::RenderViewObserver,
bool GetMostVisitedItemWithID(InstantRestrictedID most_visited_item_id,
InstantMostVisitedItem* item) const;
- // Sends ChromeViewHostMsg_SearchBoxPaste to the browser.
+ // Sends SearchBoxPaste to the browser.
void Paste(const base::string16& text);
const ThemeBackgroundInfo& GetThemeBackgroundInfo();
@@ -119,11 +122,11 @@ class SearchBox : public content::RenderViewObserver,
// Sends ChromeViewHostMsg_StopCapturingKeyStrokes to the browser.
Marc Treib 2016/10/13 09:04:50 nit: Missed two ChromeViewHostMsg here
tibell 2016/10/13 23:29:44 These are different messages not part of the searc
Marc Treib 2016/10/14 08:58:21 But this class doesn't (directly) send them anymor
void StopCapturingKeyStrokes();
- // Sends ChromeViewHostMsg_SearchBoxUndoAllMostVisitedDeletions to the
+ // Sends SearchBoxUndoAllMostVisitedDeletions to the
// browser.
Marc Treib 2016/10/13 09:04:50 nit: fits on previous line
tibell 2016/10/13 23:29:44 Done.
void UndoAllMostVisitedDeletions();
- // Sends ChromeViewHostMsg_SearchBoxUndoMostVisitedDeletion to the browser.
+ // Sends SearchBoxUndoMostVisitedDeletion to the browser.
void UndoMostVisitedDeletion(InstantRestrictedID most_visited_item_id);
bool is_focused() const { return is_focused_; }
@@ -134,23 +137,23 @@ class SearchBox : public content::RenderViewObserver,
private:
// Overridden from content::RenderViewObserver:
- bool OnMessageReceived(const IPC::Message& message) override;
void OnDestruct() override;
- void OnSetPageSequenceNumber(int page_seq_no);
- void OnChromeIdentityCheckResult(const base::string16& identity,
- bool identity_match);
- void OnDetermineIfPageSupportsInstant();
- void OnFocusChanged(OmniboxFocusState new_focus_state,
- OmniboxFocusChangeReason reason);
- void OnHistorySyncCheckResult(bool sync_history);
- void OnMostVisitedChanged(
- const std::vector<InstantMostVisitedItem>& items);
- void OnSetInputInProgress(bool input_in_progress);
- void OnSetSuggestionToPrefetch(const InstantSuggestion& suggestion);
- void OnSubmit(const base::string16& query,
- const EmbeddedSearchRequestParams& params);
- void OnThemeChanged(const ThemeBackgroundInfo& theme_info);
+ // Overridden from chrome::mojom::SearchBox:
+ void SetPageSequenceNumber(int page_seq_no) override;
+ void ChromeIdentityCheckResult(const base::string16& identity,
+ bool identity_match) override;
+ void DetermineIfPageSupportsInstant() override;
+ void FocusChanged(OmniboxFocusState new_focus_state,
+ OmniboxFocusChangeReason reason) override;
+ void HistorySyncCheckResult(bool sync_history) override;
+ void MostVisitedChanged(
+ const std::vector<InstantMostVisitedItem>& items) override;
+ void SetInputInProgress(bool input_in_progress) override;
+ void SetSuggestionToPrefetch(const InstantSuggestion& suggestion) override;
+ void Submit(const base::string16& query,
+ const EmbeddedSearchRequestParams& params) override;
+ void ThemeChanged(const ThemeBackgroundInfo& theme_info) override;
// Returns the current zoom factor of the render view or 1 on failure.
double GetZoom() const;
@@ -161,6 +164,8 @@ class SearchBox : public content::RenderViewObserver,
// Returns the URL of the Most Visited item specified by the |item_id|.
GURL GetURLForMostVisitedItem(InstantRestrictedID item_id) const;
+ void Bind(chrome::mojom::SearchBoxAssociatedRequest request);
+
int page_seq_no_;
bool is_focused_;
bool is_input_in_progress_;
@@ -170,6 +175,8 @@ class SearchBox : public content::RenderViewObserver,
base::string16 query_;
EmbeddedSearchRequestParams embedded_search_request_params_;
InstantSuggestion suggestion_;
+ chrome::mojom::InstantAssociatedPtr instant_service_;
+ mojo::AssociatedBinding<chrome::mojom::SearchBox> binding_;
DISALLOW_COPY_AND_ASSIGN(SearchBox);
};

Powered by Google App Engine
This is Rietveld 408576698