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

Side by Side Diff: chrome/browser/extensions/bookmark_app_helper.cc

Issue 1424663005: Prevent browser crashes when a site is added to shelf with extensions blacklisted. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
« 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/extensions/bookmark_app_helper.h" 5 #include "chrome/browser/extensions/bookmark_app_helper.h"
6 6
7 #include <cctype> 7 #include <cctype>
8 8
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 web_app::RevealAppShimInFinderForApp(current_profile, extension); 724 web_app::RevealAppShimInFinderForApp(current_profile, extension);
725 } 725 }
726 #endif 726 #endif
727 727
728 callback_.Run(extension, web_app_info_); 728 callback_.Run(extension, web_app_info_);
729 } 729 }
730 730
731 void BookmarkAppHelper::Observe(int type, 731 void BookmarkAppHelper::Observe(int type,
732 const content::NotificationSource& source, 732 const content::NotificationSource& source,
733 const content::NotificationDetails& details) { 733 const content::NotificationDetails& details) {
734 // TODO(dominickn): bookmark app creation fails when extensions cannot be
735 // created (e.g. due to management policies). Add to shelf visibility should
736 // be gated on whether extensions can be created - see crbug.com/545541.
734 switch (type) { 737 switch (type) {
735 case extensions::NOTIFICATION_CRX_INSTALLER_DONE: { 738 case extensions::NOTIFICATION_CRX_INSTALLER_DONE: {
736 const Extension* extension = 739 const Extension* extension =
737 content::Details<const Extension>(details).ptr(); 740 content::Details<const Extension>(details).ptr();
738 DCHECK(extension); 741 if (extension) {
739 DCHECK_EQ(AppLaunchInfo::GetLaunchWebURL(extension), 742 DCHECK_EQ(AppLaunchInfo::GetLaunchWebURL(extension),
740 web_app_info_.app_url); 743 web_app_info_.app_url);
741 FinishInstallation(extension); 744 FinishInstallation(extension);
745 } else {
746 callback_.Run(nullptr, web_app_info_);
747 }
742 break; 748 break;
743 } 749 }
744 case extensions::NOTIFICATION_EXTENSION_INSTALL_ERROR: 750 case extensions::NOTIFICATION_EXTENSION_INSTALL_ERROR:
745 callback_.Run(nullptr, web_app_info_); 751 callback_.Run(nullptr, web_app_info_);
746 break; 752 break;
747 default: 753 default:
748 NOTREACHED(); 754 NOTREACHED();
749 break; 755 break;
750 } 756 }
751 } 757 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 extension, info_list, base::Bind(&OnIconsLoaded, web_app_info, callback)); 796 extension, info_list, base::Bind(&OnIconsLoaded, web_app_info, callback));
791 } 797 }
792 798
793 bool IsValidBookmarkAppUrl(const GURL& url) { 799 bool IsValidBookmarkAppUrl(const GURL& url) {
794 URLPattern origin_only_pattern(Extension::kValidBookmarkAppSchemes); 800 URLPattern origin_only_pattern(Extension::kValidBookmarkAppSchemes);
795 origin_only_pattern.SetMatchAllURLs(true); 801 origin_only_pattern.SetMatchAllURLs(true);
796 return url.is_valid() && origin_only_pattern.MatchesURL(url); 802 return url.is_valid() && origin_only_pattern.MatchesURL(url);
797 } 803 }
798 804
799 } // namespace extensions 805 } // namespace extensions
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