Skip to content

Commit

Permalink
[Site search policy] Introduce SiteSearchSettings policy
Browse files Browse the repository at this point in the history
This CL introduces the SiteSearchEngines policy that allows admins to
customize site search.

Policy handler will be sent in a separate CL. Description will soon be
reviewed by UXW, but I'd like to submit this sooner to unblock the next
tasks.

Useful links:
- PRD: go/cbe-sitesearch-prd
- DD:  go/cbe-sitesearch-dd

Bug: b:306199744
Change-Id: I4aa297f15412d8b4499884051c5cc988a57e0816
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4950101
Reviewed-by: Maksim Ivanov <emaxx@chromium.org>
Commit-Queue: Fabio Tirelo <ftirelo@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1212749}
  • Loading branch information
Fabio Tirelo authored and Chromium LUCI CQ committed Oct 20, 2023
1 parent 33acd9a commit 7d22b72
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 0 deletions.
1 change: 1 addition & 0 deletions components/policy/resources/templates/policies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1174,6 +1174,7 @@ policies:
1173: UserFeedbackWithLowLevelDebugDataAllowed
1174: MicrosoftOneDriveAccountRestrictions
1175: DeviceFlexHwDataForProductImprovementEnabled
1176: SiteSearchSettings
atomic_groups:
1: Homepage
2: RemoteAccess
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
caption: Site search settings
desc: |-
This policy provides a list of site searches where the user can search on a specific site. Users can initiate the search by typing the shortcut or @shortcut (e.g. @work) in the address bar.
The following fields are required for each entry: name, shortcut, url. Shortcuts in the list must be unique and must not contain spaces. Prepending @ to a shortcut is optional, so the resulting shortcut is considered the same as the shortcut without the @; for example "work" and "@work" are considered the same shortcut.
For each entry, the url field specifies the URL of the search engine used during a search with the corresponding keyword. The URL must include the string <ph name="SEARCH_TERM_MARKER">‘{searchTerms}’</ph>, replaced in the query by the user's search terms. Invalid entries and entries with duplicate shortcuts are ignored.
Site search entries configured as featured are displayed in the address bar when the user types "@". Up to three entries can be selected as featured.
Users cannot edit or disable site search entries set by policy, but they can add new shortcuts for the same URL. In addition, users cannot create new site search entries with a shortcut previously created via policy.
In case of conflict with a shortcut previously created by the user, the user setting is respected. However, users can still trigger the option created by policy by typing "@" in the search bar. For example, if the user already defined "work" as a shortcut to URL1 and the policy defines "work" as a shortcut to URL2, then typing "work" in the search bar will trigger a search to URL1, but typing "@work" in the search bar will trigger a search to URL2.
example_value:
- featured: true
name: Google Wikipedia
shortcut: wikipedia
url: https://www.google.com/search?q=site%3Awikipedia.com+%s
- name: YouTube
shortcut: youtube
url: https://www.youtube.com/results?search_query=%s
features:
dynamic_refresh: true
per_profile: true
future_on:
- chrome.*
- chrome_os
owners:
- ftirelo@chromium.org
- pastarmovj@chromium.org
schema:
type: array
items:
type: object
properties:
featured:
type: boolean
name:
type: string
shortcut:
type: string
url:
type: string
required:
- shortcut
- name
- url
tags: []
type: dict
3 changes: 3 additions & 0 deletions components/policy/test/data/policy_test_cases.json
Original file line number Diff line number Diff line change
Expand Up @@ -25571,5 +25571,8 @@
},
"DeviceFlexHwDataForProductImprovementEnabled": {
"reason_for_missing_test": "ChromeOS Flex device policy only read by services, not used in Chrome."
},
"SiteSearchSettings": {
"reason_for_missing_test": "TODO(b/306201833): enable this policy test once policy handler is implemented"
}
}
1 change: 1 addition & 0 deletions tools/metrics/histograms/enums.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34061,6 +34061,7 @@ Called by update_document_policy_enum.py.-->
<int value="1173" label="UserFeedbackWithLowLevelDebugDataAllowed"/>
<int value="1174" label="MicrosoftOneDriveAccountRestrictions"/>
<int value="1175" label="DeviceFlexHwDataForProductImprovementEnabled"/>
<int value="1176" label="SiteSearchSettings"/>
</enum>

<enum name="EnterprisePoliciesSources">
Expand Down

0 comments on commit 7d22b72

Please sign in to comment.