OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/extensions/extension_system.h" | 5 #include "chrome/browser/extensions/extension_system.h" |
6 | 6 |
7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "chrome/browser/extensions/extension_system_factory.h" | 26 #include "chrome/browser/extensions/extension_system_factory.h" |
27 #include "chrome/browser/extensions/extension_util.h" | 27 #include "chrome/browser/extensions/extension_util.h" |
28 #include "chrome/browser/extensions/extension_warning_badge_service.h" | 28 #include "chrome/browser/extensions/extension_warning_badge_service.h" |
29 #include "chrome/browser/extensions/extension_warning_set.h" | 29 #include "chrome/browser/extensions/extension_warning_set.h" |
30 #include "chrome/browser/extensions/management_policy.h" | 30 #include "chrome/browser/extensions/management_policy.h" |
31 #include "chrome/browser/extensions/navigation_observer.h" | 31 #include "chrome/browser/extensions/navigation_observer.h" |
32 #include "chrome/browser/extensions/standard_management_policy_provider.h" | 32 #include "chrome/browser/extensions/standard_management_policy_provider.h" |
33 #include "chrome/browser/extensions/state_store.h" | 33 #include "chrome/browser/extensions/state_store.h" |
34 #include "chrome/browser/extensions/unpacked_installer.h" | 34 #include "chrome/browser/extensions/unpacked_installer.h" |
35 #include "chrome/browser/extensions/user_script_master.h" | 35 #include "chrome/browser/extensions/user_script_master.h" |
| 36 #include "chrome/browser/notifications/desktop_notification_service.h" |
| 37 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
36 #include "chrome/browser/profiles/profile.h" | 38 #include "chrome/browser/profiles/profile.h" |
37 #include "chrome/browser/profiles/profile_manager.h" | 39 #include "chrome/browser/profiles/profile_manager.h" |
38 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 40 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
39 #include "chrome/common/chrome_switches.h" | 41 #include "chrome/common/chrome_switches.h" |
40 #include "chrome/common/chrome_version_info.h" | 42 #include "chrome/common/chrome_version_info.h" |
41 #include "chrome/common/extensions/extension.h" | 43 #include "chrome/common/extensions/extension.h" |
42 #include "chrome/common/extensions/features/feature_channel.h" | 44 #include "chrome/common/extensions/features/feature_channel.h" |
43 #include "content/public/browser/browser_thread.h" | 45 #include "content/public/browser/browser_thread.h" |
44 #include "content/public/browser/url_data_source.h" | 46 #include "content/public/browser/url_data_source.h" |
45 #include "extensions/browser/lazy_background_task_queue.h" | 47 #include "extensions/browser/lazy_background_task_queue.h" |
46 #include "extensions/common/constants.h" | 48 #include "extensions/common/constants.h" |
47 #include "extensions/common/manifest.h" | 49 #include "extensions/common/manifest.h" |
| 50 #include "ui/message_center/notifier_settings.h" |
48 | 51 |
49 #if defined(OS_CHROMEOS) | 52 #if defined(OS_CHROMEOS) |
50 #include "chrome/browser/app_mode/app_mode_utils.h" | 53 #include "chrome/browser/app_mode/app_mode_utils.h" |
51 #include "chrome/browser/chromeos/extensions/device_local_account_management_pol
icy_provider.h" | 54 #include "chrome/browser/chromeos/extensions/device_local_account_management_pol
icy_provider.h" |
52 #include "chrome/browser/chromeos/login/user.h" | 55 #include "chrome/browser/chromeos/login/user.h" |
53 #include "chrome/browser/chromeos/login/user_manager.h" | 56 #include "chrome/browser/chromeos/login/user_manager.h" |
54 #include "chrome/browser/chromeos/policy/device_local_account.h" | 57 #include "chrome/browser/chromeos/policy/device_local_account.h" |
55 #include "chromeos/chromeos_switches.h" | 58 #include "chromeos/chromeos_switches.h" |
56 #include "chromeos/login/login_state.h" | 59 #include "chromeos/login/login_state.h" |
57 #endif | 60 #endif |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 | 396 |
394 void ExtensionSystemImpl::RegisterExtensionWithRequestContexts( | 397 void ExtensionSystemImpl::RegisterExtensionWithRequestContexts( |
395 const Extension* extension) { | 398 const Extension* extension) { |
396 base::Time install_time; | 399 base::Time install_time; |
397 if (extension->location() != Manifest::COMPONENT) { | 400 if (extension->location() != Manifest::COMPONENT) { |
398 install_time = ExtensionPrefs::Get(profile_)-> | 401 install_time = ExtensionPrefs::Get(profile_)-> |
399 GetInstallTime(extension->id()); | 402 GetInstallTime(extension->id()); |
400 } | 403 } |
401 bool incognito_enabled = | 404 bool incognito_enabled = |
402 extension_util::IsIncognitoEnabled(extension->id(), extension_service()); | 405 extension_util::IsIncognitoEnabled(extension->id(), extension_service()); |
| 406 message_center::NotifierId notifier_id( |
| 407 message_center::NotifierId::APPLICATION, |
| 408 extension->id()); |
| 409 |
| 410 DesktopNotificationService* notification_service = |
| 411 DesktopNotificationServiceFactory::GetForProfile(profile_); |
| 412 bool notifications_disabled = |
| 413 !notification_service->IsNotifierEnabled(notifier_id); |
| 414 |
403 BrowserThread::PostTask( | 415 BrowserThread::PostTask( |
404 BrowserThread::IO, FROM_HERE, | 416 BrowserThread::IO, FROM_HERE, |
405 base::Bind(&ExtensionInfoMap::AddExtension, info_map(), | 417 base::Bind(&ExtensionInfoMap::AddExtension, info_map(), |
406 make_scoped_refptr(extension), install_time, | 418 make_scoped_refptr(extension), install_time, |
407 incognito_enabled)); | 419 incognito_enabled, notifications_disabled)); |
408 } | 420 } |
409 | 421 |
410 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( | 422 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( |
411 const std::string& extension_id, | 423 const std::string& extension_id, |
412 const UnloadedExtensionInfo::Reason reason) { | 424 const UnloadedExtensionInfo::Reason reason) { |
413 BrowserThread::PostTask( | 425 BrowserThread::PostTask( |
414 BrowserThread::IO, FROM_HERE, | 426 BrowserThread::IO, FROM_HERE, |
415 base::Bind(&ExtensionInfoMap::RemoveExtension, info_map(), | 427 base::Bind(&ExtensionInfoMap::RemoveExtension, info_map(), |
416 extension_id, reason)); | 428 extension_id, reason)); |
417 } | 429 } |
418 | 430 |
419 } // namespace extensions | 431 } // namespace extensions |
OLD | NEW |