| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 797 scoped_ptr<AppInstallInfo> install_info( | 797 scoped_ptr<AppInstallInfo> install_info( |
| 798 favicon_consumer_.GetClientDataForCurrentRequest()); | 798 favicon_consumer_.GetClientDataForCurrentRequest()); |
| 799 scoped_ptr<WebApplicationInfo> web_app(new WebApplicationInfo()); | 799 scoped_ptr<WebApplicationInfo> web_app(new WebApplicationInfo()); |
| 800 web_app->is_bookmark_app = install_info->is_bookmark_app; | 800 web_app->is_bookmark_app = install_info->is_bookmark_app; |
| 801 web_app->title = install_info->title; | 801 web_app->title = install_info->title; |
| 802 web_app->app_url = install_info->app_url; | 802 web_app->app_url = install_info->app_url; |
| 803 web_app->urls.push_back(install_info->app_url); | 803 web_app->urls.push_back(install_info->app_url); |
| 804 | 804 |
| 805 WebApplicationInfo::IconInfo icon; | 805 WebApplicationInfo::IconInfo icon; |
| 806 web_app->icons.push_back(icon); | 806 web_app->icons.push_back(icon); |
| 807 if (data.is_valid() && gfx::PNGCodec::Decode(data.bitmap_data->front(), | 807 if (data.is_valid() && data.variants.size() > 0 && |
| 808 data.bitmap_data->size(), | 808 gfx::PNGCodec::Decode(data.variants[0].bitmap_data->front(), |
| 809 &(web_app->icons[0].data))) { | 809 data.variants[0].bitmap_data->size(), |
| 810 &(web_app->icons[0].data))) { |
| 810 web_app->icons[0].url = GURL(); | 811 web_app->icons[0].url = GURL(); |
| 811 web_app->icons[0].width = web_app->icons[0].data.width(); | 812 web_app->icons[0].width = web_app->icons[0].data.width(); |
| 812 web_app->icons[0].height = web_app->icons[0].data.height(); | 813 web_app->icons[0].height = web_app->icons[0].data.height(); |
| 813 } else { | 814 } else { |
| 814 web_app->icons.clear(); | 815 web_app->icons.clear(); |
| 815 } | 816 } |
| 816 | 817 |
| 817 scoped_refptr<CrxInstaller> installer( | 818 scoped_refptr<CrxInstaller> installer( |
| 818 CrxInstaller::Create(extension_service_, NULL)); | 819 CrxInstaller::Create(extension_service_, NULL)); |
| 819 installer->set_page_ordinal(install_info->page_ordinal); | 820 installer->set_page_ordinal(install_info->page_ordinal); |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 995 | 996 |
| 996 void AppLauncherHandler::UninstallDefaultApps() { | 997 void AppLauncherHandler::UninstallDefaultApps() { |
| 997 AppsPromo* apps_promo = extension_service_->apps_promo(); | 998 AppsPromo* apps_promo = extension_service_->apps_promo(); |
| 998 const extensions::ExtensionIdSet& app_ids = apps_promo->old_default_apps(); | 999 const extensions::ExtensionIdSet& app_ids = apps_promo->old_default_apps(); |
| 999 for (extensions::ExtensionIdSet::const_iterator iter = app_ids.begin(); | 1000 for (extensions::ExtensionIdSet::const_iterator iter = app_ids.begin(); |
| 1000 iter != app_ids.end(); ++iter) { | 1001 iter != app_ids.end(); ++iter) { |
| 1001 if (extension_service_->GetExtensionById(*iter, true)) | 1002 if (extension_service_->GetExtensionById(*iter, true)) |
| 1002 extension_service_->UninstallExtension(*iter, false, NULL); | 1003 extension_service_->UninstallExtension(*iter, false, NULL); |
| 1003 } | 1004 } |
| 1004 } | 1005 } |
| OLD | NEW |