| Index: chrome/browser/ui/app_list/search/app_result.cc
|
| diff --git a/chrome/browser/ui/app_list/search/app_result.cc b/chrome/browser/ui/app_list/search/app_result.cc
|
| index 098b5fcb658b92c34494737f950c5589197fb195..54aaef38bd1172fd57d9919462c09cfe958c09f2 100644
|
| --- a/chrome/browser/ui/app_list/search/app_result.cc
|
| +++ b/chrome/browser/ui/app_list/search/app_result.cc
|
| @@ -4,6 +4,7 @@
|
|
|
| #include "chrome/browser/ui/app_list/search/app_result.h"
|
|
|
| +#include "base/time/time.h"
|
| #include "chrome/browser/extensions/extension_service.h"
|
| #include "chrome/browser/extensions/extension_util.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| @@ -73,6 +74,17 @@ void AppResult::UpdateFromMatch(const TokenizedString& title,
|
| set_relevance(match.relevance());
|
| }
|
|
|
| +void AppResult::UpdateFromLastLaunched(const base::Time& current_time,
|
| + const base::Time& last_launched) {
|
| + base::TimeDelta delta = current_time - last_launched;
|
| + DCHECK_LE(0, delta.InSeconds());
|
| + const int kSecondsInWeek = 60 * 60 * 24 * 7;
|
| +
|
| + // Set the relevance to a value between 0 and 1. This function decays as the
|
| + // time delta increases and reaches a value of 0.5 at 1 week.
|
| + set_relevance(1 / (1 + delta.InSecondsF() / kSecondsInWeek));
|
| +}
|
| +
|
| void AppResult::Open(int event_flags) {
|
| const extensions::Extension* extension =
|
| extensions::ExtensionSystem::Get(profile_)->extension_service()
|
|
|