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