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/external_provider_impl.h" | 5 #include "chrome/browser/extensions/external_provider_impl.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/memory/linked_ptr.h" | 13 #include "base/memory/linked_ptr.h" |
14 #include "base/metrics/field_trial.h" | 14 #include "base/metrics/field_trial.h" |
15 #include "base/path_service.h" | 15 #include "base/path_service.h" |
16 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
17 #include "base/values.h" | 17 #include "base/values.h" |
18 #include "base/version.h" | 18 #include "base/version.h" |
19 #include "chrome/browser/app_mode/app_mode_utils.h" | 19 #include "chrome/browser/app_mode/app_mode_utils.h" |
20 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
| 21 #include "chrome/browser/extensions/extension_management.h" |
21 #include "chrome/browser/extensions/extension_service.h" | 22 #include "chrome/browser/extensions/extension_service.h" |
22 #include "chrome/browser/extensions/external_component_loader.h" | 23 #include "chrome/browser/extensions/external_component_loader.h" |
23 #include "chrome/browser/extensions/external_policy_loader.h" | 24 #include "chrome/browser/extensions/external_policy_loader.h" |
24 #include "chrome/browser/extensions/external_pref_loader.h" | 25 #include "chrome/browser/extensions/external_pref_loader.h" |
25 #include "chrome/browser/profiles/profile.h" | 26 #include "chrome/browser/profiles/profile.h" |
26 #include "chrome/common/chrome_paths.h" | 27 #include "chrome/common/chrome_paths.h" |
27 #include "chrome/common/chrome_switches.h" | 28 #include "chrome/common/chrome_switches.h" |
28 #include "chrome/common/pref_names.h" | 29 #include "chrome/common/pref_names.h" |
29 #include "components/crx_file/id_util.h" | 30 #include "components/crx_file/id_util.h" |
30 #include "content/public/browser/browser_thread.h" | 31 #include "content/public/browser/browser_thread.h" |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 policy::DeviceLocalAccountPolicyBroker* broker = | 381 policy::DeviceLocalAccountPolicyBroker* broker = |
381 connector->GetDeviceLocalAccountPolicyService()->GetBrokerForUser( | 382 connector->GetDeviceLocalAccountPolicyService()->GetBrokerForUser( |
382 user->email()); | 383 user->email()); |
383 if (broker) { | 384 if (broker) { |
384 external_loader = broker->extension_loader(); | 385 external_loader = broker->extension_loader(); |
385 crx_location = Manifest::EXTERNAL_POLICY; | 386 crx_location = Manifest::EXTERNAL_POLICY; |
386 } else { | 387 } else { |
387 NOTREACHED(); | 388 NOTREACHED(); |
388 } | 389 } |
389 } else { | 390 } else { |
390 external_loader = new ExternalPolicyLoader(profile); | 391 external_loader = new ExternalPolicyLoader( |
| 392 ExtensionManagementFactory::GetForBrowserContext(profile)); |
391 } | 393 } |
392 #else | 394 #else |
393 external_loader = new ExternalPolicyLoader(profile); | 395 external_loader = new ExternalPolicyLoader( |
| 396 ExtensionManagementFactory::GetForBrowserContext(profile)); |
394 #endif | 397 #endif |
395 | 398 |
396 // Policies are mandatory so they can't be skipped with command line flag. | 399 // Policies are mandatory so they can't be skipped with command line flag. |
397 if (external_loader.get()) { | 400 if (external_loader.get()) { |
398 provider_list->push_back( | 401 provider_list->push_back( |
399 linked_ptr<ExternalProviderInterface>( | 402 linked_ptr<ExternalProviderInterface>( |
400 new ExternalProviderImpl( | 403 new ExternalProviderImpl( |
401 service, | 404 service, |
402 external_loader, | 405 external_loader, |
403 profile, | 406 profile, |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 service, | 577 service, |
575 new ExternalComponentLoader(profile), | 578 new ExternalComponentLoader(profile), |
576 profile, | 579 profile, |
577 Manifest::INVALID_LOCATION, | 580 Manifest::INVALID_LOCATION, |
578 Manifest::EXTERNAL_COMPONENT, | 581 Manifest::EXTERNAL_COMPONENT, |
579 Extension::FROM_WEBSTORE | Extension::WAS_INSTALLED_BY_DEFAULT))); | 582 Extension::FROM_WEBSTORE | Extension::WAS_INSTALLED_BY_DEFAULT))); |
580 } | 583 } |
581 } | 584 } |
582 | 585 |
583 } // namespace extensions | 586 } // namespace extensions |
OLD | NEW |