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

Side by Side Diff: chrome/browser/ui/webui/ntp/app_launcher_handler.cc

Issue 7600010: Fix JS to pass through drop data from bookmark bar. Don't put (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Revert crx_installer Created 9 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 694
695 string16 title; 695 string16 title;
696 CHECK(args->GetString(1, &title)); 696 CHECK(args->GetString(1, &title));
697 697
698 GURL launch_url(url); 698 GURL launch_url(url);
699 699
700 scoped_ptr<WebApplicationInfo> web_app(new WebApplicationInfo); 700 scoped_ptr<WebApplicationInfo> web_app(new WebApplicationInfo);
701 web_app->is_bookmark_app = true; 701 web_app->is_bookmark_app = true;
702 web_app->title = title; 702 web_app->title = title;
703 web_app->app_url = launch_url; 703 web_app->app_url = launch_url;
704 WebApplicationInfo::IconInfo icon;
705 icon.url = GURL();
706 icon.width = icon.height = 16;
707 web_app->icons.push_back(icon);
708 704
709 Profile* profile = web_ui_->GetProfile(); 705 Profile* profile = web_ui_->GetProfile();
710 FaviconService* favicon_service = 706 FaviconService* favicon_service =
711 profile->GetFaviconService(Profile::EXPLICIT_ACCESS); 707 profile->GetFaviconService(Profile::EXPLICIT_ACCESS);
712 if (!favicon_service) { 708 if (!favicon_service) {
713 LOG(ERROR) << "No favicon service"; 709 LOG(ERROR) << "No favicon service";
714 scoped_refptr<CrxInstaller> installer( 710 scoped_refptr<CrxInstaller> installer(
715 extension_service_->MakeCrxInstaller(NULL)); 711 extension_service_->MakeCrxInstaller(NULL));
716 installer->InstallWebApp(*web_app); 712 installer->InstallWebApp(*web_app);
717 return; 713 return;
(...skipping 16 matching lines...) Expand all
734 static_cast<extension_misc::AppLaunchBucket>(static_cast<int>(source)); 730 static_cast<extension_misc::AppLaunchBucket>(static_cast<int>(source));
735 CHECK(source < extension_misc::APP_LAUNCH_BUCKET_BOUNDARY); 731 CHECK(source < extension_misc::APP_LAUNCH_BUCKET_BOUNDARY);
736 732
737 RecordAppLaunchByURL(web_ui_->GetProfile(), url, bucket); 733 RecordAppLaunchByURL(web_ui_->GetProfile(), url, bucket);
738 } 734 }
739 735
740 void AppLauncherHandler::OnFaviconForApp(FaviconService::Handle handle, 736 void AppLauncherHandler::OnFaviconForApp(FaviconService::Handle handle,
741 history::FaviconData data) { 737 history::FaviconData data) {
742 scoped_ptr<WebApplicationInfo> web_app( 738 scoped_ptr<WebApplicationInfo> web_app(
743 favicon_consumer_.GetClientDataForCurrentRequest()); 739 favicon_consumer_.GetClientDataForCurrentRequest());
744 CHECK(!web_app->icons.empty()); 740 WebApplicationInfo::IconInfo icon;
741 web_app->icons.push_back(icon);
745 if (data.is_valid() && gfx::PNGCodec::Decode(data.image_data->front(), 742 if (data.is_valid() && gfx::PNGCodec::Decode(data.image_data->front(),
746 data.image_data->size(), 743 data.image_data->size(),
747 &(web_app->icons[0].data))) { 744 &(web_app->icons[0].data))) {
748 web_app->icons[0].url = GURL(); 745 web_app->icons[0].url = GURL();
749 web_app->icons[0].width = web_app->icons[0].data.width(); 746 web_app->icons[0].width = web_app->icons[0].data.width();
750 web_app->icons[0].height = web_app->icons[0].data.height(); 747 web_app->icons[0].height = web_app->icons[0].data.height();
748 } else {
749 web_app->icons.clear();
751 } 750 }
752 751
753 scoped_refptr<CrxInstaller> installer( 752 scoped_refptr<CrxInstaller> installer(
754 extension_service_->MakeCrxInstaller(NULL)); 753 extension_service_->MakeCrxInstaller(NULL));
755 installer->InstallWebApp(*web_app); 754 installer->InstallWebApp(*web_app);
756 } 755 }
757 756
758 // static 757 // static
759 void AppLauncherHandler::RegisterUserPrefs(PrefService* pref_service) { 758 void AppLauncherHandler::RegisterUserPrefs(PrefService* pref_service) {
760 // TODO(csilv): We will want this to be a syncable preference instead. 759 // TODO(csilv): We will want this to be a syncable preference instead.
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 912
914 void AppLauncherHandler::UninstallDefaultApps() { 913 void AppLauncherHandler::UninstallDefaultApps() {
915 AppsPromo* apps_promo = extension_service_->apps_promo(); 914 AppsPromo* apps_promo = extension_service_->apps_promo();
916 const ExtensionIdSet& app_ids = apps_promo->old_default_apps(); 915 const ExtensionIdSet& app_ids = apps_promo->old_default_apps();
917 for (ExtensionIdSet::const_iterator iter = app_ids.begin(); 916 for (ExtensionIdSet::const_iterator iter = app_ids.begin();
918 iter != app_ids.end(); ++iter) { 917 iter != app_ids.end(); ++iter) {
919 if (extension_service_->GetExtensionById(*iter, true)) 918 if (extension_service_->GetExtensionById(*iter, true))
920 extension_service_->UninstallExtension(*iter, false, NULL); 919 extension_service_->UninstallExtension(*iter, false, NULL);
921 } 920 }
922 } 921 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698