forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[settings] Present a confirmation dialog before deleting search engines.
Screenshot: https://imgur.com/RSpKUbq Bug: 1263679 Change-Id: I79f925608625b8c534dd8f00ed8aabb4f097052a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3400641 Reviewed-by: Angela Yoeurng <yoangela@chromium.org> Reviewed-by: Tommy Li <tommycli@chromium.org> Commit-Queue: Tommy Li <tommycli@chromium.org> Cr-Commit-Position: refs/heads/main@{#961683}
- Loading branch information
1 parent
c847335
commit cb2ac42
Showing
19 changed files
with
216 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...ettings_strings_grdp/IDS_SETTINGS_SEARCH_ENGINES_DELETE_CONFIRMATION_DESCRIPTION.png.sha1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0b617a1888fbe8dff256d2f67a2a85188131e319 |
1 change: 1 addition & 0 deletions
1
.../app/settings_strings_grdp/IDS_SETTINGS_SEARCH_ENGINES_DELETE_CONFIRMATION_TITLE.png.sha1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0b617a1888fbe8dff256d2f67a2a85188131e319 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
...wser/resources/settings/search_engines_page/search_engine_delete_confirmation_dialog.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<style include="settings-shared"> | ||
</style> | ||
<cr-dialog id="dialog" close-text="$i18n{close}"> | ||
<div slot="title">$i18n{searchEnginesDeleteConfirmationTitle}</div> | ||
<div slot="body">$i18n{searchEnginesDeleteConfirmationDescription}</div> | ||
<div slot="button-container"> | ||
<cr-button class="cancel-button" on-click="cancel_" id="cancelButton"> | ||
$i18n{cancel} | ||
</cr-button> | ||
<cr-button class="delete-button" on-click="delete_" id="deleteButton"> | ||
$i18n{delete} | ||
</cr-button> | ||
</div> | ||
</cr-dialog> |
84 changes: 84 additions & 0 deletions
84
...rowser/resources/settings/search_engines_page/search_engine_delete_confirmation_dialog.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
// Copyright 2022 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. | ||
|
||
/** | ||
* @fileoverview 'settings-search-engine-delete-confirmation-dialog' is a | ||
* component for confirming that the user wants to delete a search engine. | ||
*/ | ||
import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; | ||
import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; | ||
|
||
import {CrButtonElement} from 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; | ||
import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; | ||
import {WebUIListenerMixin} from 'chrome://resources/js/web_ui_listener_mixin.js'; | ||
import {html, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; | ||
|
||
import {loadTimeData} from '../i18n_setup.js'; | ||
|
||
import {SearchEngine, SearchEnginesBrowserProxy, SearchEnginesBrowserProxyImpl, SearchEnginesInfo} from './search_engines_browser_proxy.js'; | ||
|
||
export interface SettingsSearchEngineDeleteConfirmationDialogElement { | ||
$: { | ||
dialog: CrDialogElement, | ||
cancelButton: CrButtonElement, | ||
deleteButton: CrButtonElement, | ||
}; | ||
} | ||
|
||
const SettingsSearchEngineDeleteConfirmationDialogElementBase = | ||
WebUIListenerMixin(PolymerElement); | ||
|
||
export class SettingsSearchEngineDeleteConfirmationDialogElement extends | ||
SettingsSearchEngineDeleteConfirmationDialogElementBase { | ||
static get is() { | ||
return 'settings-search-engine-delete-confirmation-dialog'; | ||
} | ||
|
||
static get template() { | ||
return html`{__html_template__}`; | ||
} | ||
|
||
static get properties() { | ||
return { | ||
model: Object, | ||
|
||
isActiveSearchEnginesFlagEnabled_: { | ||
type: Boolean, | ||
value: () => | ||
loadTimeData.getBoolean('isActiveSearchEnginesFlagEnabled'), | ||
}, | ||
}; | ||
} | ||
|
||
model: SearchEngine|null; | ||
private browserProxy_: SearchEnginesBrowserProxy = | ||
SearchEnginesBrowserProxyImpl.getInstance(); | ||
|
||
connectedCallback() { | ||
super.connectedCallback(); | ||
this.$.dialog.showModal(); | ||
} | ||
|
||
private cancel_() { | ||
this.$.dialog.cancel(); | ||
} | ||
|
||
private delete_() { | ||
if (this.model) { | ||
this.browserProxy_.removeSearchEngine(this.model.modelIndex); | ||
} | ||
this.$.dialog.close(); | ||
} | ||
} | ||
|
||
declare global { | ||
interface HTMLElementTagNameMap { | ||
'settings-search-engine-delete-confirmation-dialog': | ||
SettingsSearchEngineDeleteConfirmationDialogElement; | ||
} | ||
} | ||
|
||
customElements.define( | ||
SettingsSearchEngineDeleteConfirmationDialogElement.is, | ||
SettingsSearchEngineDeleteConfirmationDialogElement); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.