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

Side by Side Diff: chrome/browser/chromeos/extensions/file_manager/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, 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/file_manager/event_router.h" 5 #include "chrome/browser/chromeos/extensions/file_manager/event_router.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/prefs/pref_change_registrar.h" 10 #include "base/prefs/pref_change_registrar.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 return true; 90 return true;
91 } 91 }
92 92
93 return false; 93 return false;
94 } 94 }
95 95
96 // Sends an event named |event_name| with arguments |event_args| to extensions. 96 // Sends an event named |event_name| with arguments |event_args| to extensions.
97 void BroadcastEvent(Profile* profile, 97 void BroadcastEvent(Profile* profile,
98 const std::string& event_name, 98 const std::string& event_name,
99 scoped_ptr<base::ListValue> event_args) { 99 scoped_ptr<base::ListValue> event_args) {
100 extensions::EventRouter::Get(profile)->BroadcastEvent( 100 extensions::EventRouter::Get(profile)
101 make_scoped_ptr(new extensions::Event(event_name, event_args.Pass()))); 101 ->BroadcastEvent(make_scoped_ptr(new extensions::Event(
102 extensions::events::UNKNOWN, event_name, event_args.Pass())));
102 } 103 }
103 104
104 // Sends an event named |event_name| with arguments |event_args| to an extension 105 // Sends an event named |event_name| with arguments |event_args| to an extension
105 // of |extention_id|. 106 // of |extention_id|.
106 void DispatchEventToExtension(Profile* profile, 107 void DispatchEventToExtension(Profile* profile,
107 const std::string& extension_id, 108 const std::string& extension_id,
108 const std::string& event_name, 109 const std::string& event_name,
109 scoped_ptr<base::ListValue> event_args) { 110 scoped_ptr<base::ListValue> event_args) {
110 extensions::EventRouter::Get(profile)->DispatchEventToExtension( 111 extensions::EventRouter::Get(profile)->DispatchEventToExtension(
111 extension_id, 112 extension_id,
112 make_scoped_ptr(new extensions::Event(event_name, event_args.Pass()))); 113 make_scoped_ptr(new extensions::Event(extensions::events::UNKNOWN,
114 event_name, event_args.Pass())));
113 } 115 }
114 116
115 file_manager_private::MountCompletedStatus 117 file_manager_private::MountCompletedStatus
116 MountErrorToMountCompletedStatus(chromeos::MountError error) { 118 MountErrorToMountCompletedStatus(chromeos::MountError error) {
117 switch (error) { 119 switch (error) {
118 case chromeos::MOUNT_ERROR_NONE: 120 case chromeos::MOUNT_ERROR_NONE:
119 return file_manager_private::MOUNT_COMPLETED_STATUS_SUCCESS; 121 return file_manager_private::MOUNT_COMPLETED_STATUS_SUCCESS;
120 case chromeos::MOUNT_ERROR_UNKNOWN: 122 case chromeos::MOUNT_ERROR_UNKNOWN:
121 return file_manager_private::MOUNT_COMPLETED_STATUS_ERROR_UNKNOWN; 123 return file_manager_private::MOUNT_COMPLETED_STATUS_ERROR_UNKNOWN;
122 case chromeos::MOUNT_ERROR_INTERNAL: 124 case chromeos::MOUNT_ERROR_INTERNAL:
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after
929 void EventRouter::SetDispatchDirectoryChangeEventImplForTesting( 931 void EventRouter::SetDispatchDirectoryChangeEventImplForTesting(
930 const DispatchDirectoryChangeEventImplCallback& callback) { 932 const DispatchDirectoryChangeEventImplCallback& callback) {
931 dispatch_directory_change_event_impl_ = callback; 933 dispatch_directory_change_event_impl_ = callback;
932 } 934 }
933 935
934 base::WeakPtr<EventRouter> EventRouter::GetWeakPtr() { 936 base::WeakPtr<EventRouter> EventRouter::GetWeakPtr() {
935 return weak_factory_.GetWeakPtr(); 937 return weak_factory_.GetWeakPtr();
936 } 938 }
937 939
938 } // namespace file_manager 940 } // namespace file_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698