OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/webui/ntp/app_launcher_handler.h" | 5 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 default: | 219 default: |
220 NOTREACHED(); | 220 NOTREACHED(); |
221 } | 221 } |
222 } | 222 } |
223 | 223 |
224 void AppLauncherHandler::FillAppDictionary(DictionaryValue* dictionary) { | 224 void AppLauncherHandler::FillAppDictionary(DictionaryValue* dictionary) { |
225 ListValue* list = new ListValue(); | 225 ListValue* list = new ListValue(); |
226 const ExtensionList* extensions = extensions_service_->extensions(); | 226 const ExtensionList* extensions = extensions_service_->extensions(); |
227 ExtensionList::const_iterator it; | 227 ExtensionList::const_iterator it; |
228 for (it = extensions->begin(); it != extensions->end(); ++it) { | 228 for (it = extensions->begin(); it != extensions->end(); ++it) { |
229 // Don't include the WebStore. | 229 // Don't include the WebStore and the Cloud Print app. |
230 // The WebStore launcher gets special treatment in ntp/apps.js. | 230 // The WebStore launcher gets special treatment in ntp/apps.js. |
| 231 // The Cloud Print app should not be displayed in the NTP. |
231 if ((*it)->is_app() && | 232 if ((*it)->is_app() && |
232 (*it)->id() != extension_misc::kWebStoreAppId) { | 233 (*it)->id() != extension_misc::kWebStoreAppId && |
| 234 (*it)->id() != extension_misc::kCloudPrintAppId) { |
233 DictionaryValue* app_info = new DictionaryValue(); | 235 DictionaryValue* app_info = new DictionaryValue(); |
234 CreateAppInfo(*it, extensions_service_->extension_prefs(), app_info); | 236 CreateAppInfo(*it, extensions_service_->extension_prefs(), app_info); |
235 list->Append(app_info); | 237 list->Append(app_info); |
236 } | 238 } |
237 } | 239 } |
238 | 240 |
239 extensions = extensions_service_->disabled_extensions(); | 241 extensions = extensions_service_->disabled_extensions(); |
240 for (it = extensions->begin(); it != extensions->end(); ++it) { | 242 for (it = extensions->begin(); it != extensions->end(); ++it) { |
241 if ((*it)->is_app() && | 243 if ((*it)->is_app() && |
242 (*it)->id() != extension_misc::kWebStoreAppId) { | 244 (*it)->id() != extension_misc::kWebStoreAppId && |
| 245 (*it)->id() != extension_misc::kCloudPrintAppId) { |
243 DictionaryValue* app_info = new DictionaryValue(); | 246 DictionaryValue* app_info = new DictionaryValue(); |
244 CreateAppInfo(*it, extensions_service_->extension_prefs(), app_info); | 247 CreateAppInfo(*it, extensions_service_->extension_prefs(), app_info); |
245 list->Append(app_info); | 248 list->Append(app_info); |
246 } | 249 } |
247 } | 250 } |
248 | 251 |
249 dictionary->Set("apps", list); | 252 dictionary->Set("apps", list); |
250 | 253 |
251 // TODO(estade): remove these settings when the old NTP is removed. The new | 254 // TODO(estade): remove these settings when the old NTP is removed. The new |
252 // NTP does it in js. | 255 // NTP does it in js. |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 | 662 |
660 void AppLauncherHandler::UninstallDefaultApps() { | 663 void AppLauncherHandler::UninstallDefaultApps() { |
661 AppsPromo* apps_promo = extensions_service_->apps_promo(); | 664 AppsPromo* apps_promo = extensions_service_->apps_promo(); |
662 const ExtensionIdSet& app_ids = apps_promo->old_default_apps(); | 665 const ExtensionIdSet& app_ids = apps_promo->old_default_apps(); |
663 for (ExtensionIdSet::const_iterator iter = app_ids.begin(); | 666 for (ExtensionIdSet::const_iterator iter = app_ids.begin(); |
664 iter != app_ids.end(); ++iter) { | 667 iter != app_ids.end(); ++iter) { |
665 if (extensions_service_->GetExtensionById(*iter, true)) | 668 if (extensions_service_->GetExtensionById(*iter, true)) |
666 extensions_service_->UninstallExtension(*iter, false, NULL); | 669 extensions_service_->UninstallExtension(*iter, false, NULL); |
667 } | 670 } |
668 } | 671 } |
OLD | NEW |