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

Side by Side Diff: services/prediction/prediction_service_impl.cc

Issue 1247903003: Add spellcheck and word suggestion to the prediction service (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: format README and CHROMIUM.diff Created 5 years, 4 months 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 unified diff | Download patch
OLDNEW
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 "mojo/application/application_runner_chromium.h" 5 #include "mojo/application/application_runner_chromium.h"
6 #include "mojo/public/c/system/main.h" 6 #include "mojo/public/c/system/main.h"
7 #include "mojo/public/cpp/application/application_connection.h" 7 #include "mojo/public/cpp/application/application_connection.h"
8 #include "mojo/public/cpp/application/application_delegate.h" 8 #include "mojo/public/cpp/application/application_delegate.h"
9 #include "mojo/public/cpp/bindings/strong_binding.h" 9 #include "mojo/public/cpp/bindings/strong_binding.h"
10 #include "services/prediction/dictionary_service.h"
10 #include "services/prediction/prediction_service_impl.h" 11 #include "services/prediction/prediction_service_impl.h"
11 12
12 namespace prediction { 13 namespace prediction {
13 14
14 PredictionServiceImpl::PredictionServiceImpl( 15 PredictionServiceImpl::PredictionServiceImpl(
15 mojo::InterfaceRequest<PredictionService> request) 16 mojo::InterfaceRequest<PredictionService> request)
16 : strong_binding_(this, request.Pass()) { 17 : strong_binding_(this, request.Pass()) {
18 ProximityInfoFactory proximity_info;
19 proximity_settings_ = scoped_ptr<latinime::ProximityInfo>(
20 proximity_info.GetNativeProximityInfo());
17 } 21 }
18 22
19 PredictionServiceImpl::~PredictionServiceImpl() { 23 PredictionServiceImpl::~PredictionServiceImpl() {
20 } 24 }
21 25
22 // PredictionService implementation 26 // PredictionService implementation
23 void PredictionServiceImpl::SetSettings(SettingsPtr settings) {
24 stored_settings_.correction_enabled = settings->correction_enabled;
25 stored_settings_.block_potentially_offensive =
26 settings->block_potentially_offensive;
27 stored_settings_.space_aware_gesture_enabled =
28 settings->space_aware_gesture_enabled;
29 }
30
31 // only predict "cat" no matter what prediction_info
32 // has for now
33 void PredictionServiceImpl::GetPredictionList( 27 void PredictionServiceImpl::GetPredictionList(
34 PredictionInfoPtr prediction_info, 28 PredictionInfoPtr prediction_info,
35 const GetPredictionListCallback& callback) { 29 const GetPredictionListCallback& callback) {
36 mojo::String cat = "cat"; 30 mojo::Array<mojo::String> prediction_list =
37 mojo::Array<mojo::String> prediction_list; 31 dictionary_service_.GetDictionarySuggestion(prediction_info.Pass(),
38 prediction_list.push_back(cat); 32 proximity_settings_.get());
39 callback.Run(prediction_list.Pass()); 33 callback.Run(prediction_list.Pass());
40 } 34 }
41 35
42 PredictionServiceDelegate::PredictionServiceDelegate() { 36 PredictionServiceDelegate::PredictionServiceDelegate() {
43 } 37 }
44 38
45 PredictionServiceDelegate::~PredictionServiceDelegate() { 39 PredictionServiceDelegate::~PredictionServiceDelegate() {
46 } 40 }
47 41
48 // mojo::ApplicationDelegate implementation 42 // mojo::ApplicationDelegate implementation
(...skipping 10 matching lines...) Expand all
59 new PredictionServiceImpl(request.Pass()); 53 new PredictionServiceImpl(request.Pass());
60 } 54 }
61 55
62 } // namespace prediction 56 } // namespace prediction
63 57
64 MojoResult MojoMain(MojoHandle application_request) { 58 MojoResult MojoMain(MojoHandle application_request) {
65 mojo::ApplicationRunnerChromium runner( 59 mojo::ApplicationRunnerChromium runner(
66 new prediction::PredictionServiceDelegate()); 60 new prediction::PredictionServiceDelegate());
67 return runner.Run(application_request); 61 return runner.Run(application_request);
68 } 62 }
OLDNEW
« no previous file with comments | « services/prediction/prediction_service_impl.h ('k') | services/prediction/proximity_info_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698