Commit be251430 authored by Sylvain Defresne's avatar Sylvain Defresne Committed by Commit Bot

Remove unconnected contextual search flag.

The flag #contextual-search is flipping a command-line switch
that is never read (the code is kept to run the unit tests but
not build in production).

Remove the flag and move the switches to the target
//ios/chrome/browser/ui/contextual_search:switches.

Bug: none
Change-Id: I121acb25fb98b599f109abd827a763253fd1e1c1
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Reviewed-on: https://chromium-review.googlesource.com/833937Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#525296}
parent 4a2d4efa
......@@ -110,10 +110,6 @@ const FeatureEntry::Choice kUseDdljsonApiChoices[] = {
//
// When adding a new choice, add it to the end of the list.
const flags_ui::FeatureEntry kFeatureEntries[] = {
{"contextual-search", flag_descriptions::kContextualSearch,
flag_descriptions::kContextualSearchDescription, flags_ui::kOsIos,
ENABLE_DISABLE_VALUE_TYPE(switches::kEnableContextualSearch,
switches::kDisableContextualSearch)},
{"browser-task-scheduler", flag_descriptions::kBrowserTaskScheduler,
flag_descriptions::kBrowserTaskSchedulerDescription, flags_ui::kOsIos,
ENABLE_DISABLE_VALUE_TYPE(switches::kEnableBrowserTaskScheduler,
......
......@@ -12,9 +12,6 @@ namespace switches {
// all work out.
// -----------------------------------------------------------------------------
// Disables Contextual Search.
const char kDisableContextualSearch[] = "disable-contextual-search";
// Disable showing available password credentials in the keyboard accessory
// view when focused on form fields.
const char kDisableIOSPasswordSuggestions[] =
......@@ -24,9 +21,6 @@ const char kDisableIOSPasswordSuggestions[] =
const char kDisableThirdPartyKeyboardWorkaround[] =
"disable-third-party-keyboard-workaround";
// Enables Contextual Search.
const char kEnableContextualSearch[] = "enable-contextual-search";
// Enables support for Handoff from Chrome on iOS to the default browser of
// other Apple devices.
const char kEnableIOSHandoffToOtherDevices[] =
......
......@@ -9,12 +9,10 @@
namespace switches {
extern const char kDisableContextualSearch[];
extern const char kDisableIOSPasswordSuggestions[];
extern const char kDisableNTPFavicons[];
extern const char kDisableThirdPartyKeyboardWorkaround[];
extern const char kEnableContextualSearch[];
extern const char kEnableIOSHandoffToOtherDevices[];
extern const char kEnableNTPFavicons[];
extern const char kEnableSpotlightActions[];
......
......@@ -7,7 +7,6 @@
#include <memory>
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/memory/ptr_util.h"
......@@ -24,7 +23,6 @@
#include "ios/chrome/browser/bookmarks/bookmark_new_generation_features.h"
#import "ios/chrome/browser/browser_state/test_chrome_browser_state.h"
#include "ios/chrome/browser/chrome_paths.h"
#include "ios/chrome/browser/chrome_switches.h"
#include "ios/chrome/browser/chrome_url_constants.h"
#include "ios/chrome/browser/favicon/ios_chrome_large_icon_service_factory.h"
#include "ios/chrome/browser/search_engines/template_url_service_factory.h"
......@@ -211,13 +209,6 @@ class BrowserViewControllerTest : public BlockCleanupTest {
protected:
void SetUp() override {
BlockCleanupTest::SetUp();
// Disable Contextual Search on the command line.
if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableContextualSearch)) {
base::CommandLine::ForCurrentProcess()->AppendSwitch(
switches::kDisableContextualSearch);
}
// Set up a TestChromeBrowserState instance.
TestChromeBrowserState::Builder test_cbs_builder;
test_cbs_builder.AddTestingFactory(
......
......@@ -20,6 +20,14 @@ bundle_data("resources_unit_tests") {
]
}
source_set("switches") {
configs += [ "//build/config/compiler:enable_arc" ]
sources = [
"switches.cc",
"switches.h",
]
}
source_set("contextual_search") {
configs += [ "//build/config/compiler:enable_arc" ]
sources = [
......@@ -43,6 +51,7 @@ source_set("contextual_search") {
]
deps = [
":injected_js",
":switches",
"//base",
"//components/google/core/browser",
"//components/prefs",
......@@ -99,6 +108,7 @@ source_set("unit_tests") {
deps = [
":contextual_search",
":resources_unit_tests",
":switches",
":test_support",
"//base",
"//base/test:test_support",
......
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ios/chrome/browser/ui/contextual_search/switches.h"
namespace contextual_search {
namespace switches {
// Disables Contextual Search.
const char kDisableContextualSearch[] = "disable-contextual-search";
// Enables Contextual Search.
const char kEnableContextualSearch[] = "enable-contextual-search";
} // namespace switches
} // namespace contextual_search
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_CHROME_BROWSER_UI_CONTEXTUAL_SEARCH_SWITCHES_H_
#define IOS_CHROME_BROWSER_UI_CONTEXTUAL_SEARCH_SWITCHES_H_
namespace contextual_search {
namespace switches {
extern const char kDisableContextualSearch[];
extern const char kEnableContextualSearch[];
} // namespace switches
} // namespace contextual_search
#endif // IOS_CHROME_BROWSER_UI_CONTEXTUAL_SEARCH_SWITCHES_H_
......@@ -13,12 +13,12 @@
#include "components/search_engines/template_url_service.h"
#include "ios/chrome/app/tests_hook.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state.h"
#include "ios/chrome/browser/chrome_switches.h"
#include "ios/chrome/browser/pref_names.h"
#import "ios/chrome/browser/prefs/pref_observer_bridge.h"
#include "ios/chrome/browser/search_engines/template_url_service_factory.h"
#include "ios/chrome/browser/sync/sync_setup_service.h"
#include "ios/chrome/browser/sync/sync_setup_service_factory.h"
#include "ios/chrome/browser/ui/contextual_search/switches.h"
#include "net/base/network_change_notifier.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
......@@ -66,19 +66,21 @@ const struct {
@synthesize observing = _observing;
+ (BOOL)isTouchToSearchAvailableOnDevice {
// By default the feature is not available. If the enable flag
// (switches::kEnableContextualSearch) is flipped, then it is available.
// The disable switch (switches::kDisableContextualSearch) is also supported,
// although it is only useful when Finch experiments are also supported.
// By default the feature is not available.
// - If the enable flag (contextual_search::switches::kEnableContextualSearch)
// is flipped, then it is available.
// - A disable switch (contextual_search::switches::kDisableContextualSearch)
// is also supported, although it is only useful when Finch experiments are
// also supported.
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableContextualSearch)) {
contextual_search::switches::kDisableContextualSearch)) {
// If both enable and disable flags are present, disable wins.
return NO;
}
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableContextualSearch)) {
contextual_search::switches::kEnableContextualSearch)) {
// Even if the command line flag is flipped, don't enable the feature if
// test hooks disable it.
return !tests_hook::DisableContextualSearch();
......
......@@ -19,13 +19,13 @@
#include "components/search_engines/template_url_data.h"
#include "components/search_engines/template_url_service.h"
#include "ios/chrome/browser/browser_state/test_chrome_browser_state.h"
#include "ios/chrome/browser/chrome_switches.h"
#include "ios/chrome/browser/pref_names.h"
#include "ios/chrome/browser/search_engines/template_url_service_factory.h"
#include "ios/chrome/browser/sync/ios_chrome_profile_sync_service_factory.h"
#include "ios/chrome/browser/sync/ios_chrome_profile_sync_test_util.h"
#include "ios/chrome/browser/sync/sync_setup_service_factory.h"
#include "ios/chrome/browser/sync/sync_setup_service_mock.h"
#include "ios/chrome/browser/ui/contextual_search/switches.h"
#import "ios/chrome/browser/ui/contextual_search/touch_to_search_permissions_mediator+testing.h"
#include "ios/web/public/test/test_web_thread_bundle.h"
#include "net/base/network_change_notifier.h"
......@@ -545,11 +545,11 @@ TEST_F(TouchToSearchPermissionsAvailabilityTest, CommandLinePermissions) {
base::CommandLine::ForCurrentProcess()->InitFromArgv(0, NULL);
if (test.set_disable) {
base::CommandLine::ForCurrentProcess()->AppendSwitch(
switches::kDisableContextualSearch);
contextual_search::switches::kDisableContextualSearch);
}
if (test.set_enable) {
base::CommandLine::ForCurrentProcess()->AppendSwitch(
switches::kEnableContextualSearch);
contextual_search::switches::kEnableContextualSearch);
}
EXPECT_EQ(
[TouchToSearchPermissionsMediator isTouchToSearchAvailableOnDevice],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment