Chromium Code Reviews| 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 "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/extensions/component_extensions_whitelist/whitelist.h" | 9 #include "chrome/browser/extensions/component_extensions_whitelist/whitelist.h" |
| 10 #include "chrome/browser/search/hotword_service.h" | 10 #include "chrome/browser/search/hotword_service.h" |
| 11 #include "chrome/browser/search/hotword_service_factory.h" | 11 #include "chrome/browser/search/hotword_service_factory.h" |
| 12 #include "chrome/browser/signin/signin_manager_factory.h" | 12 #include "chrome/browser/signin/signin_manager_factory.h" |
| 13 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
|
msw
2015/10/23 20:18:42
nit: remove
imcheng
2015/10/23 21:39:26
Done.
| |
| 14 #include "chrome/common/extensions/extension_constants.h" | 14 #include "chrome/common/extensions/extension_constants.h" |
| 15 #include "components/signin/core/browser/signin_manager.h" | 15 #include "components/signin/core/browser/signin_manager.h" |
| 16 #include "extensions/common/extension_urls.h" | 16 #include "extensions/common/extension_urls.h" |
| 17 #include "extensions/common/manifest.h" | 17 #include "extensions/common/manifest.h" |
| 18 | 18 |
| 19 #if defined(OS_CHROMEOS) | 19 #if defined(OS_CHROMEOS) |
| 20 #include "base/command_line.h" | 20 #include "base/command_line.h" |
| 21 #include "chromeos/chromeos_switches.h" | 21 #include "chromeos/chromeos_switches.h" |
| 22 #endif | 22 #endif |
| 23 | 23 |
| 24 #if defined(ENABLE_APP_LIST) && defined(OS_CHROMEOS) | 24 #if defined(ENABLE_APP_LIST) && defined(OS_CHROMEOS) |
| 25 #include "chrome/browser/ui/app_list/google_now_extension.h" | 25 #include "chrome/browser/ui/app_list/google_now_extension.h" |
| 26 #endif | 26 #endif |
| 27 | 27 |
| 28 #if defined(ENABLE_MEDIA_ROUTER) && defined(GOOGLE_CHROME_BUILD) | |
| 29 #include "chrome/browser/media/router/media_router_feature.h" | |
| 30 #endif | |
| 31 | |
| 28 namespace extensions { | 32 namespace extensions { |
| 29 | 33 |
| 30 ExternalComponentLoader::ExternalComponentLoader(Profile* profile) | 34 ExternalComponentLoader::ExternalComponentLoader(Profile* profile) |
| 31 : profile_(profile) { | 35 : profile_(profile) { |
| 32 } | 36 } |
| 33 | 37 |
| 34 ExternalComponentLoader::~ExternalComponentLoader() {} | 38 ExternalComponentLoader::~ExternalComponentLoader() {} |
| 35 | 39 |
| 36 void ExternalComponentLoader::StartLoading() { | 40 void ExternalComponentLoader::StartLoading() { |
| 37 prefs_.reset(new base::DictionaryValue()); | 41 prefs_.reset(new base::DictionaryValue()); |
| 38 AddExternalExtension(extension_misc::kInAppPaymentsSupportAppId); | 42 AddExternalExtension(extension_misc::kInAppPaymentsSupportAppId); |
| 39 | 43 |
| 40 if (HotwordServiceFactory::IsHotwordAllowed(profile_)) | 44 if (HotwordServiceFactory::IsHotwordAllowed(profile_)) |
| 41 AddExternalExtension(extension_misc::kHotwordSharedModuleId); | 45 AddExternalExtension(extension_misc::kHotwordSharedModuleId); |
| 42 | 46 |
| 43 #if defined(OS_CHROMEOS) | 47 #if defined(OS_CHROMEOS) |
| 44 { | 48 { |
| 45 base::CommandLine* const command_line = | 49 base::CommandLine* const command_line = |
| 46 base::CommandLine::ForCurrentProcess(); | 50 base::CommandLine::ForCurrentProcess(); |
| 47 if (!command_line->HasSwitch(chromeos::switches::kDisableNewZIPUnpacker)) | 51 if (!command_line->HasSwitch(chromeos::switches::kDisableNewZIPUnpacker)) |
| 48 AddExternalExtension(extension_misc::kZIPUnpackerExtensionId); | 52 AddExternalExtension(extension_misc::kZIPUnpackerExtensionId); |
| 49 } | 53 } |
| 50 #endif | 54 #endif |
| 51 | 55 |
| 52 #if defined(ENABLE_MEDIA_ROUTER) && defined(GOOGLE_CHROME_BUILD) | 56 #if defined(ENABLE_MEDIA_ROUTER) && defined(GOOGLE_CHROME_BUILD) |
|
msw
2015/10/23 20:18:42
Why don't other blocks check GOOGLE_CHROME_BUILD?
imcheng
2015/10/23 21:39:26
The stable extension that would be downloaded here
msw
2015/10/23 22:30:49
Acknowledged.
| |
| 53 if (switches::MediaRouterEnabled()) | 57 if (media_router::MediaRouterEnabled()) |
| 54 AddExternalExtension(extension_misc::kMediaRouterStableExtensionId); | 58 AddExternalExtension(extension_misc::kMediaRouterStableExtensionId); |
| 55 #endif // defined(ENABLE_MEDIA_ROUTER) && defined(GOOGLE_CHROME_BUILD) | 59 #endif // defined(ENABLE_MEDIA_ROUTER) && defined(GOOGLE_CHROME_BUILD) |
| 56 | 60 |
| 57 #if defined(ENABLE_APP_LIST) && defined(OS_CHROMEOS) | 61 #if defined(ENABLE_APP_LIST) && defined(OS_CHROMEOS) |
| 58 std::string google_now_extension_id; | 62 std::string google_now_extension_id; |
| 59 if (GetGoogleNowExtensionId(&google_now_extension_id)) | 63 if (GetGoogleNowExtensionId(&google_now_extension_id)) |
| 60 AddExternalExtension(google_now_extension_id); | 64 AddExternalExtension(google_now_extension_id); |
| 61 #endif | 65 #endif |
| 62 | 66 |
| 63 LoadFinished(); | 67 LoadFinished(); |
| 64 } | 68 } |
| 65 | 69 |
| 66 void ExternalComponentLoader::AddExternalExtension( | 70 void ExternalComponentLoader::AddExternalExtension( |
| 67 const std::string& extension_id) { | 71 const std::string& extension_id) { |
| 68 if (!IsComponentExtensionWhitelisted(extension_id)) | 72 if (!IsComponentExtensionWhitelisted(extension_id)) |
| 69 return; | 73 return; |
| 70 | 74 |
| 71 prefs_->SetString(extension_id + ".external_update_url", | 75 prefs_->SetString(extension_id + ".external_update_url", |
| 72 extension_urls::GetWebstoreUpdateUrl().spec()); | 76 extension_urls::GetWebstoreUpdateUrl().spec()); |
| 73 } | 77 } |
| 74 | 78 |
| 75 } // namespace extensions | 79 } // namespace extensions |
| OLD | NEW |