Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Side by Side Diff: chrome/browser/extensions/component_loader.cc

Issue 47493005: Turn off enabling Google Now via flag in Stable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/json/json_string_value_serializer.h" 12 #include "base/json/json_string_value_serializer.h"
13 #include "base/metrics/field_trial.h" 13 #include "base/metrics/field_trial.h"
14 #include "base/path_service.h" 14 #include "base/path_service.h"
15 #include "base/prefs/pref_change_registrar.h" 15 #include "base/prefs/pref_change_registrar.h"
16 #include "chrome/browser/chrome_notification_types.h" 16 #include "chrome/browser/chrome_notification_types.h"
17 #include "chrome/browser/extensions/extension_service.h" 17 #include "chrome/browser/extensions/extension_service.h"
18 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/common/chrome_paths.h" 19 #include "chrome/common/chrome_paths.h"
20 #include "chrome/common/chrome_switches.h" 20 #include "chrome/common/chrome_switches.h"
21 #include "chrome/common/chrome_version_info.h"
21 #include "chrome/common/extensions/extension.h" 22 #include "chrome/common/extensions/extension.h"
22 #include "chrome/common/extensions/extension_file_util.h" 23 #include "chrome/common/extensions/extension_file_util.h"
23 #include "chrome/common/pref_names.h" 24 #include "chrome/common/pref_names.h"
24 #include "content/public/browser/notification_details.h" 25 #include "content/public/browser/notification_details.h"
25 #include "content/public/browser/notification_source.h" 26 #include "content/public/browser/notification_source.h"
26 #include "extensions/common/id_util.h" 27 #include "extensions/common/id_util.h"
27 #include "extensions/common/manifest_constants.h" 28 #include "extensions/common/manifest_constants.h"
28 #include "grit/browser_resources.h" 29 #include "grit/browser_resources.h"
29 #include "grit/generated_resources.h" 30 #include "grit/generated_resources.h"
30 #include "ui/base/l10n/l10n_util.h" 31 #include "ui/base/l10n/l10n_util.h"
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 Add(IDR_CHROMEVOX_MANIFEST, path); 508 Add(IDR_CHROMEVOX_MANIFEST, path);
508 } 509 }
509 #endif // defined(OS_CHROMEOS) 510 #endif // defined(OS_CHROMEOS)
510 511
511 #if defined(ENABLE_GOOGLE_NOW) 512 #if defined(ENABLE_GOOGLE_NOW)
512 const char kEnablePrefix[] = "Enable"; 513 const char kEnablePrefix[] = "Enable";
513 const char kFieldTrialName[] = "GoogleNow"; 514 const char kFieldTrialName[] = "GoogleNow";
514 std::string enable_prefix(kEnablePrefix); 515 std::string enable_prefix(kEnablePrefix);
515 std::string field_trial_result = 516 std::string field_trial_result =
516 base::FieldTrialList::FindFullName(kFieldTrialName); 517 base::FieldTrialList::FindFullName(kFieldTrialName);
517 if (((field_trial_result.compare( 518
518 0, 519 bool enabled_via_field_trial = field_trial_result.compare(
519 enable_prefix.length(), 520 0,
520 enable_prefix) == 0) && 521 enable_prefix.length(),
521 !CommandLine::ForCurrentProcess()->HasSwitch( 522 enable_prefix) == 0;
522 switches::kDisableGoogleNowIntegration)) || 523
523 CommandLine::ForCurrentProcess()->HasSwitch( 524 bool enabled_via_flag =
524 switches::kEnableGoogleNowIntegration)) { 525 chrome::VersionInfo::GetChannel() !=
526 chrome::VersionInfo::CHANNEL_STABLE &&
527 CommandLine::ForCurrentProcess()->HasSwitch(
528 switches::kEnableGoogleNowIntegration);
529
530 bool disabled_via_flag =
531 CommandLine::ForCurrentProcess()->HasSwitch(
532 switches::kDisableGoogleNowIntegration);
533
534 if ((enabled_via_field_trial && !disabled_via_flag) || enabled_via_flag) {
525 Add(IDR_GOOGLE_NOW_MANIFEST, 535 Add(IDR_GOOGLE_NOW_MANIFEST,
526 base::FilePath(FILE_PATH_LITERAL("google_now"))); 536 base::FilePath(FILE_PATH_LITERAL("google_now")));
527 } 537 }
528 #endif 538 #endif
529 } 539 }
530 540
531 void ComponentLoader::UnloadComponent(ComponentExtensionInfo* component) { 541 void ComponentLoader::UnloadComponent(ComponentExtensionInfo* component) {
532 delete component->manifest; 542 delete component->manifest;
533 if (extension_service_->is_ready()) { 543 if (extension_service_->is_ready()) {
534 extension_service_-> 544 extension_service_->
535 RemoveComponentExtension(component->extension_id); 545 RemoveComponentExtension(component->extension_id);
536 } 546 }
537 } 547 }
538 548
539 } // namespace extensions 549 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698