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/extensions/extension_service.h" | 5 #include "chrome/browser/extensions/extension_service.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | |
10 #include <iterator> | 9 #include <iterator> |
11 #include <memory> | 10 #include <memory> |
12 #include <set> | 11 #include <set> |
13 #include <utility> | 12 #include <utility> |
14 | 13 |
15 #include "base/command_line.h" | 14 #include "base/command_line.h" |
16 #include "base/debug/alias.h" | 15 #include "base/debug/alias.h" |
17 #include "base/debug/dump_without_crashing.h" | 16 #include "base/debug/dump_without_crashing.h" |
18 #include "base/location.h" | 17 #include "base/location.h" |
19 #include "base/metrics/histogram_macros.h" | 18 #include "base/metrics/histogram_macros.h" |
20 #include "base/single_thread_task_runner.h" | 19 #include "base/single_thread_task_runner.h" |
| 20 #include "base/stl_util.h" |
21 #include "base/strings/string_number_conversions.h" | 21 #include "base/strings/string_number_conversions.h" |
22 #include "base/strings/string_tokenizer.h" | 22 #include "base/strings/string_tokenizer.h" |
23 #include "base/strings/stringprintf.h" | 23 #include "base/strings/stringprintf.h" |
24 #include "base/strings/utf_string_conversions.h" | 24 #include "base/strings/utf_string_conversions.h" |
25 #include "base/task_scheduler/post_task.h" | 25 #include "base/task_scheduler/post_task.h" |
26 #include "base/threading/thread_restrictions.h" | 26 #include "base/threading/thread_restrictions.h" |
27 #include "base/threading/thread_task_runner_handle.h" | 27 #include "base/threading/thread_task_runner_handle.h" |
28 #include "base/time/time.h" | 28 #include "base/time/time.h" |
29 #include "base/trace_event/trace_event.h" | 29 #include "base/trace_event/trace_event.h" |
30 #include "build/build_config.h" | 30 #include "build/build_config.h" |
(...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1024 if (management_policy->UserMayModifySettings(extension.get(), nullptr)) | 1024 if (management_policy->UserMayModifySettings(extension.get(), nullptr)) |
1025 to_disable.push_back(extension); | 1025 to_disable.push_back(extension); |
1026 } | 1026 } |
1027 | 1027 |
1028 for (const auto& extension : to_disable) { | 1028 for (const auto& extension : to_disable) { |
1029 if (extension->was_installed_by_default() && | 1029 if (extension->was_installed_by_default() && |
1030 extension_urls::IsWebstoreUpdateUrl( | 1030 extension_urls::IsWebstoreUpdateUrl( |
1031 extensions::ManifestURL::GetUpdateURL(extension.get()))) | 1031 extensions::ManifestURL::GetUpdateURL(extension.get()))) |
1032 continue; | 1032 continue; |
1033 const std::string& id = extension->id(); | 1033 const std::string& id = extension->id(); |
1034 if (except_ids.end() == std::find(except_ids.begin(), except_ids.end(), id)) | 1034 if (!base::ContainsValue(except_ids, id)) |
1035 DisableExtension(id, extensions::Extension::DISABLE_USER_ACTION); | 1035 DisableExtension(id, extensions::Extension::DISABLE_USER_ACTION); |
1036 } | 1036 } |
1037 } | 1037 } |
1038 | 1038 |
1039 // Extensions that are not locked, components or forced by policy should be | 1039 // Extensions that are not locked, components or forced by policy should be |
1040 // locked. Extensions are no longer considered enabled or disabled. Blacklisted | 1040 // locked. Extensions are no longer considered enabled or disabled. Blacklisted |
1041 // extensions are now considered both blacklisted and locked. | 1041 // extensions are now considered both blacklisted and locked. |
1042 void ExtensionService::BlockAllExtensions() { | 1042 void ExtensionService::BlockAllExtensions() { |
1043 if (block_extensions_) | 1043 if (block_extensions_) |
1044 return; | 1044 return; |
(...skipping 1560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2605 | 2605 |
2606 if (!has_orphaned_dev_tools && !is_component_extension) | 2606 if (!has_orphaned_dev_tools && !is_component_extension) |
2607 return; | 2607 return; |
2608 | 2608 |
2609 // Wake up the event page by posting a dummy task. | 2609 // Wake up the event page by posting a dummy task. |
2610 extensions::LazyBackgroundTaskQueue* queue = | 2610 extensions::LazyBackgroundTaskQueue* queue = |
2611 extensions::LazyBackgroundTaskQueue::Get(profile_); | 2611 extensions::LazyBackgroundTaskQueue::Get(profile_); |
2612 queue->AddPendingTask(profile_, extension->id(), | 2612 queue->AddPendingTask(profile_, extension->id(), |
2613 base::Bind(&DoNothingWithExtensionHost)); | 2613 base::Bind(&DoNothingWithExtensionHost)); |
2614 } | 2614 } |
OLD | NEW |