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

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

Issue 68173031: Added enhanced bookmarks extension as an external component extension (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/external_component_loader.h" 5 #include "chrome/browser/extensions/external_component_loader.h"
6 6
7 #include "base/command_line.h"
8 #include "base/metrics/field_trial.h"
7 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/common/chrome_switches.h"
8 #include "chrome/common/extensions/extension_constants.h" 11 #include "chrome/common/extensions/extension_constants.h"
12 #include "components/variations/variations_associated_data.h"
13 #include "extensions/common/features/feature.h"
14 #include "extensions/common/features/feature_provider.h"
9 15
10 namespace extensions { 16 namespace extensions {
11 17
18 const char kFieldTrialName[] = "EnhancedBookmarks";
19
12 ExternalComponentLoader::ExternalComponentLoader() {} 20 ExternalComponentLoader::ExternalComponentLoader() {}
13 21
14 ExternalComponentLoader::~ExternalComponentLoader() {} 22 ExternalComponentLoader::~ExternalComponentLoader() {}
15 23
24 // This function will be removed after experiment goes to all users or go away.
25 bool ExternalComponentLoader::IsEnhancedBookmarksExperimentEnabled() {
26 const char kFieldTrialDefaultGroupName[] = "Default";
27 std::string field_trial_group_name =
28 base::FieldTrialList::FindFullName(kFieldTrialName);
29 if (field_trial_group_name.empty() ||
30 field_trial_group_name == kFieldTrialDefaultGroupName) {
31 return false;
32 }
33 std::string app_id =
34 chrome_variations::GetVariationParamValue(kFieldTrialName, "id");
35 FeatureProvider* feature_provider = FeatureProvider::GetPermissionFeatures();
36 Feature* feature = feature_provider->GetFeature("metricsPrivate");
37 return (feature && feature->IsIdInWhitelist(app_id));
38 }
39
16 void ExternalComponentLoader::StartLoading() { 40 void ExternalComponentLoader::StartLoading() {
17 prefs_.reset(new base::DictionaryValue()); 41 prefs_.reset(new base::DictionaryValue());
18 std::string appId = extension_misc::kInAppPaymentsSupportAppId; 42 std::string appId = extension_misc::kInAppPaymentsSupportAppId;
19 prefs_->SetString(appId + ".external_update_url", 43 prefs_->SetString(appId + ".external_update_url",
20 extension_urls::GetWebstoreUpdateUrl().spec()); 44 extension_urls::GetWebstoreUpdateUrl().spec());
45
46 if (IsEnhancedBookmarksExperimentEnabled() &&
47 (CommandLine::ForCurrentProcess()->
48 GetSwitchValueASCII(switches::kEnableEnhancedBookmarks) != "0")) {
49 std::string app_id =
50 chrome_variations::GetVariationParamValue(kFieldTrialName, "id");
51 prefs_->SetString(app_id + ".external_update_url",
meacer 2013/11/26 01:32:03 Can we restrict the update url to Web Store for al
52 extension_urls::GetWebstoreUpdateUrl().spec());
53 }
21 LoadFinished(); 54 LoadFinished();
22 } 55 }
23 56
24 } // namespace extensions 57 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698