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

Side by Side Diff: android_webview/browser/command_line_helper.cc

Issue 2396803002: [Android WebView] Add functionality to enable features and enable the spellcheck feature. (Closed)
Patch Set: fix compile Created 4 years, 2 months 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
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "android_webview/browser/command_line_helper.h"
6
7 #include <vector>
8
9 #include "base/command_line.h"
10 #include "base/feature_list.h"
11 #include "base/stl_util.h"
12 #include "base/strings/string_util.h"
13 #include "content/public/common/content_switches.h"
14
15 using std::string;
16 using std::vector;
17
18 // static
19 void CommandLineHelper::AddEnabledFeature(base::CommandLine& command_line,
20 const string& feature_name) {
21 const string enabled_features_list =
22 command_line.GetSwitchValueASCII(switches::kEnableFeatures);
23 const string disabled_features_list =
24 command_line.GetSwitchValueASCII(switches::kDisableFeatures);
25
26 if (enabled_features_list.empty() && disabled_features_list.empty()) {
27 command_line.AppendSwitchASCII(switches::kEnableFeatures, feature_name);
28 return;
29 }
30
31 vector<string> enabled_features =
32 base::FeatureList::SplitFeatureListString(enabled_features_list);
33 vector<string> disabled_features =
34 base::FeatureList::SplitFeatureListString(disabled_features_list);
35
36 if (!base::ContainsValue(enabled_features, feature_name) &&
37 !base::ContainsValue(disabled_features, feature_name)) {
38 enabled_features.push_back(feature_name);
39 command_line.AppendSwitchASCII(switches::kEnableFeatures,
40 base::JoinString(enabled_features, ","));
41 }
42 }
OLDNEW
« no previous file with comments | « android_webview/browser/command_line_helper.h ('k') | android_webview/browser/command_line_helper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698