recentbrowsing.mjs (1882B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 import { html } from "chrome://global/content/vendor/lit.all.mjs"; 6 import { ViewPage } from "./viewpage.mjs"; 7 8 class RecentBrowsingInView extends ViewPage { 9 constructor() { 10 super(); 11 this.pageType = "recentbrowsing"; 12 } 13 14 static queries = { 15 searchTextbox: "moz-input-search", 16 }; 17 18 static properties = { 19 ...ViewPage.properties, 20 }; 21 22 viewVisibleCallback() { 23 for (let child of this.children) { 24 let childView = child.firstElementChild; 25 childView.paused = false; 26 childView.viewVisibleCallback(); 27 } 28 } 29 30 viewHiddenCallback() { 31 for (let child of this.children) { 32 let childView = child.firstElementChild; 33 childView.paused = true; 34 childView.viewHiddenCallback(); 35 } 36 } 37 38 onSearchQuery() { 39 // Individual components also listen to this event, so no need to do 40 // anything else. 41 Glean.firefoxviewNext.searchInitiatedSearch.record({ 42 page: "recentbrowsing", 43 }); 44 } 45 46 render() { 47 return html` 48 <link 49 rel="stylesheet" 50 href="chrome://browser/content/firefoxview/firefoxview.css" 51 /> 52 <div class="sticky-container bottom-fade"> 53 <h2 class="page-header" data-l10n-id="firefoxview-overview-header"></h2> 54 <div class="search-container"> 55 <moz-input-search 56 data-l10n-id="firefoxview-search-text-box-recentbrowsing" 57 data-l10n-attrs="placeholder" 58 @MozInputSearch:search=${this.onSearchQuery} 59 ></moz-input-search> 60 </div> 61 </div> 62 <div class="cards-container"> 63 <slot></slot> 64 </div> 65 `; 66 } 67 } 68 customElements.define("view-recentbrowsing", RecentBrowsingInView);