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

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

Issue 8800016: Exempt default apps from external-extension alerts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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
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/extensions/extension_service.h" 5 #include "chrome/browser/extensions/extension_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 1718 matching lines...) Expand 10 before | Expand all | Expand 10 after
1729 global_error->ShowBubbleView(browser); 1729 global_error->ShowBubbleView(browser);
1730 } 1730 }
1731 } 1731 }
1732 1732
1733 void ExtensionService::HandleExtensionAlertAccept( 1733 void ExtensionService::HandleExtensionAlertAccept(
1734 const ExtensionGlobalError& global_error, Browser* browser) { 1734 const ExtensionGlobalError& global_error, Browser* browser) {
1735 const ExtensionIdSet *extension_ids = 1735 const ExtensionIdSet *extension_ids =
1736 global_error.get_external_extension_ids(); 1736 global_error.get_external_extension_ids();
1737 for (ExtensionIdSet::const_iterator iter = extension_ids->begin(); 1737 for (ExtensionIdSet::const_iterator iter = extension_ids->begin();
1738 iter != extension_ids->end(); ++iter) { 1738 iter != extension_ids->end(); ++iter) {
1739 extension_prefs_->AcknowledgeExternalExtension(*iter); 1739 AcknowledgeExternalExtension(*iter);
1740 } 1740 }
1741 extension_ids = global_error.get_blacklisted_extension_ids(); 1741 extension_ids = global_error.get_blacklisted_extension_ids();
1742 for (ExtensionIdSet::const_iterator iter = extension_ids->begin(); 1742 for (ExtensionIdSet::const_iterator iter = extension_ids->begin();
1743 iter != extension_ids->end(); ++iter) { 1743 iter != extension_ids->end(); ++iter) {
1744 extension_prefs_->AcknowledgeBlacklistedExtension(*iter); 1744 extension_prefs_->AcknowledgeBlacklistedExtension(*iter);
1745 } 1745 }
1746 extension_ids = global_error.get_orphaned_extension_ids(); 1746 extension_ids = global_error.get_orphaned_extension_ids();
1747 for (ExtensionIdSet::const_iterator iter = extension_ids->begin(); 1747 for (ExtensionIdSet::const_iterator iter = extension_ids->begin();
1748 iter != extension_ids->end(); ++iter) { 1748 iter != extension_ids->end(); ++iter) {
1749 extension_prefs_->AcknowledgeOrphanedExtension(*iter); 1749 extension_prefs_->AcknowledgeOrphanedExtension(*iter);
1750 } 1750 }
1751 } 1751 }
1752 1752
1753 void ExtensionService::AcknowledgeExternalExtension(const std::string& id) {
1754 extension_prefs_->AcknowledgeExternalExtension(id);
1755 }
1756
1753 void ExtensionService::HandleExtensionAlertDetails( 1757 void ExtensionService::HandleExtensionAlertDetails(
1754 const ExtensionGlobalError& global_error, Browser* browser) { 1758 const ExtensionGlobalError& global_error, Browser* browser) {
1755 if (browser) { 1759 if (browser) {
1756 browser->ShowExtensionsTab(); 1760 browser->ShowExtensionsTab();
1757 } 1761 }
1758 } 1762 }
1759 1763
1760 void ExtensionService::UnloadExtension( 1764 void ExtensionService::UnloadExtension(
1761 const std::string& extension_id, 1765 const std::string& extension_id,
1762 extension_misc::UnloadedExtensionReason reason) { 1766 extension_misc::UnloadedExtensionReason reason) {
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
2235 const SkBitmap& ExtensionService::GetOmniboxPopupIcon( 2239 const SkBitmap& ExtensionService::GetOmniboxPopupIcon(
2236 const std::string& extension_id) { 2240 const std::string& extension_id) {
2237 return omnibox_popup_icon_manager_.GetIcon(extension_id); 2241 return omnibox_popup_icon_manager_.GetIcon(extension_id);
2238 } 2242 }
2239 2243
2240 void ExtensionService::OnExternalExtensionFileFound( 2244 void ExtensionService::OnExternalExtensionFileFound(
2241 const std::string& id, 2245 const std::string& id,
2242 const Version* version, 2246 const Version* version,
2243 const FilePath& path, 2247 const FilePath& path,
2244 Extension::Location location, 2248 Extension::Location location,
2245 int creation_flags) { 2249 int creation_flags,
2250 bool should_acknowledge) {
2246 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 2251 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
2247 CHECK(Extension::IdIsValid(id)); 2252 CHECK(Extension::IdIsValid(id));
2248 if (extension_prefs_->IsExternalExtensionUninstalled(id)) 2253 if (extension_prefs_->IsExternalExtensionUninstalled(id))
2249 return; 2254 return;
2250 2255
2251 DCHECK(version); 2256 DCHECK(version);
2252 2257
2253 // Before even bothering to unpack, check and see if we already have this 2258 // Before even bothering to unpack, check and see if we already have this
2254 // version. This is important because these extensions are going to get 2259 // version. This is important because these extensions are going to get
2255 // installed on every startup. 2260 // installed on every startup.
(...skipping 16 matching lines...) Expand all
2272 pending_extension_manager()->AddFromExternalFile(id, location); 2277 pending_extension_manager()->AddFromExternalFile(id, location);
2273 2278
2274 // no client (silent install) 2279 // no client (silent install)
2275 scoped_refptr<CrxInstaller> installer(CrxInstaller::Create(this, NULL)); 2280 scoped_refptr<CrxInstaller> installer(CrxInstaller::Create(this, NULL));
2276 installer->set_install_source(location); 2281 installer->set_install_source(location);
2277 installer->set_expected_id(id); 2282 installer->set_expected_id(id);
2278 installer->set_expected_version(*version); 2283 installer->set_expected_version(*version);
2279 installer->set_install_cause(extension_misc::INSTALL_CAUSE_EXTERNAL_FILE); 2284 installer->set_install_cause(extension_misc::INSTALL_CAUSE_EXTERNAL_FILE);
2280 installer->set_creation_flags(creation_flags); 2285 installer->set_creation_flags(creation_flags);
2281 installer->InstallCrx(path); 2286 installer->InstallCrx(path);
2287
2288 if (should_acknowledge)
2289 AcknowledgeExternalExtension(id);
2282 } 2290 }
2283 2291
2284 void ExtensionService::ReportExtensionLoadError( 2292 void ExtensionService::ReportExtensionLoadError(
2285 const FilePath& extension_path, 2293 const FilePath& extension_path,
2286 const std::string &error, 2294 const std::string &error,
2287 bool be_noisy) { 2295 bool be_noisy) {
2288 content::NotificationService::current()->Notify( 2296 content::NotificationService::current()->Notify(
2289 chrome::NOTIFICATION_EXTENSION_LOAD_ERROR, 2297 chrome::NOTIFICATION_EXTENSION_LOAD_ERROR,
2290 content::Source<Profile>(profile_), 2298 content::Source<Profile>(profile_),
2291 content::Details<const std::string>(&error)); 2299 content::Details<const std::string>(&error));
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
2521 2529
2522 ExtensionService::NaClModuleInfoList::iterator 2530 ExtensionService::NaClModuleInfoList::iterator
2523 ExtensionService::FindNaClModule(const GURL& url) { 2531 ExtensionService::FindNaClModule(const GURL& url) {
2524 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); 2532 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin();
2525 iter != nacl_module_list_.end(); ++iter) { 2533 iter != nacl_module_list_.end(); ++iter) {
2526 if (iter->url == url) 2534 if (iter->url == url)
2527 return iter; 2535 return iter;
2528 } 2536 }
2529 return nacl_module_list_.end(); 2537 return nacl_module_list_.end();
2530 } 2538 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698