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
3 // found in the LICENSE file.
5 #include "chrome/browser/chromeos/extensions/launcher_search_provider.h"
7 #include "base/memory/scoped_ptr.h"
8 #include "chrome/browser/chromeos/launcher_search_provider/error_reporter.h"
9 #include "chrome/browser/chromeos/launcher_search_provider/launcher_search_provider_service.h"
10 #include "chrome/common/extensions/api/launcher_search_provider.h"
11 #include "content/public/browser/render_frame_host.h"
13 namespace extensions
{
15 LauncherSearchProviderSetSearchResultsFunction::
16 ~LauncherSearchProviderSetSearchResultsFunction() {
19 bool LauncherSearchProviderSetSearchResultsFunction::RunSync() {
20 using chromeos::launcher_search_provider::ErrorReporter
;
21 using chromeos::launcher_search_provider::Service
;
22 using extensions::api::launcher_search_provider::SetSearchResults::Params
;
23 const scoped_ptr
<Params
> params(Params::Create(*args_
));
24 EXTENSION_FUNCTION_VALIDATE(params
);
25 DCHECK(render_frame_host());
27 scoped_ptr
<ErrorReporter
> error_reporter(
28 new ErrorReporter(render_frame_host()));
29 Service
* const service
= Service::Get(GetProfile());
30 service
->SetSearchResults(extension(), error_reporter
.Pass(),
31 params
->query_id
, params
->results
);
36 } // namespace extensions