Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <blimp/client/feature/ime_feature.h> | 5 #include <blimp/client/feature/ime_feature.h> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "blimp/common/create_blimp_message.h" | 8 #include "blimp/common/create_blimp_message.h" |
| 9 #include "blimp/common/proto/blimp_message.pb.h" | 9 #include "blimp/common/proto/blimp_message.pb.h" |
| 10 #include "blimp/net/input_message_converter.h" | 10 #include "blimp/net/input_message_converter.h" |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 28 ime_message->set_type(ImeMessage::SET_TEXT); | 28 ime_message->set_type(ImeMessage::SET_TEXT); |
| 29 ime_message->set_ime_text(text); | 29 ime_message->set_ime_text(text); |
| 30 | 30 |
| 31 outgoing_message_processor_->ProcessMessage(std::move(blimp_message), | 31 outgoing_message_processor_->ProcessMessage(std::move(blimp_message), |
| 32 net::CompletionCallback()); | 32 net::CompletionCallback()); |
| 33 } | 33 } |
| 34 | 34 |
| 35 void ImeFeature::ProcessMessage(std::unique_ptr<BlimpMessage> message, | 35 void ImeFeature::ProcessMessage(std::unique_ptr<BlimpMessage> message, |
| 36 const net::CompletionCallback& callback) { | 36 const net::CompletionCallback& callback) { |
| 37 DCHECK(!callback.is_null()); | 37 DCHECK(!callback.is_null()); |
| 38 DCHECK_EQ(BlimpMessage::IME, message->type()); | 38 DCHECK(message->has_ime()); |
|
Kevin M
2016/05/02 17:47:47
Check case
shaktisahu
2016/05/16 20:19:02
I agree, it gives more information. Although it lo
| |
| 39 | 39 |
| 40 DCHECK(delegate_); | 40 DCHECK(delegate_); |
| 41 | 41 |
| 42 const ImeMessage& ime_message = message->ime(); | 42 const ImeMessage& ime_message = message->ime(); |
| 43 | 43 |
| 44 switch (ime_message.type()) { | 44 switch (ime_message.type()) { |
| 45 case ImeMessage::SHOW_IME: | 45 case ImeMessage::SHOW_IME: |
| 46 if (!message->has_target_tab_id() || message->target_tab_id() < 0 || | 46 if (!message->has_target_tab_id() || message->target_tab_id() < 0 || |
| 47 ime_message.render_widget_id() <= 0) { | 47 ime_message.render_widget_id() <= 0) { |
| 48 callback.Run(net::ERR_INVALID_ARGUMENT); | 48 callback.Run(net::ERR_INVALID_ARGUMENT); |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 67 NOTREACHED(); | 67 NOTREACHED(); |
| 68 callback.Run(net::ERR_UNEXPECTED); | 68 callback.Run(net::ERR_UNEXPECTED); |
| 69 return; | 69 return; |
| 70 } | 70 } |
| 71 | 71 |
| 72 callback.Run(net::OK); | 72 callback.Run(net::OK); |
| 73 } | 73 } |
| 74 | 74 |
| 75 } // namespace client | 75 } // namespace client |
| 76 } // namespace blimp | 76 } // namespace blimp |
| OLD | NEW |