| Index: chrome/browser/component_updater/pnacl/pnacl_profile_observer.cc
|
| diff --git a/chrome/browser/component_updater/pnacl/pnacl_profile_observer.cc b/chrome/browser/component_updater/pnacl/pnacl_profile_observer.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..03c9959d8d28116602e952d41fe9516337ed9bb5
|
| --- /dev/null
|
| +++ b/chrome/browser/component_updater/pnacl/pnacl_profile_observer.cc
|
| @@ -0,0 +1,36 @@
|
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "chrome/browser/component_updater/pnacl/pnacl_profile_observer.h"
|
| +
|
| +#include "base/logging.h"
|
| +#include "chrome/browser/component_updater/pnacl/pnacl_component_installer.h"
|
| +#include "chrome/common/chrome_notification_types.h"
|
| +#include "content/public/browser/notification_service.h"
|
| +
|
| +PnaclProfileObserver::PnaclProfileObserver(
|
| + PnaclComponentInstaller* installer) : pnacl_installer_(installer) {
|
| + // We only need to observe NOTIFICATION_LOGIN_USER_CHANGED for ChromeOS
|
| + // (and it's only defined for ChromeOS).
|
| +#if defined(OS_CHROMEOS)
|
| + registrar_.Add(this,
|
| + chrome::NOTIFICATION_LOGIN_USER_CHANGED,
|
| + content::NotificationService::AllSources());
|
| +#endif
|
| +}
|
| +
|
| +PnaclProfileObserver::~PnaclProfileObserver() { }
|
| +
|
| +void PnaclProfileObserver::Observe(
|
| + int type,
|
| + const content::NotificationSource& source,
|
| + const content::NotificationDetails& details) {
|
| +#if defined(OS_CHROMEOS)
|
| + if (type == chrome::NOTIFICATION_LOGIN_USER_CHANGED) {
|
| + pnacl_installer_->ReRegisterPnacl();
|
| + return;
|
| + }
|
| +#endif
|
| + NOTREACHED() << "Unexpected notification observed";
|
| +}
|
|
|