| 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/external_component_loader.h" | 5 #include "chrome/browser/extensions/external_component_loader.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/extensions/component_extensions_whitelist/whitelist.h" | 10 #include "chrome/browser/extensions/component_extensions_whitelist/whitelist.h" |
| 11 #include "chrome/browser/search/hotword_service.h" | 11 #include "chrome/browser/search/hotword_service.h" |
| 12 #include "chrome/browser/search/hotword_service_factory.h" | 12 #include "chrome/browser/search/hotword_service_factory.h" |
| 13 #include "chrome/browser/signin/signin_manager_factory.h" | 13 #include "chrome/browser/signin/signin_manager_factory.h" |
| 14 #include "chrome/common/extensions/extension_constants.h" | 14 #include "chrome/common/extensions/extension_constants.h" |
| 15 #include "chrome/common/features.h" |
| 15 #include "components/signin/core/browser/signin_manager.h" | 16 #include "components/signin/core/browser/signin_manager.h" |
| 16 #include "extensions/common/extension_urls.h" | 17 #include "extensions/common/extension_urls.h" |
| 17 #include "extensions/common/manifest.h" | 18 #include "extensions/common/manifest.h" |
| 18 | 19 |
| 19 #if defined(OS_CHROMEOS) | 20 #if defined(OS_CHROMEOS) |
| 20 #include "base/command_line.h" | 21 #include "base/command_line.h" |
| 21 #include "chromeos/chromeos_switches.h" | 22 #include "chromeos/chromeos_switches.h" |
| 22 #endif | 23 #endif |
| 23 | 24 |
| 24 #if defined(ENABLE_APP_LIST) && defined(OS_CHROMEOS) | 25 #if BUILDFLAG(ENABLE_APP_LIST) && defined(OS_CHROMEOS) |
| 25 #include "chrome/browser/ui/app_list/google_now_extension.h" | 26 #include "chrome/browser/ui/app_list/google_now_extension.h" |
| 26 #endif | 27 #endif |
| 27 | 28 |
| 28 #if defined(ENABLE_MEDIA_ROUTER) && defined(GOOGLE_CHROME_BUILD) | 29 #if defined(ENABLE_MEDIA_ROUTER) && defined(GOOGLE_CHROME_BUILD) |
| 29 #include "chrome/browser/media/router/media_router_feature.h" | 30 #include "chrome/browser/media/router/media_router_feature.h" |
| 30 #endif | 31 #endif |
| 31 | 32 |
| 32 namespace extensions { | 33 namespace extensions { |
| 33 | 34 |
| 34 ExternalComponentLoader::ExternalComponentLoader(Profile* profile) | 35 ExternalComponentLoader::ExternalComponentLoader(Profile* profile) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 51 if (!command_line->HasSwitch(chromeos::switches::kDisableNewZIPUnpacker)) | 52 if (!command_line->HasSwitch(chromeos::switches::kDisableNewZIPUnpacker)) |
| 52 AddExternalExtension(extension_misc::kZIPUnpackerExtensionId); | 53 AddExternalExtension(extension_misc::kZIPUnpackerExtensionId); |
| 53 } | 54 } |
| 54 #endif | 55 #endif |
| 55 | 56 |
| 56 #if defined(ENABLE_MEDIA_ROUTER) && defined(GOOGLE_CHROME_BUILD) | 57 #if defined(ENABLE_MEDIA_ROUTER) && defined(GOOGLE_CHROME_BUILD) |
| 57 if (media_router::MediaRouterEnabled(profile_)) | 58 if (media_router::MediaRouterEnabled(profile_)) |
| 58 AddExternalExtension(extension_misc::kMediaRouterStableExtensionId); | 59 AddExternalExtension(extension_misc::kMediaRouterStableExtensionId); |
| 59 #endif // defined(ENABLE_MEDIA_ROUTER) && defined(GOOGLE_CHROME_BUILD) | 60 #endif // defined(ENABLE_MEDIA_ROUTER) && defined(GOOGLE_CHROME_BUILD) |
| 60 | 61 |
| 61 #if defined(ENABLE_APP_LIST) && defined(OS_CHROMEOS) | 62 #if BUILDFLAG(ENABLE_APP_LIST) && defined(OS_CHROMEOS) |
| 62 std::string google_now_extension_id; | 63 std::string google_now_extension_id; |
| 63 if (GetGoogleNowExtensionId(&google_now_extension_id)) | 64 if (GetGoogleNowExtensionId(&google_now_extension_id)) |
| 64 AddExternalExtension(google_now_extension_id); | 65 AddExternalExtension(google_now_extension_id); |
| 65 #endif | 66 #endif |
| 66 | 67 |
| 67 LoadFinished(); | 68 LoadFinished(); |
| 68 } | 69 } |
| 69 | 70 |
| 70 void ExternalComponentLoader::AddExternalExtension( | 71 void ExternalComponentLoader::AddExternalExtension( |
| 71 const std::string& extension_id) { | 72 const std::string& extension_id) { |
| 72 if (!IsComponentExtensionWhitelisted(extension_id)) | 73 if (!IsComponentExtensionWhitelisted(extension_id)) |
| 73 return; | 74 return; |
| 74 | 75 |
| 75 prefs_->SetString(extension_id + ".external_update_url", | 76 prefs_->SetString(extension_id + ".external_update_url", |
| 76 extension_urls::GetWebstoreUpdateUrl().spec()); | 77 extension_urls::GetWebstoreUpdateUrl().spec()); |
| 77 } | 78 } |
| 78 | 79 |
| 79 } // namespace extensions | 80 } // namespace extensions |
| OLD | NEW |