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

Side by Side Diff: chrome/browser/resources/md_history/history_item.js

Issue 1574063003: MD History: Add basic material design history cards and history items (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed reviewer's comments & changed default values of history result Created 4 years, 11 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 2015 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 Polymer({
6 is: 'history-item',
Dan Beam 2016/01/27 03:07:31 nit: \n
yingran 2016/01/27 05:05:04 Done.
7 properties: {
8 timeAccessed: {
9 type: String,
10 value: ''
11 },
12
13 websiteTitle: {
14 type: String,
15 value: ''
16 },
17
18 // Domain is the website text shown on the history-item next to the title.
19 // Gives the user some idea of which history items are different pages
20 // belonging to the same site, and can be used to look for more items
21 // from the same site.
22 websiteDomain: {
23 type: String,
24 value: ''
25 },
26
27 // The website url is used to define where the link should take you if
28 // you click on the title, and also to define which icon the history-item
29 // should display.
30 websiteUrl: {
31 type: String,
32 value: '',
33 observer: 'showIcon_'
34 },
35
36 // If the website is a bookmarked page starred is true.
37 starred: {
38 type: Boolean,
39 value: false,
40 reflectToAttribute: true
41 },
42
43 // The time in seconds of when the website was accessed.
44 timestamp: {
45 type: Number,
46 value: 0
47 },
48
49 selected: {
50 type: Boolean,
51 value: false,
52 notify: true
53 }
54 },
55
56 /**
57 * When a history-item is selected the toolbar is notified and increases
58 * or decreases its count of selected items accordingly.
59 * @private
60 */
61 onCheckboxSelected_: function() {
62 this.fire('history-checkbox-select', {
63 countAddition: this.$.checkbox.checked ? 1 : -1
64 });
65 },
66
67 /**
68 * When the url for the history-item is set, the icon associated with this
69 * website is also set.
70 * @private
71 */
72 showIcon_: function() {
73 this.$['website-icon'].style.backgroundImage = '-webkit-image-set(' +
74 'url("chrome://favicon/size/16@1x/' + this.websiteUrl + '") 1x,' +
75 'url("chrome://favicon/size/16@2x/' + this.websiteUrl + '") 2x)';
Dan Beam 2016/01/27 03:07:31 can this use getFaviconImageSet? https://code.goo
yingran 2016/01/28 00:51:00 Done.
76 },
77
78 /**
79 * Fires a custom event when the menu button is clicked. Sends the details of
80 * the history item and where the menu should appear.
81 */
82 onMenuButtonTap_: function(e) {
83 var position = this.$['menu-button'].getBoundingClientRect();
84
85 this.fire('toggle-menu', {
86 x: position.left,
87 y: position.top,
88 accessTime: this.timestamp
89 });
Dan Beam 2016/01/27 03:07:31 nit: \n
yingran 2016/01/27 05:05:04 Done.
90 // Stops the 'tap' event from closing the menu when it opens.
91 e.stopPropagation();
92 }
93 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698