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

Side by Side Diff: chrome/browser/ui/app_list/search/app_result.cc

Issue 2949413002: Show separator in SearchResultTileItemListView (Closed)
Patch Set: Remove SearchResultSeparator Created 3 years, 6 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
« no previous file with comments | « no previous file | ui/app_list/app_list_constants.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/app_list/search/app_result.h" 5 #include "chrome/browser/ui/app_list/search/app_result.h"
6 6
7 #include "base/time/time.h" 7 #include "base/time/time.h"
8 #include "ui/app_list/app_list_switches.h" 8 #include "ui/app_list/app_list_switches.h"
9 9
10 namespace app_list { 10 namespace app_list {
11 11
12 AppResult::AppResult(Profile* profile, 12 AppResult::AppResult(Profile* profile,
13 const std::string& app_id, 13 const std::string& app_id,
14 AppListControllerDelegate* controller, 14 AppListControllerDelegate* controller,
15 bool is_recommendation) 15 bool is_recommendation)
16 : profile_(profile), 16 : profile_(profile),
17 app_id_(app_id), 17 app_id_(app_id),
18 controller_(controller) { 18 controller_(controller) {
19 set_display_type(is_recommendation ? DISPLAY_RECOMMENDATION : DISPLAY_TILE); 19 set_display_type(is_recommendation ? DISPLAY_RECOMMENDATION : DISPLAY_TILE);
20 set_result_type(RESULT_INSTALLED_APP);
20 } 21 }
21 22
22 AppResult::~AppResult() { 23 AppResult::~AppResult() {
23 } 24 }
24 25
25 void AppResult::UpdateFromLastLaunchedOrInstalledTime( 26 void AppResult::UpdateFromLastLaunchedOrInstalledTime(
26 const base::Time& current_time, 27 const base::Time& current_time,
27 const base::Time& old_time) { 28 const base::Time& old_time) {
28 // |current_time| can be before |old_time| in weird cases such as users 29 // |current_time| can be before |old_time| in weird cases such as users
29 // playing with their clocks. Handle this gracefully. 30 // playing with their clocks. Handle this gracefully.
30 if (current_time < old_time) { 31 if (current_time < old_time) {
31 set_relevance(1.0); 32 set_relevance(1.0);
32 return; 33 return;
33 } 34 }
34 35
35 base::TimeDelta delta = current_time - old_time; 36 base::TimeDelta delta = current_time - old_time;
36 const int kSecondsInWeek = 60 * 60 * 24 * 7; 37 const int kSecondsInWeek = 60 * 60 * 24 * 7;
37 38
38 // Set the relevance to a value between 0 and 1. This function decays as the 39 // Set the relevance to a value between 0 and 1. This function decays as the
39 // time delta increases and reaches a value of 0.5 at 1 week. 40 // time delta increases and reaches a value of 0.5 at 1 week.
40 set_relevance(1 / (1 + delta.InSecondsF() / kSecondsInWeek)); 41 set_relevance(1 / (1 + delta.InSecondsF() / kSecondsInWeek));
41 } 42 }
42 43
43 } // namespace app_list 44 } // namespace app_list
OLDNEW
« no previous file with comments | « no previous file | ui/app_list/app_list_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698