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

Side by Side Diff: chrome/browser/apps/shortcut_manager.cc

Issue 398083002: Add "UninstallReason" parameter to ExtensionRegistryObserver::OnExtensionUninstalled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix header file. Created 6 years, 5 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
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/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 if (is_update && !from_ephemeral) { 131 if (is_update && !from_ephemeral) {
132 web_app::UpdateAllShortcuts( 132 web_app::UpdateAllShortcuts(
133 base::UTF8ToUTF16(old_name), profile_, extension); 133 base::UTF8ToUTF16(old_name), profile_, extension);
134 } else { 134 } else {
135 CreateShortcutsForApp(profile_, extension); 135 CreateShortcutsForApp(profile_, extension);
136 } 136 }
137 } 137 }
138 138
139 void AppShortcutManager::OnExtensionUninstalled( 139 void AppShortcutManager::OnExtensionUninstalled(
140 content::BrowserContext* browser_context, 140 content::BrowserContext* browser_context,
141 const Extension* extension) { 141 const Extension* extension,
142 extensions::UninstallReason reason) {
142 web_app::DeleteAllShortcuts(profile_, extension); 143 web_app::DeleteAllShortcuts(profile_, extension);
143 } 144 }
144 145
145 void AppShortcutManager::OnProfileWillBeRemoved( 146 void AppShortcutManager::OnProfileWillBeRemoved(
146 const base::FilePath& profile_path) { 147 const base::FilePath& profile_path) {
147 if (profile_path != profile_->GetPath()) 148 if (profile_path != profile_->GetPath())
148 return; 149 return;
149 content::BrowserThread::PostTask( 150 content::BrowserThread::PostTask(
150 content::BrowserThread::FILE, FROM_HERE, 151 content::BrowserThread::FILE, FROM_HERE,
151 base::Bind(&web_app::internals::DeleteAllShortcutsForProfile, 152 base::Bind(&web_app::internals::DeleteAllShortcutsForProfile,
152 profile_path)); 153 profile_path));
153 } 154 }
154 155
155 void AppShortcutManager::UpdateShortcutsForAllAppsIfNeeded() { 156 void AppShortcutManager::UpdateShortcutsForAllAppsIfNeeded() {
156 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)) 157 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType))
157 return; 158 return;
158 159
159 int last_version = prefs_->GetInteger(prefs::kAppShortcutsVersion); 160 int last_version = prefs_->GetInteger(prefs::kAppShortcutsVersion);
160 if (last_version >= kCurrentAppShortcutsVersion) 161 if (last_version >= kCurrentAppShortcutsVersion)
161 return; 162 return;
162 163
163 content::BrowserThread::PostDelayedTask( 164 content::BrowserThread::PostDelayedTask(
164 content::BrowserThread::UI, 165 content::BrowserThread::UI,
165 FROM_HERE, 166 FROM_HERE,
166 base::Bind(&web_app::UpdateShortcutsForAllApps, 167 base::Bind(&web_app::UpdateShortcutsForAllApps,
167 profile_, 168 profile_,
168 base::Bind(&SetCurrentAppShortcutsVersion, prefs_)), 169 base::Bind(&SetCurrentAppShortcutsVersion, prefs_)),
169 base::TimeDelta::FromSeconds(kUpdateShortcutsForAllAppsDelay)); 170 base::TimeDelta::FromSeconds(kUpdateShortcutsForAllAppsDelay));
170 } 171 }
OLDNEW
« no previous file with comments | « chrome/browser/apps/shortcut_manager.h ('k') | chrome/browser/background/background_application_list_model_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698