| 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 #include "components/contextual_search/browser/contextual_search_js_api_service_
impl.h" | 5 #include "components/contextual_search/browser/contextual_search_js_api_service_
impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 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 "mojo/public/cpp/bindings/strong_binding.h" | 10 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 11 | 11 |
| 12 namespace contextual_search { | 12 namespace contextual_search { |
| 13 | 13 |
| 14 ContextualSearchJsApiServiceImpl::ContextualSearchJsApiServiceImpl( | 14 ContextualSearchJsApiServiceImpl::ContextualSearchJsApiServiceImpl( |
| 15 ContextualSearchJsApiHandler* contextual_search_js_api_handler) | 15 ContextualSearchJsApiHandler* contextual_search_js_api_handler) |
| 16 : contextual_search_js_api_handler_(contextual_search_js_api_handler) {} | 16 : contextual_search_js_api_handler_(contextual_search_js_api_handler) {} |
| 17 | 17 |
| 18 ContextualSearchJsApiServiceImpl::~ContextualSearchJsApiServiceImpl() {} | 18 ContextualSearchJsApiServiceImpl::~ContextualSearchJsApiServiceImpl() {} |
| 19 | 19 |
| 20 void ContextualSearchJsApiServiceImpl::HandleSetCaption( | 20 void ContextualSearchJsApiServiceImpl::HandleSetCaption( |
| 21 const mojo::String& caption, | 21 const std::string& caption, |
| 22 bool does_answer) { | 22 bool does_answer) { |
| 23 contextual_search_js_api_handler_->SetCaption(caption, does_answer); | 23 contextual_search_js_api_handler_->SetCaption(caption, does_answer); |
| 24 } | 24 } |
| 25 | 25 |
| 26 // static | 26 // static |
| 27 void CreateContextualSearchJsApiService( | 27 void CreateContextualSearchJsApiService( |
| 28 ContextualSearchJsApiHandler* contextual_search_js_api_handler, | 28 ContextualSearchJsApiHandler* contextual_search_js_api_handler, |
| 29 mojo::InterfaceRequest<mojom::ContextualSearchJsApiService> request) { | 29 mojo::InterfaceRequest<mojom::ContextualSearchJsApiService> request) { |
| 30 mojo::MakeStrongBinding(base::MakeUnique<ContextualSearchJsApiServiceImpl>( | 30 mojo::MakeStrongBinding(base::MakeUnique<ContextualSearchJsApiServiceImpl>( |
| 31 contextual_search_js_api_handler), | 31 contextual_search_js_api_handler), |
| 32 std::move(request)); | 32 std::move(request)); |
| 33 } | 33 } |
| 34 | 34 |
| 35 } // namespace contextual_search | 35 } // namespace contextual_search |
| OLD | NEW |