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 bool is_on_unknown_channel = chrome::VersionInfo::GetChannel() == | |
525 chrome::VersionInfo::CHANNEL_UNKNOWN; | |
526 | |
524 bool enabled_via_flag = | 527 bool enabled_via_flag = |
525 chrome::VersionInfo::GetChannel() != | 528 chrome::VersionInfo::GetChannel() != |
526 chrome::VersionInfo::CHANNEL_STABLE && | 529 chrome::VersionInfo::CHANNEL_STABLE && |
527 CommandLine::ForCurrentProcess()->HasSwitch( | 530 CommandLine::ForCurrentProcess()->HasSwitch( |
528 switches::kEnableGoogleNowIntegration); | 531 switches::kEnableGoogleNowIntegration); |
529 | 532 |
530 bool disabled_via_flag = | 533 bool disabled_via_flag = |
531 CommandLine::ForCurrentProcess()->HasSwitch( | 534 CommandLine::ForCurrentProcess()->HasSwitch( |
532 switches::kDisableGoogleNowIntegration); | 535 switches::kDisableGoogleNowIntegration); |
533 | 536 |
534 if ((enabled_via_field_trial && !disabled_via_flag) || enabled_via_flag) { | 537 bool enabled_via_field_trial_or_on_unknown_channel = |
Alexei Svitkine (slow)
2013/11/01 17:56:01
Nit: move this right below |is_on_unknown_channel|
vadimt
2013/11/01 18:03:51
Done.
| |
538 enabled_via_field_trial || is_on_unknown_channel; | |
539 | |
540 if ((enabled_via_field_trial_or_on_unknown_channel && !disabled_via_flag) || | |
541 enabled_via_flag) { | |
535 Add(IDR_GOOGLE_NOW_MANIFEST, | 542 Add(IDR_GOOGLE_NOW_MANIFEST, |
536 base::FilePath(FILE_PATH_LITERAL("google_now"))); | 543 base::FilePath(FILE_PATH_LITERAL("google_now"))); |
537 } | 544 } |
538 #endif | 545 #endif |
539 } | 546 } |
540 | 547 |
541 void ComponentLoader::UnloadComponent(ComponentExtensionInfo* component) { | 548 void ComponentLoader::UnloadComponent(ComponentExtensionInfo* component) { |
542 delete component->manifest; | 549 delete component->manifest; |
543 if (extension_service_->is_ready()) { | 550 if (extension_service_->is_ready()) { |
544 extension_service_-> | 551 extension_service_-> |
545 RemoveComponentExtension(component->extension_id); | 552 RemoveComponentExtension(component->extension_id); |
546 } | 553 } |
547 } | 554 } |
548 | 555 |
549 } // namespace extensions | 556 } // namespace extensions |
OLD | NEW |