OLD | NEW |
| (Empty) |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/component_updater/pnacl/pnacl_profile_observer.h" | |
6 | |
7 #include "base/logging.h" | |
8 #include "chrome/browser/chrome_notification_types.h" | |
9 #include "chrome/browser/component_updater/pnacl/pnacl_component_installer.h" | |
10 #include "content/public/browser/notification_service.h" | |
11 | |
12 namespace component_updater { | |
13 | |
14 PnaclProfileObserver::PnaclProfileObserver(PnaclComponentInstaller* installer) | |
15 : pnacl_installer_(installer) { | |
16 // We only need to observe NOTIFICATION_LOGIN_USER_CHANGED for ChromeOS | |
17 // (and it's only defined for ChromeOS). | |
18 #if defined(OS_CHROMEOS) | |
19 registrar_.Add(this, | |
20 chrome::NOTIFICATION_LOGIN_USER_CHANGED, | |
21 content::NotificationService::AllSources()); | |
22 #endif | |
23 } | |
24 | |
25 PnaclProfileObserver::~PnaclProfileObserver() { | |
26 } | |
27 | |
28 void PnaclProfileObserver::Observe( | |
29 int type, | |
30 const content::NotificationSource& source, | |
31 const content::NotificationDetails& details) { | |
32 #if defined(OS_CHROMEOS) | |
33 if (type == chrome::NOTIFICATION_LOGIN_USER_CHANGED) { | |
34 pnacl_installer_->ReRegisterPnacl(); | |
35 return; | |
36 } | |
37 NOTREACHED() << "Unexpected notification observed"; | |
38 #endif | |
39 } | |
40 | |
41 } // namespace component_updater | |
OLD | NEW |