Index: chrome/browser/chromeos/extensions/file_handler_util.cc |
diff --git a/chrome/browser/chromeos/extensions/file_handler_util.cc b/chrome/browser/chromeos/extensions/file_handler_util.cc |
index 743f8c548cd5edbbddf5719ee1d67013a78625fb..9303c232a2f918a21acaa3345d7b834867bee3a4 100644 |
--- a/chrome/browser/chromeos/extensions/file_handler_util.cc |
+++ b/chrome/browser/chromeos/extensions/file_handler_util.cc |
@@ -177,6 +177,7 @@ bool CrackTaskID(const std::string& task_id, |
// that are shared |
bool FindCommonTasks(Profile* profile, |
const std::vector<GURL>& files_list, |
+ const std::string& privileged_extension_id, |
LastUsedHandlerList* named_action_list) { |
named_action_list->clear(); |
ActionSet common_tasks; |
@@ -213,6 +214,13 @@ bool FindCommonTasks(Profile* profile, |
iter != common_tasks.end(); ++iter) { |
// Get timestamp of when this task was used last time. |
int last_used_timestamp = 0; |
+ |
+ if ((*iter)->extension_id() == privileged_extension_id) { |
+ // Give a little bump to the action from the 'privileged' extension |
+ // (normally the File Browser) so that it becomes the default on a fresh |
+ // profile when none of the action has been used yet. |
+ last_used_timestamp = 1; |
+ } |
prefs_tasks->GetInteger(MakeTaskID((*iter)->extension_id(), (*iter)->id()), |
&last_used_timestamp); |
URLPatternSet matching_patterns = GetAllMatchingPatterns(*iter, files_list); |
@@ -224,13 +232,16 @@ bool FindCommonTasks(Profile* profile, |
return true; |
} |
-bool GetDefaultTask( |
- Profile* profile, const GURL& url, const FileBrowserHandler** handler) { |
+bool GetDefaultTask(Profile* profile, |
+ const GURL& url, |
+ const std::string& privileged_extension_id, |
+ const FileBrowserHandler** handler) { |
std::vector<GURL> file_urls; |
file_urls.push_back(url); |
LastUsedHandlerList common_tasks; |
- if (!FindCommonTasks(profile, file_urls, &common_tasks)) |
+ if (!FindCommonTasks( |
+ profile, file_urls, privileged_extension_id, &common_tasks)) |
return false; |
if (common_tasks.size() == 0) |