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/component_loader.h" | 5 #include "chrome/browser/extensions/component_loader.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
507 base::FilePath(extension_misc::kChromeVoxExtensionPath); | 507 base::FilePath(extension_misc::kChromeVoxExtensionPath); |
508 Add(IDR_CHROMEVOX_MANIFEST, path); | 508 Add(IDR_CHROMEVOX_MANIFEST, path); |
509 } | 509 } |
510 #endif // defined(OS_CHROMEOS) | 510 #endif // defined(OS_CHROMEOS) |
511 | 511 |
512 #if defined(ENABLE_GOOGLE_NOW) | 512 #if defined(ENABLE_GOOGLE_NOW) |
513 const char kEnablePrefix[] = "Enable"; | 513 const char kEnablePrefix[] = "Enable"; |
514 const char kFieldTrialName[] = "GoogleNow"; | 514 const char kFieldTrialName[] = "GoogleNow"; |
515 std::string enable_prefix(kEnablePrefix); | 515 std::string enable_prefix(kEnablePrefix); |
516 std::string field_trial_result = | 516 std::string field_trial_result = |
517 base::FieldTrialList::FindFullName(kFieldTrialName); | 517 base::FieldTrialList::FindFullName(kFieldTrialName); |
Alexei Svitkine (slow)
2013/11/01 15:16:37
It seems this logic is also duplicated in geolocat
vadimt
2013/11/01 17:48:19
In geolocation, the code is pretty dead, and that
| |
518 | 518 |
519 bool enabled_via_field_trial = field_trial_result.compare( | 519 bool enabled_via_field_trial = |
520 0, | 520 field_trial_result.empty() || |
Alexei Svitkine (slow)
2013/11/01 15:16:37
Not convinced this is a good solution - for exampl
vadimt
2013/11/01 17:48:19
Done. I chose the second approach, since this is t
| |
521 enable_prefix.length(), | 521 field_trial_result.compare( |
522 enable_prefix) == 0; | 522 0, |
523 enable_prefix.length(), | |
524 enable_prefix) == 0; | |
523 | 525 |
524 bool enabled_via_flag = | 526 bool enabled_via_flag = |
525 chrome::VersionInfo::GetChannel() != | 527 chrome::VersionInfo::GetChannel() != |
526 chrome::VersionInfo::CHANNEL_STABLE && | 528 chrome::VersionInfo::CHANNEL_STABLE && |
527 CommandLine::ForCurrentProcess()->HasSwitch( | 529 CommandLine::ForCurrentProcess()->HasSwitch( |
528 switches::kEnableGoogleNowIntegration); | 530 switches::kEnableGoogleNowIntegration); |
529 | 531 |
530 bool disabled_via_flag = | 532 bool disabled_via_flag = |
531 CommandLine::ForCurrentProcess()->HasSwitch( | 533 CommandLine::ForCurrentProcess()->HasSwitch( |
532 switches::kDisableGoogleNowIntegration); | 534 switches::kDisableGoogleNowIntegration); |
533 | 535 |
534 if ((enabled_via_field_trial && !disabled_via_flag) || enabled_via_flag) { | 536 if ((enabled_via_field_trial && !disabled_via_flag) || enabled_via_flag) { |
535 Add(IDR_GOOGLE_NOW_MANIFEST, | 537 Add(IDR_GOOGLE_NOW_MANIFEST, |
536 base::FilePath(FILE_PATH_LITERAL("google_now"))); | 538 base::FilePath(FILE_PATH_LITERAL("google_now"))); |
537 } | 539 } |
538 #endif | 540 #endif |
539 } | 541 } |
540 | 542 |
541 void ComponentLoader::UnloadComponent(ComponentExtensionInfo* component) { | 543 void ComponentLoader::UnloadComponent(ComponentExtensionInfo* component) { |
542 delete component->manifest; | 544 delete component->manifest; |
543 if (extension_service_->is_ready()) { | 545 if (extension_service_->is_ready()) { |
544 extension_service_-> | 546 extension_service_-> |
545 RemoveComponentExtension(component->extension_id); | 547 RemoveComponentExtension(component->extension_id); |
546 } | 548 } |
547 } | 549 } |
548 | 550 |
549 } // namespace extensions | 551 } // namespace extensions |
OLD | NEW |