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

Side by Side Diff: chrome/browser/chromeos/extensions/input_method_event_router.cc

Issue 2392693002: Rewrite simple uses of base::ListValue::Append(base::Value*) on CrOS. (Closed)
Patch Set: MakeUnique Created 4 years, 2 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/input_method_event_router.h" 5 #include "chrome/browser/chromeos/extensions/input_method_event_router.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 25 matching lines...) Expand all
36 bool show_message) { 36 bool show_message) {
37 // This should probably be CHECK, as delivering event to a wrong 37 // This should probably be CHECK, as delivering event to a wrong
38 // profile means delivering it to a wrong extension instance. 38 // profile means delivering it to a wrong extension instance.
39 DCHECK(profile->IsSameProfile(Profile::FromBrowserContext(context_))); 39 DCHECK(profile->IsSameProfile(Profile::FromBrowserContext(context_)));
40 extensions::EventRouter* router = extensions::EventRouter::Get(context_); 40 extensions::EventRouter* router = extensions::EventRouter::Get(context_);
41 41
42 if (!router->HasEventListener(OnChanged::kEventName)) 42 if (!router->HasEventListener(OnChanged::kEventName))
43 return; 43 return;
44 44
45 std::unique_ptr<base::ListValue> args(new base::ListValue()); 45 std::unique_ptr<base::ListValue> args(new base::ListValue());
46 args->Append(new base::StringValue( 46 args->AppendString(
47 manager->GetActiveIMEState()->GetCurrentInputMethod().id())); 47 manager->GetActiveIMEState()->GetCurrentInputMethod().id());
48 48
49 // The router will only send the event to extensions that are listening. 49 // The router will only send the event to extensions that are listening.
50 std::unique_ptr<extensions::Event> event( 50 std::unique_ptr<extensions::Event> event(
51 new extensions::Event(extensions::events::INPUT_METHOD_PRIVATE_ON_CHANGED, 51 new extensions::Event(extensions::events::INPUT_METHOD_PRIVATE_ON_CHANGED,
52 OnChanged::kEventName, std::move(args))); 52 OnChanged::kEventName, std::move(args)));
53 event->restrict_to_browser_context = context_; 53 event->restrict_to_browser_context = context_;
54 router->BroadcastEvent(std::move(event)); 54 router->BroadcastEvent(std::move(event));
55 } 55 }
56 56
57 } // namespace chromeos 57 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698