summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/api/screenlock_private/screenlock_private_api.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/extensions/api/screenlock_private/screenlock_private_api.cc')
-rw-r--r--chrome/browser/extensions/api/screenlock_private/screenlock_private_api.cc36
1 files changed, 19 insertions, 17 deletions
diff --git a/chrome/browser/extensions/api/screenlock_private/screenlock_private_api.cc b/chrome/browser/extensions/api/screenlock_private/screenlock_private_api.cc
index bc58952..f93b1ef 100644
--- a/chrome/browser/extensions/api/screenlock_private/screenlock_private_api.cc
+++ b/chrome/browser/extensions/api/screenlock_private/screenlock_private_api.cc
@@ -15,10 +15,10 @@
#include "extensions/browser/app_window/app_window_registry.h"
#include "extensions/browser/event_router.h"
-namespace screenlock = extensions::api::screenlock_private;
-
namespace extensions {
+namespace screenlock = api::screenlock_private;
+
namespace {
screenlock::AuthType FromLockHandlerAuthType(
@@ -114,14 +114,16 @@ ScreenlockPrivateEventRouter::~ScreenlockPrivateEventRouter() {}
void ScreenlockPrivateEventRouter::OnScreenDidLock(
proximity_auth::ScreenlockBridge::LockHandler::ScreenType screen_type) {
- DispatchEvent(screenlock::OnChanged::kEventName,
- new base::FundamentalValue(true));
+ DispatchEvent(events::SCREENLOCK_PRIVATE_ON_CHANGED,
+ screenlock::OnChanged::kEventName,
+ new base::FundamentalValue(true));
}
void ScreenlockPrivateEventRouter::OnScreenDidUnlock(
proximity_auth::ScreenlockBridge::LockHandler::ScreenType screen_type) {
- DispatchEvent(screenlock::OnChanged::kEventName,
- new base::FundamentalValue(false));
+ DispatchEvent(events::SCREENLOCK_PRIVATE_ON_CHANGED,
+ screenlock::OnChanged::kEventName,
+ new base::FundamentalValue(false));
}
void ScreenlockPrivateEventRouter::OnFocusedUserChanged(
@@ -129,21 +131,22 @@ void ScreenlockPrivateEventRouter::OnFocusedUserChanged(
}
void ScreenlockPrivateEventRouter::DispatchEvent(
+ events::HistogramValue histogram_value,
const std::string& event_name,
base::Value* arg) {
scoped_ptr<base::ListValue> args(new base::ListValue());
if (arg)
args->Append(arg);
- scoped_ptr<extensions::Event> event(new extensions::Event(
- extensions::events::UNKNOWN, event_name, args.Pass()));
- extensions::EventRouter::Get(browser_context_)->BroadcastEvent(event.Pass());
+ scoped_ptr<Event> event(new Event(histogram_value, event_name, args.Pass()));
+ EventRouter::Get(browser_context_)->BroadcastEvent(event.Pass());
}
-static base::LazyInstance<extensions::BrowserContextKeyedAPIFactory<
- ScreenlockPrivateEventRouter> > g_factory = LAZY_INSTANCE_INITIALIZER;
+static base::LazyInstance<
+ BrowserContextKeyedAPIFactory<ScreenlockPrivateEventRouter>> g_factory =
+ LAZY_INSTANCE_INITIALIZER;
// static
-extensions::BrowserContextKeyedAPIFactory<ScreenlockPrivateEventRouter>*
+BrowserContextKeyedAPIFactory<ScreenlockPrivateEventRouter>*
ScreenlockPrivateEventRouter::GetFactoryInstance() {
return g_factory.Pointer();
}
@@ -155,8 +158,7 @@ void ScreenlockPrivateEventRouter::Shutdown() {
bool ScreenlockPrivateEventRouter::OnAuthAttempted(
proximity_auth::ScreenlockBridge::LockHandler::AuthType auth_type,
const std::string& value) {
- extensions::EventRouter* router =
- extensions::EventRouter::Get(browser_context_);
+ EventRouter* router = EventRouter::Get(browser_context_);
if (!router->HasEventListener(screenlock::OnAuthAttempted::kEventName))
return false;
@@ -164,9 +166,9 @@ bool ScreenlockPrivateEventRouter::OnAuthAttempted(
args->AppendString(screenlock::ToString(FromLockHandlerAuthType(auth_type)));
args->AppendString(value);
- scoped_ptr<extensions::Event> event(new extensions::Event(
- extensions::events::UNKNOWN, screenlock::OnAuthAttempted::kEventName,
- args.Pass()));
+ scoped_ptr<Event> event(
+ new Event(events::SCREENLOCK_PRIVATE_ON_AUTH_ATTEMPTED,
+ screenlock::OnAuthAttempted::kEventName, args.Pass()));
router->BroadcastEvent(event.Pass());
return true;
}