Chromium Code Reviews| 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 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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); |
| 518 | 518 |
| 519 bool enabled_via_field_trial = field_trial_result.compare( | 519 bool enabled_via_field_trial = field_trial_result.compare( |
| 520 0, | 520 0, |
| 521 enable_prefix.length(), | 521 enable_prefix.length(), |
| 522 enable_prefix) == 0; | 522 enable_prefix) == 0; |
| 523 | 523 |
| 524 // Enable the feature on trybots. | |
| 525 bool is_on_unknown_channel = chrome::VersionInfo::GetChannel() == | |
| 526 chrome::VersionInfo::CHANNEL_UNKNOWN; | |
| 527 | |
| 528 bool enabled_via_field_trial_or_on_unknown_channel = | |
| 529 enabled_via_field_trial || is_on_unknown_channel; | |
| 530 | |
| 524 bool enabled_via_flag = | 531 bool enabled_via_flag = |
| 525 chrome::VersionInfo::GetChannel() != | 532 chrome::VersionInfo::GetChannel() != |
| 526 chrome::VersionInfo::CHANNEL_STABLE && | 533 chrome::VersionInfo::CHANNEL_STABLE && |
| 527 CommandLine::ForCurrentProcess()->HasSwitch( | 534 CommandLine::ForCurrentProcess()->HasSwitch( |
| 528 switches::kEnableGoogleNowIntegration); | 535 switches::kEnableGoogleNowIntegration); |
| 529 | 536 |
| 530 bool disabled_via_flag = | 537 bool disabled_via_flag = |
| 531 CommandLine::ForCurrentProcess()->HasSwitch( | 538 CommandLine::ForCurrentProcess()->HasSwitch( |
| 532 switches::kDisableGoogleNowIntegration); | 539 switches::kDisableGoogleNowIntegration); |
| 533 | 540 |
| 534 if ((enabled_via_field_trial && !disabled_via_flag) || enabled_via_flag) { | 541 if ((enabled_via_field_trial_or_on_unknown_channel && !disabled_via_flag) || |
| 542 enabled_via_flag) { | |
|
not at google - send to devlin
2013/11/01 18:15:22
This is getting increasingly hard to follow. How a
vadimt
2013/11/01 19:57:21
Done.
| |
| 535 Add(IDR_GOOGLE_NOW_MANIFEST, | 543 Add(IDR_GOOGLE_NOW_MANIFEST, |
| 536 base::FilePath(FILE_PATH_LITERAL("google_now"))); | 544 base::FilePath(FILE_PATH_LITERAL("google_now"))); |
| 537 } | 545 } |
| 538 #endif | 546 #endif |
| 539 } | 547 } |
| 540 | 548 |
| 541 void ComponentLoader::UnloadComponent(ComponentExtensionInfo* component) { | 549 void ComponentLoader::UnloadComponent(ComponentExtensionInfo* component) { |
| 542 delete component->manifest; | 550 delete component->manifest; |
| 543 if (extension_service_->is_ready()) { | 551 if (extension_service_->is_ready()) { |
| 544 extension_service_-> | 552 extension_service_-> |
| 545 RemoveComponentExtension(component->extension_id); | 553 RemoveComponentExtension(component->extension_id); |
| 546 } | 554 } |
| 547 } | 555 } |
| 548 | 556 |
| 549 } // namespace extensions | 557 } // namespace extensions |
| OLD | NEW |