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/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 const content::NotificationSource& source, | 100 const content::NotificationSource& source, |
101 const content::NotificationDetails& details) { | 101 const content::NotificationDetails& details) { |
102 DCHECK_EQ(chrome::NOTIFICATION_EXTENSIONS_READY, type); | 102 DCHECK_EQ(chrome::NOTIFICATION_EXTENSIONS_READY, type); |
103 OnceOffCreateShortcuts(); | 103 OnceOffCreateShortcuts(); |
104 } | 104 } |
105 | 105 |
106 void AppShortcutManager::OnExtensionWillBeInstalled( | 106 void AppShortcutManager::OnExtensionWillBeInstalled( |
107 content::BrowserContext* browser_context, | 107 content::BrowserContext* browser_context, |
108 const Extension* extension, | 108 const Extension* extension, |
109 bool is_update, | 109 bool is_update, |
| 110 bool from_ephemeral, |
110 const std::string& old_name) { | 111 const std::string& old_name) { |
111 // If the app is being updated, update any existing shortcuts but do not | 112 // If the app is being updated, update any existing shortcuts but do not |
112 // create new ones. If it is being installed, automatically create a | 113 // create new ones. If it is being installed, automatically create a |
113 // shortcut in the applications menu (e.g., Start Menu). | 114 // shortcut in the applications menu (e.g., Start Menu). |
114 if (is_update) { | 115 if (is_update) { |
115 web_app::UpdateAllShortcuts( | 116 web_app::UpdateAllShortcuts( |
116 base::UTF8ToUTF16(old_name), profile_, extension); | 117 base::UTF8ToUTF16(old_name), profile_, extension); |
117 } else if (ShouldCreateShortcutFor(profile_, extension)) { | 118 } else if (ShouldCreateShortcutFor(profile_, extension)) { |
118 CreateShortcutsInApplicationsMenu(profile_, extension); | 119 CreateShortcutsInApplicationsMenu(profile_, extension); |
119 } | 120 } |
(...skipping 30 matching lines...) Expand all Loading... |
150 return; | 151 return; |
151 | 152 |
152 // Create an applications menu shortcut for each app in this profile. | 153 // Create an applications menu shortcut for each app in this profile. |
153 const extensions::ExtensionSet* apps = extension_service->extensions(); | 154 const extensions::ExtensionSet* apps = extension_service->extensions(); |
154 for (extensions::ExtensionSet::const_iterator it = apps->begin(); | 155 for (extensions::ExtensionSet::const_iterator it = apps->begin(); |
155 it != apps->end(); ++it) { | 156 it != apps->end(); ++it) { |
156 if (ShouldCreateShortcutFor(profile_, it->get())) | 157 if (ShouldCreateShortcutFor(profile_, it->get())) |
157 CreateShortcutsInApplicationsMenu(profile_, it->get()); | 158 CreateShortcutsInApplicationsMenu(profile_, it->get()); |
158 } | 159 } |
159 } | 160 } |
OLD | NEW |