Chromium Code Reviews| 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 "chrome/browser/chromeos/extensions/launcher_search_provider.h" | 5 #include "chrome/browser/chromeos/extensions/launcher_search_provider.h" |
| 6 | 6 |
| 7 #include "chrome/browser/chromeos/launcher_search_provider/error_reporter.h" | |
| 7 #include "chrome/browser/chromeos/launcher_search_provider/service.h" | 8 #include "chrome/browser/chromeos/launcher_search_provider/service.h" |
| 8 #include "chrome/common/extensions/api/launcher_search_provider.h" | 9 #include "chrome/common/extensions/api/launcher_search_provider.h" |
| 10 #include "content/public/browser/render_frame_host.h" | |
| 11 #include "content/public/browser/render_view_host.h" | |
| 9 | 12 |
| 10 namespace extensions { | 13 namespace extensions { |
| 11 | 14 |
| 12 LauncherSearchProviderSetSearchResultsFunction:: | 15 LauncherSearchProviderSetSearchResultsFunction:: |
| 13 ~LauncherSearchProviderSetSearchResultsFunction() { | 16 ~LauncherSearchProviderSetSearchResultsFunction() { |
| 14 } | 17 } |
| 15 | 18 |
| 16 bool LauncherSearchProviderSetSearchResultsFunction::RunSync() { | 19 bool LauncherSearchProviderSetSearchResultsFunction::RunSync() { |
|
Matt Giuca
2015/04/24 04:26:46
I think this is getting complex enough that it rea
yawano
2015/04/28 12:11:27
LauncherSearchProvider API has no test at now. Whi
Matt Giuca
2015/04/30 01:34:08
I think writing a unit test for ExtensionBadgedIco
yawano
2015/04/30 03:38:52
I'm going to move the patch set 6 to different CL.
| |
| 17 using chromeos::launcher_search_provider::Service; | 20 using chromeos::launcher_search_provider::Service; |
| 18 using extensions::api::launcher_search_provider::SetSearchResults::Params; | 21 using extensions::api::launcher_search_provider::SetSearchResults::Params; |
| 19 const scoped_ptr<Params> params(Params::Create(*args_)); | 22 const scoped_ptr<Params> params(Params::Create(*args_)); |
| 20 EXTENSION_FUNCTION_VALIDATE(params); | 23 EXTENSION_FUNCTION_VALIDATE(params); |
| 21 | 24 |
| 25 // Either render_view_host or render_frame_host will be set. See | |
| 26 // crbug.com/304341. | |
| 27 IPC::Sender* sender = nullptr; | |
| 28 int routing_id = 0; | |
| 29 if (render_view_host()) { | |
| 30 sender = render_view_host(); | |
| 31 routing_id = render_view_host()->GetRoutingID(); | |
| 32 } else { | |
| 33 sender = render_frame_host(); | |
| 34 routing_id = render_frame_host()->GetRoutingID(); | |
| 35 } | |
| 36 CHECK(sender); | |
|
satorux1
2015/04/24 01:31:18
CHECK -> DCHECK
yawano
2015/05/01 06:09:54
Done.
| |
| 37 | |
| 38 chromeos::launcher_search_provider::ErrorReporter error_reporter(sender, | |
|
Matt Giuca
2015/04/24 04:26:46
Have you tested the loading error case (the error
yawano
2015/05/01 06:09:54
Changed this to scoped_refptr since multiple resul
| |
| 39 routing_id); | |
| 22 Service* const service = Service::Get(GetProfile()); | 40 Service* const service = Service::Get(GetProfile()); |
| 23 service->SetSearchResults(extension(), params->query_id, params->results); | 41 service->SetSearchResults(extension(), error_reporter, params->query_id, |
| 42 params->results); | |
| 24 | 43 |
| 25 return true; | 44 return true; |
| 26 } | 45 } |
| 27 | 46 |
| 28 } // namespace extensions | 47 } // namespace extensions |
| OLD | NEW |