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

Side by Side Diff: blimp/client/feature/ime_feature.cc

Issue 1933053003: Used oneof in blimp_message.proto (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Kevin's comments Created 4 years, 7 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 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 6
7 #include <string> 7 #include <string>
8 8
9 #include "blimp/common/create_blimp_message.h" 9 #include "blimp/common/create_blimp_message.h"
10 #include "blimp/common/proto/blimp_message.pb.h" 10 #include "blimp/common/proto/blimp_message.pb.h"
(...skipping 18 matching lines...) Expand all
29 ime_message->set_type(ImeMessage::SET_TEXT); 29 ime_message->set_type(ImeMessage::SET_TEXT);
30 ime_message->set_ime_text(text); 30 ime_message->set_ime_text(text);
31 31
32 outgoing_message_processor_->ProcessMessage(std::move(blimp_message), 32 outgoing_message_processor_->ProcessMessage(std::move(blimp_message),
33 net::CompletionCallback()); 33 net::CompletionCallback());
34 } 34 }
35 35
36 void ImeFeature::ProcessMessage(std::unique_ptr<BlimpMessage> message, 36 void ImeFeature::ProcessMessage(std::unique_ptr<BlimpMessage> message,
37 const net::CompletionCallback& callback) { 37 const net::CompletionCallback& callback) {
38 DCHECK(!callback.is_null()); 38 DCHECK(!callback.is_null());
39 DCHECK_EQ(BlimpMessage::IME, message->type()); 39 DCHECK_EQ(BlimpMessage::kIme, message->feature_case());
Wez 2016/05/18 01:53:31 Wouldn't it be cleaner to DCHECK(message->has_ime(
shaktisahu 2016/05/18 03:55:42 As we discussed, it is better to keep the DCHECK_E
40 40
41 DCHECK(delegate_); 41 DCHECK(delegate_);
42 42
43 const ImeMessage& ime_message = message->ime(); 43 const ImeMessage& ime_message = message->ime();
44 44
45 switch (ime_message.type()) { 45 switch (ime_message.type()) {
46 case ImeMessage::SHOW_IME: 46 case ImeMessage::SHOW_IME:
47 if (!message->has_target_tab_id() || message->target_tab_id() < 0 || 47 if (!message->has_target_tab_id() || message->target_tab_id() < 0 ||
48 ime_message.render_widget_id() <= 0) { 48 ime_message.render_widget_id() <= 0) {
49 callback.Run(net::ERR_INVALID_ARGUMENT); 49 callback.Run(net::ERR_INVALID_ARGUMENT);
(...skipping 18 matching lines...) Expand all
68 NOTREACHED(); 68 NOTREACHED();
69 callback.Run(net::ERR_UNEXPECTED); 69 callback.Run(net::ERR_UNEXPECTED);
70 return; 70 return;
71 } 71 }
72 72
73 callback.Run(net::OK); 73 callback.Run(net::OK);
74 } 74 }
75 75
76 } // namespace client 76 } // namespace client
77 } // namespace blimp 77 } // namespace blimp
OLDNEW
« no previous file with comments | « no previous file | blimp/client/feature/navigation_feature.cc » ('j') | blimp/client/feature/render_widget_feature.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698