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

Unified Diff: components/contextual_search/browser/contextual_search_js_api_service_impl.h

Issue 1385663002: [Contextual Search] Add Mojo-enabled API component. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added a few more missing dependencies to the new component's BUILD.gn rules for our renderer sectio… Created 5 years 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: components/contextual_search/browser/contextual_search_js_api_service_impl.h
diff --git a/components/contextual_search/browser/contextual_search_js_api_service_impl.h b/components/contextual_search/browser/contextual_search_js_api_service_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..fb44ea0806cb16d0549da692e950d1efdfae97f8
--- /dev/null
+++ b/components/contextual_search/browser/contextual_search_js_api_service_impl.h
@@ -0,0 +1,43 @@
+// Copyright 2015 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 COMPONENTS_CONTEXTUAL_SEARCH_BROWSER_CONTEXTUAL_SEARCH_JS_API_SERVICE_IMPL_H_
+#define COMPONENTS_CONTEXTUAL_SEARCH_BROWSER_CONTEXTUAL_SEARCH_JS_API_SERVICE_IMPL_H_
+
+#include "base/macros.h"
+#include "components/contextual_search/browser/contextual_search_ui_handle.h"
+#include "components/contextual_search/common/contextual_search_js_api_service.mojom.h"
+#include "mojo/public/cpp/bindings/string.h"
+#include "mojo/public/cpp/bindings/strong_binding.h"
+
+namespace contextual_search {
+
+// This is the receiving end of Contextual Search JavaScript API calls.
+class ContextualSearchJsApiServiceImpl : public ContextualSearchJsApiService {
+ public:
+ ContextualSearchJsApiServiceImpl(
+ ContextualSearchUIHandle* contextual_search_ui_handle,
+ mojo::InterfaceRequest<ContextualSearchJsApiService> request);
+ ~ContextualSearchJsApiServiceImpl() override;
+
+ // Mojo ContextualSearchApiService implementation.
+ void HandleSetCaption(const mojo::String& message, bool does_answer) override;
+
+ private:
+ mojo::StrongBinding<ContextualSearchJsApiService> binding_;
+
+ // The UI that handles calls through this API.
+ ContextualSearchUIHandle* contextual_search_ui_handle_;
+
+ DISALLOW_COPY_AND_ASSIGN(ContextualSearchJsApiServiceImpl);
+};
+
+// static
+void CreateContextualSearchJsApiService(
+ ContextualSearchUIHandle* contextual_search_ui_handle,
+ mojo::InterfaceRequest<ContextualSearchJsApiService> request);
+
+} // namespace contextual_search
+
+#endif // COMPONENTS_CONTEXTUAL_SEARCH_BROWSER_CONTEXTUAL_SEARCH_JS_API_SERVICE_IMPL_H_

Powered by Google App Engine
This is Rietveld 408576698