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

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

Issue 1201063002: Set up the infrastructure for Extension event metrics. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebaaaaase Created 5 years, 6 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) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/dictionary_event_router.h" 5 #include "chrome/browser/chromeos/extensions/dictionary_event_router.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 28 matching lines...) Expand all
39 39
40 extensions::EventRouter* router = extensions::EventRouter::Get(context_); 40 extensions::EventRouter* router = extensions::EventRouter::Get(context_);
41 if (!router->HasEventListener( 41 if (!router->HasEventListener(
42 extensions::InputMethodAPI::kOnDictionaryLoaded)) { 42 extensions::InputMethodAPI::kOnDictionaryLoaded)) {
43 return; 43 return;
44 } 44 }
45 45
46 scoped_ptr<base::ListValue> args(new base::ListValue()); 46 scoped_ptr<base::ListValue> args(new base::ListValue());
47 // The router will only send the event to extensions that are listening. 47 // The router will only send the event to extensions that are listening.
48 scoped_ptr<extensions::Event> event(new extensions::Event( 48 scoped_ptr<extensions::Event> event(new extensions::Event(
49 extensions::events::UNKNOWN,
49 extensions::InputMethodAPI::kOnDictionaryLoaded, args.Pass())); 50 extensions::InputMethodAPI::kOnDictionaryLoaded, args.Pass()));
50 event->restrict_to_browser_context = context_; 51 event->restrict_to_browser_context = context_;
51 router->BroadcastEvent(event.Pass()); 52 router->BroadcastEvent(event.Pass());
52 } 53 }
53 54
54 void ExtensionDictionaryEventRouter::OnCustomDictionaryLoaded() { 55 void ExtensionDictionaryEventRouter::OnCustomDictionaryLoaded() {
55 loaded_ = true; 56 loaded_ = true;
56 DispatchLoadedEventIfLoaded(); 57 DispatchLoadedEventIfLoaded();
57 } 58 }
58 59
(...skipping 13 matching lines...) Expand all
72 scoped_ptr<base::ListValue> removed_words(new base::ListValue()); 73 scoped_ptr<base::ListValue> removed_words(new base::ListValue());
73 for (const std::string& word : dictionary_change.to_remove()) 74 for (const std::string& word : dictionary_change.to_remove())
74 removed_words->AppendString(word); 75 removed_words->AppendString(word);
75 76
76 scoped_ptr<base::ListValue> args(new base::ListValue()); 77 scoped_ptr<base::ListValue> args(new base::ListValue());
77 args->Append(added_words.release()); 78 args->Append(added_words.release());
78 args->Append(removed_words.release()); 79 args->Append(removed_words.release());
79 80
80 // The router will only send the event to extensions that are listening. 81 // The router will only send the event to extensions that are listening.
81 scoped_ptr<extensions::Event> event(new extensions::Event( 82 scoped_ptr<extensions::Event> event(new extensions::Event(
83 extensions::events::UNKNOWN,
82 extensions::InputMethodAPI::kOnDictionaryChanged, args.Pass())); 84 extensions::InputMethodAPI::kOnDictionaryChanged, args.Pass()));
83 event->restrict_to_browser_context = context_; 85 event->restrict_to_browser_context = context_;
84 router->BroadcastEvent(event.Pass()); 86 router->BroadcastEvent(event.Pass());
85 } 87 }
86 88
87 } // namespace chromeos 89 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698