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