| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/enterprise_extension_observer.h" | 5 #include "chrome/browser/chromeos/enterprise_extension_observer.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "chrome/browser/chromeos/cros/cros_library.h" | 8 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 9 #include "chrome/browser/chromeos/cros/login_library.h" | 9 #include "chrome/browser/chromeos/cros/login_library.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/common/chrome_notification_types.h" |
| 11 #include "content/browser/browser_thread.h" | 12 #include "content/browser/browser_thread.h" |
| 12 | 13 |
| 13 namespace chromeos { | 14 namespace chromeos { |
| 14 | 15 |
| 15 EnterpriseExtensionObserver::EnterpriseExtensionObserver(Profile* profile) | 16 EnterpriseExtensionObserver::EnterpriseExtensionObserver(Profile* profile) |
| 16 : profile_(profile) { | 17 : profile_(profile) { |
| 17 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 18 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 18 registrar_.Add(this, | 19 registrar_.Add(this, |
| 19 NotificationType::EXTENSION_INSTALLED, | 20 chrome::NOTIFICATION_EXTENSION_INSTALLED, |
| 20 Source<Profile>(profile_)); | 21 Source<Profile>(profile_)); |
| 21 } | 22 } |
| 22 | 23 |
| 23 void EnterpriseExtensionObserver::Observe(NotificationType type, | 24 void EnterpriseExtensionObserver::Observe(int type, |
| 24 const NotificationSource& source, | 25 const NotificationSource& source, |
| 25 const NotificationDetails& details) { | 26 const NotificationDetails& details) { |
| 26 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 27 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 27 DCHECK(type == NotificationType::EXTENSION_INSTALLED); | 28 DCHECK(type == chrome::NOTIFICATION_EXTENSION_INSTALLED); |
| 28 if (Source<Profile>(source).ptr() != profile_) { | 29 if (Source<Profile>(source).ptr() != profile_) { |
| 29 return; | 30 return; |
| 30 } | 31 } |
| 31 Extension* extension = Details<Extension>(details).ptr(); | 32 Extension* extension = Details<Extension>(details).ptr(); |
| 32 if (extension->location() != Extension::EXTERNAL_POLICY_DOWNLOAD) { | 33 if (extension->location() != Extension::EXTERNAL_POLICY_DOWNLOAD) { |
| 33 return; | 34 return; |
| 34 } | 35 } |
| 35 BrowserThread::PostTask( | 36 BrowserThread::PostTask( |
| 36 BrowserThread::FILE, | 37 BrowserThread::FILE, |
| 37 FROM_HERE, | 38 FROM_HERE, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 56 // static | 57 // static |
| 57 void EnterpriseExtensionObserver::NotifyEntd() { | 58 void EnterpriseExtensionObserver::NotifyEntd() { |
| 58 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 59 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 59 if (CrosLibrary::Get()->EnsureLoaded()) { | 60 if (CrosLibrary::Get()->EnsureLoaded()) { |
| 60 CrosLibrary::Get()->GetLoginLibrary()->RestartEntd(); | 61 CrosLibrary::Get()->GetLoginLibrary()->RestartEntd(); |
| 61 return; | 62 return; |
| 62 } | 63 } |
| 63 } | 64 } |
| 64 | 65 |
| 65 } // namespace chromeos | 66 } // namespace chromeos |
| OLD | NEW |