OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 COMPONENTS_CONTEXTUAL_SEARCH_BROWSER_CONTEXTUAL_SEARCH_JS_API_SERVICE_IM
PL_H_ | 5 #ifndef COMPONENTS_CONTEXTUAL_SEARCH_BROWSER_CONTEXTUAL_SEARCH_JS_API_SERVICE_IM
PL_H_ |
6 #define COMPONENTS_CONTEXTUAL_SEARCH_BROWSER_CONTEXTUAL_SEARCH_JS_API_SERVICE_IM
PL_H_ | 6 #define COMPONENTS_CONTEXTUAL_SEARCH_BROWSER_CONTEXTUAL_SEARCH_JS_API_SERVICE_IM
PL_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "components/contextual_search/browser/contextual_search_js_api_handler.
h" | 9 #include "components/contextual_search/browser/contextual_search_js_api_handler.
h" |
10 #include "components/contextual_search/common/contextual_search_js_api_service.m
ojom.h" | 10 #include "components/contextual_search/common/contextual_search_js_api_service.m
ojom.h" |
11 #include "mojo/public/cpp/bindings/string.h" | 11 #include "mojo/public/cpp/bindings/string.h" |
12 #include "mojo/public/cpp/bindings/strong_binding.h" | |
13 | 12 |
14 namespace contextual_search { | 13 namespace contextual_search { |
15 | 14 |
16 // This is the receiving end of Contextual Search JavaScript API calls. | 15 // This is the receiving end of Contextual Search JavaScript API calls. |
17 class ContextualSearchJsApiServiceImpl | 16 class ContextualSearchJsApiServiceImpl |
18 : public mojom::ContextualSearchJsApiService { | 17 : public mojom::ContextualSearchJsApiService { |
19 public: | 18 public: |
20 ContextualSearchJsApiServiceImpl( | 19 explicit ContextualSearchJsApiServiceImpl( |
21 ContextualSearchJsApiHandler* contextual_search_js_api_handler, | 20 ContextualSearchJsApiHandler* contextual_search_js_api_handler); |
22 mojo::InterfaceRequest<mojom::ContextualSearchJsApiService> request); | |
23 ~ContextualSearchJsApiServiceImpl() override; | 21 ~ContextualSearchJsApiServiceImpl() override; |
24 | 22 |
25 // Mojo ContextualSearchApiService implementation. | 23 // Mojo ContextualSearchApiService implementation. |
26 void HandleSetCaption(const mojo::String& message, bool does_answer) override; | 24 void HandleSetCaption(const mojo::String& message, bool does_answer) override; |
27 | 25 |
28 private: | 26 private: |
29 mojo::StrongBinding<mojom::ContextualSearchJsApiService> binding_; | |
30 | |
31 // The UI handler for calls through the JavaScript API. | 27 // The UI handler for calls through the JavaScript API. |
32 ContextualSearchJsApiHandler* contextual_search_js_api_handler_; | 28 ContextualSearchJsApiHandler* contextual_search_js_api_handler_; |
33 | 29 |
34 DISALLOW_COPY_AND_ASSIGN(ContextualSearchJsApiServiceImpl); | 30 DISALLOW_COPY_AND_ASSIGN(ContextualSearchJsApiServiceImpl); |
35 }; | 31 }; |
36 | 32 |
37 // static | 33 // static |
38 void CreateContextualSearchJsApiService( | 34 void CreateContextualSearchJsApiService( |
39 ContextualSearchJsApiHandler* contextual_search_js_api_handler, | 35 ContextualSearchJsApiHandler* contextual_search_js_api_handler, |
40 mojo::InterfaceRequest<mojom::ContextualSearchJsApiService> request); | 36 mojo::InterfaceRequest<mojom::ContextualSearchJsApiService> request); |
41 | 37 |
42 } // namespace contextual_search | 38 } // namespace contextual_search |
43 | 39 |
44 #endif // COMPONENTS_CONTEXTUAL_SEARCH_BROWSER_CONTEXTUAL_SEARCH_JS_API_SERVICE
_IMPL_H_ | 40 #endif // COMPONENTS_CONTEXTUAL_SEARCH_BROWSER_CONTEXTUAL_SEARCH_JS_API_SERVICE
_IMPL_H_ |
OLD | NEW |