| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/extensions_service.h" | 5 #include "chrome/browser/extensions/extensions_service.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" |
| 7 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 8 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 9 #include "base/histogram.h" | 10 #include "base/histogram.h" |
| 11 #include "base/string16.h" |
| 10 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 11 #include "base/time.h" | 13 #include "base/time.h" |
| 12 #include "base/values.h" | 14 #include "base/values.h" |
| 13 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/chrome_thread.h" | 16 #include "chrome/browser/chrome_thread.h" |
| 15 #include "chrome/browser/debugger/devtools_manager.h" | 17 #include "chrome/browser/debugger/devtools_manager.h" |
| 16 #include "chrome/browser/extensions/crx_installer.h" | 18 #include "chrome/browser/extensions/crx_installer.h" |
| 17 #include "chrome/browser/extensions/extension_accessibility_api.h" | 19 #include "chrome/browser/extensions/extension_accessibility_api.h" |
| 18 #include "chrome/browser/extensions/extension_bookmarks_module.h" | 20 #include "chrome/browser/extensions/extension_bookmarks_module.h" |
| 19 #include "chrome/browser/extensions/extension_browser_event_router.h" | 21 #include "chrome/browser/extensions/extension_browser_event_router.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 31 #include "chrome/common/chrome_switches.h" | 33 #include "chrome/common/chrome_switches.h" |
| 32 #include "chrome/common/extensions/extension.h" | 34 #include "chrome/common/extensions/extension.h" |
| 33 #include "chrome/common/extensions/extension_constants.h" | 35 #include "chrome/common/extensions/extension_constants.h" |
| 34 #include "chrome/common/extensions/extension_error_reporter.h" | 36 #include "chrome/common/extensions/extension_error_reporter.h" |
| 35 #include "chrome/common/extensions/extension_file_util.h" | 37 #include "chrome/common/extensions/extension_file_util.h" |
| 36 #include "chrome/common/extensions/extension_l10n_util.h" | 38 #include "chrome/common/extensions/extension_l10n_util.h" |
| 37 #include "chrome/common/notification_service.h" | 39 #include "chrome/common/notification_service.h" |
| 38 #include "chrome/common/notification_type.h" | 40 #include "chrome/common/notification_type.h" |
| 39 #include "chrome/common/pref_names.h" | 41 #include "chrome/common/pref_names.h" |
| 40 #include "chrome/common/url_constants.h" | 42 #include "chrome/common/url_constants.h" |
| 43 #include "webkit/database/database_tracker.h" |
| 44 #include "webkit/database/database_util.h" |
| 41 | 45 |
| 42 #if defined(OS_WIN) | 46 #if defined(OS_WIN) |
| 43 #include "chrome/browser/extensions/external_registry_extension_provider_win.h" | 47 #include "chrome/browser/extensions/external_registry_extension_provider_win.h" |
| 44 #endif | 48 #endif |
| 45 | 49 |
| 46 using base::Time; | 50 using base::Time; |
| 47 | 51 |
| 48 namespace errors = extension_manifest_errors; | 52 namespace errors = extension_manifest_errors; |
| 49 | 53 |
| 50 namespace { | 54 namespace { |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 NewRunnableMethod( | 459 NewRunnableMethod( |
| 456 context_getter, | 460 context_getter, |
| 457 &ChromeURLRequestContextGetter::OnNewExtensions, | 461 &ChromeURLRequestContextGetter::OnNewExtensions, |
| 458 extension->id(), | 462 extension->id(), |
| 459 new ChromeURLRequestContext::ExtensionInfo( | 463 new ChromeURLRequestContext::ExtensionInfo( |
| 460 extension->path(), | 464 extension->path(), |
| 461 extension->default_locale(), | 465 extension->default_locale(), |
| 462 extension->app_extent(), | 466 extension->app_extent(), |
| 463 extension->api_permissions()))); | 467 extension->api_permissions()))); |
| 464 } | 468 } |
| 469 |
| 470 // Check if this permission requires unlimited storage quota |
| 471 if (extension->HasApiPermission(Extension::kUnlimitedStoragePermission)) { |
| 472 string16 origin_identifier = |
| 473 webkit_database::DatabaseUtil::GetOriginIdentifier(extension->url()); |
| 474 ChromeThread::PostTask( |
| 475 ChromeThread::FILE, FROM_HERE, |
| 476 NewRunnableMethod( |
| 477 profile_->GetDatabaseTracker(), |
| 478 &webkit_database::DatabaseTracker::SetOriginQuotaInMemory, |
| 479 origin_identifier, |
| 480 kint64max)); |
| 481 } |
| 465 } | 482 } |
| 466 | 483 |
| 467 NotificationService::current()->Notify( | 484 NotificationService::current()->Notify( |
| 468 NotificationType::EXTENSION_LOADED, | 485 NotificationType::EXTENSION_LOADED, |
| 469 Source<Profile>(profile_), | 486 Source<Profile>(profile_), |
| 470 Details<Extension>(extension)); | 487 Details<Extension>(extension)); |
| 471 } | 488 } |
| 472 | 489 |
| 473 void ExtensionsService::NotifyExtensionUnloaded(Extension* extension) { | 490 void ExtensionsService::NotifyExtensionUnloaded(Extension* extension) { |
| 474 LOG(INFO) << "Sending EXTENSION_UNLOADED"; | 491 LOG(INFO) << "Sending EXTENSION_UNLOADED"; |
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1092 // Finish installing on UI thread. | 1109 // Finish installing on UI thread. |
| 1093 ChromeThread::PostTask( | 1110 ChromeThread::PostTask( |
| 1094 ChromeThread::UI, FROM_HERE, | 1111 ChromeThread::UI, FROM_HERE, |
| 1095 NewRunnableMethod( | 1112 NewRunnableMethod( |
| 1096 frontend_, | 1113 frontend_, |
| 1097 &ExtensionsService::ContinueLoadAllExtensions, | 1114 &ExtensionsService::ContinueLoadAllExtensions, |
| 1098 extensions_to_reload, | 1115 extensions_to_reload, |
| 1099 start_time, | 1116 start_time, |
| 1100 true)); | 1117 true)); |
| 1101 } | 1118 } |
| OLD | NEW |