OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/apps/shortcut_manager.h" | 5 #include "chrome/browser/apps/shortcut_manager.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 extensions::UninstallReason reason) { | 131 extensions::UninstallReason reason) { |
132 web_app::DeleteAllShortcuts(profile_, extension); | 132 web_app::DeleteAllShortcuts(profile_, extension); |
133 } | 133 } |
134 | 134 |
135 void AppShortcutManager::OnProfileWillBeRemoved( | 135 void AppShortcutManager::OnProfileWillBeRemoved( |
136 const base::FilePath& profile_path) { | 136 const base::FilePath& profile_path) { |
137 if (profile_path != profile_->GetPath()) | 137 if (profile_path != profile_->GetPath()) |
138 return; | 138 return; |
139 content::BrowserThread::PostTask( | 139 content::BrowserThread::PostTask( |
140 content::BrowserThread::FILE, FROM_HERE, | 140 content::BrowserThread::FILE, FROM_HERE, |
141 base::Bind(&web_app::internals::DeleteAllShortcutsForProfile, | 141 base::BindOnce(&web_app::internals::DeleteAllShortcutsForProfile, |
142 profile_path)); | 142 profile_path)); |
143 } | 143 } |
144 | 144 |
145 void AppShortcutManager::UpdateShortcutsForAllAppsIfNeeded() { | 145 void AppShortcutManager::UpdateShortcutsForAllAppsIfNeeded() { |
146 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)) | 146 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)) |
147 return; | 147 return; |
148 | 148 |
149 int last_version = prefs_->GetInteger(prefs::kAppShortcutsVersion); | 149 int last_version = prefs_->GetInteger(prefs::kAppShortcutsVersion); |
150 if (last_version >= kCurrentAppShortcutsVersion) | 150 if (last_version >= kCurrentAppShortcutsVersion) |
151 return; | 151 return; |
152 | 152 |
153 content::BrowserThread::PostDelayedTask( | 153 content::BrowserThread::PostDelayedTask( |
154 content::BrowserThread::UI, | 154 content::BrowserThread::UI, FROM_HERE, |
155 FROM_HERE, | 155 base::BindOnce(&web_app::UpdateShortcutsForAllApps, profile_, |
156 base::Bind(&web_app::UpdateShortcutsForAllApps, | 156 base::Bind(&SetCurrentAppShortcutsVersion, prefs_)), |
157 profile_, | |
158 base::Bind(&SetCurrentAppShortcutsVersion, prefs_)), | |
159 base::TimeDelta::FromSeconds(kUpdateShortcutsForAllAppsDelay)); | 157 base::TimeDelta::FromSeconds(kUpdateShortcutsForAllAppsDelay)); |
160 } | 158 } |
OLD | NEW |