| 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 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 const char kFieldTrialName[] = "GoogleNow"; | 519 const char kFieldTrialName[] = "GoogleNow"; |
| 520 std::string enable_prefix(kEnablePrefix); | 520 std::string enable_prefix(kEnablePrefix); |
| 521 std::string field_trial_result = | 521 std::string field_trial_result = |
| 522 base::FieldTrialList::FindFullName(kFieldTrialName); | 522 base::FieldTrialList::FindFullName(kFieldTrialName); |
| 523 | 523 |
| 524 bool enabled_via_field_trial = field_trial_result.compare( | 524 bool enabled_via_field_trial = field_trial_result.compare( |
| 525 0, | 525 0, |
| 526 enable_prefix.length(), | 526 enable_prefix.length(), |
| 527 enable_prefix) == 0; | 527 enable_prefix) == 0; |
| 528 | 528 |
| 529 // Enable the feature on trybots. |
| 530 bool enabled_via_trunk_build = chrome::VersionInfo::GetChannel() == |
| 531 chrome::VersionInfo::CHANNEL_UNKNOWN; |
| 532 |
| 529 bool enabled_via_flag = | 533 bool enabled_via_flag = |
| 530 chrome::VersionInfo::GetChannel() != | 534 chrome::VersionInfo::GetChannel() != |
| 531 chrome::VersionInfo::CHANNEL_STABLE && | 535 chrome::VersionInfo::CHANNEL_STABLE && |
| 532 CommandLine::ForCurrentProcess()->HasSwitch( | 536 CommandLine::ForCurrentProcess()->HasSwitch( |
| 533 switches::kEnableGoogleNowIntegration); | 537 switches::kEnableGoogleNowIntegration); |
| 534 | 538 |
| 539 bool enabled = |
| 540 enabled_via_field_trial || enabled_via_trunk_build || enabled_via_flag; |
| 541 |
| 535 bool disabled_via_flag = | 542 bool disabled_via_flag = |
| 536 CommandLine::ForCurrentProcess()->HasSwitch( | 543 CommandLine::ForCurrentProcess()->HasSwitch( |
| 537 switches::kDisableGoogleNowIntegration); | 544 switches::kDisableGoogleNowIntegration); |
| 538 | 545 |
| 539 if ((enabled_via_field_trial && !disabled_via_flag) || enabled_via_flag) { | 546 if (enabled && !disabled_via_flag) { |
| 540 Add(IDR_GOOGLE_NOW_MANIFEST, | 547 Add(IDR_GOOGLE_NOW_MANIFEST, |
| 541 base::FilePath(FILE_PATH_LITERAL("google_now"))); | 548 base::FilePath(FILE_PATH_LITERAL("google_now"))); |
| 542 } | 549 } |
| 543 #endif | 550 #endif |
| 544 | 551 |
| 545 #if defined(GOOGLE_CHROME_BUILD) | 552 #if defined(GOOGLE_CHROME_BUILD) |
| 546 AddNetworkSpeechSynthesisExtension(); | 553 AddNetworkSpeechSynthesisExtension(); |
| 547 #endif // defined(GOOGLE_CHROME_BUILD) | 554 #endif // defined(GOOGLE_CHROME_BUILD) |
| 548 } | 555 } |
| 549 | 556 |
| 550 void ComponentLoader::UnloadComponent(ComponentExtensionInfo* component) { | 557 void ComponentLoader::UnloadComponent(ComponentExtensionInfo* component) { |
| 551 delete component->manifest; | 558 delete component->manifest; |
| 552 if (extension_service_->is_ready()) { | 559 if (extension_service_->is_ready()) { |
| 553 extension_service_-> | 560 extension_service_-> |
| 554 RemoveComponentExtension(component->extension_id); | 561 RemoveComponentExtension(component->extension_id); |
| 555 } | 562 } |
| 556 } | 563 } |
| 557 | 564 |
| 558 } // namespace extensions | 565 } // namespace extensions |
| OLD | NEW |