Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / browser_process_impl.cc
index b093cb4..caeb279 100644 (file)
@@ -24,7 +24,6 @@
 #include "base/threading/thread.h"
 #include "base/threading/thread_restrictions.h"
 #include "base/time/default_tick_clock.h"
-#include "chrome/browser/background/background_mode_manager.h"
 #include "chrome/browser/chrome_browser_main.h"
 #include "chrome/browser/chrome_content_browser_client.h"
 #include "chrome/browser/chrome_notification_types.h"
@@ -60,7 +59,6 @@
 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
 #include "chrome/browser/shell_integration.h"
 #include "chrome/browser/status_icons/status_tray.h"
-#include "chrome/browser/ui/apps/chrome_app_window_client.h"
 #include "chrome/browser/ui/browser_dialogs.h"
 #include "chrome/browser/ui/browser_finder.h"
 #include "chrome/browser/ui/user_manager.h"
@@ -91,7 +89,6 @@
 #include "content/public/browser/service_worker_context.h"
 #include "content/public/browser/storage_partition.h"
 #include "extensions/common/constants.h"
-#include "extensions/common/extension_l10n_util.h"
 #include "net/socket/client_socket_pool_manager.h"
 #include "net/url_request/url_request_context_getter.h"
 #include "ui/base/l10n/l10n_util.h"
 #include "ui/aura/env.h"
 #endif
 
+#if defined(ENABLE_BACKGROUND)
+#include "chrome/browser/background/background_mode_manager.h"
+#endif
+
 #if defined(ENABLE_CONFIGURATION_POLICY)
 #include "components/policy/core/browser/browser_policy_connector.h"
 #else
 #include "chrome/browser/extensions/event_router_forwarder.h"
 #include "chrome/browser/extensions/extension_renderer_state.h"
 #include "chrome/browser/media_galleries/media_file_system_registry.h"
+#include "chrome/browser/ui/apps/chrome_app_window_client.h"
 #include "components/storage_monitor/storage_monitor.h"
+#include "extensions/common/extension_l10n_util.h"
 #endif
 
 #if !defined(DISABLE_NACL)
@@ -346,10 +349,6 @@ unsigned int BrowserProcessImpl::AddRefModule() {
   return module_ref_count_;
 }
 
-static void ShutdownServiceWorkerContext(content::StoragePartition* partition) {
-  partition->GetServiceWorkerContext()->Terminate();
-}
-
 unsigned int BrowserProcessImpl::ReleaseModule() {
   DCHECK(CalledOnValidThread());
   DCHECK_NE(0u, module_ref_count_);
@@ -357,14 +356,6 @@ unsigned int BrowserProcessImpl::ReleaseModule() {
   if (0 == module_ref_count_) {
     release_last_reference_callstack_ = base::debug::StackTrace();
 
-    // Stop service workers
-    ProfileManager* pm = profile_manager();
-    std::vector<Profile*> profiles(pm->GetLoadedProfiles());
-    for (size_t i = 0; i < profiles.size(); ++i) {
-      content::BrowserContext::ForEachStoragePartition(
-          profiles[i], base::Bind(ShutdownServiceWorkerContext));
-    }
-
 #if defined(ENABLE_PRINTING)
     // Wait for the pending print jobs to finish. Don't do this later, since
     // this might cause a nested message loop to run, and we don't want pending
@@ -689,7 +680,7 @@ printing::PrintJobManager* BrowserProcessImpl::print_job_manager() {
 
 printing::PrintPreviewDialogController*
     BrowserProcessImpl::print_preview_dialog_controller() {
-#if defined(ENABLE_FULL_PRINTING)
+#if defined(ENABLE_PRINT_PREVIEW)
   DCHECK(CalledOnValidThread());
   if (!print_preview_dialog_controller_.get())
     CreatePrintPreviewDialogController();
@@ -702,7 +693,7 @@ printing::PrintPreviewDialogController*
 
 printing::BackgroundPrintingManager*
     BrowserProcessImpl::background_printing_manager() {
-#if defined(ENABLE_FULL_PRINTING)
+#if defined(ENABLE_PRINT_PREVIEW)
   DCHECK(CalledOnValidThread());
   if (!background_printing_manager_.get())
     CreateBackgroundPrintingManager();
@@ -727,7 +718,9 @@ const std::string& BrowserProcessImpl::GetApplicationLocale() {
 
 void BrowserProcessImpl::SetApplicationLocale(const std::string& locale) {
   locale_ = locale;
+#if defined(ENABLE_EXTENSIONS)
   extension_l10n_util::SetProcessLocale(locale);
+#endif
   chrome::ChromeContentBrowserClient::SetApplicationLocale(locale);
   translate::TranslateDownloadManager::GetInstance()->set_application_locale(
       locale);
@@ -841,7 +834,9 @@ BackgroundModeManager* BrowserProcessImpl::background_mode_manager() {
 
 void BrowserProcessImpl::set_background_mode_manager_for_test(
     scoped_ptr<BackgroundModeManager> manager) {
+#if defined(ENABLE_BACKGROUND)
   background_mode_manager_ = manager.Pass();
+#endif
 }
 
 StatusTray* BrowserProcessImpl::status_tray() {
@@ -1085,10 +1080,12 @@ void BrowserProcessImpl::CreateNotificationUIManager() {
 }
 
 void BrowserProcessImpl::CreateBackgroundModeManager() {
+#if defined(ENABLE_BACKGROUND)
   DCHECK(background_mode_manager_.get() == NULL);
   background_mode_manager_.reset(
       new BackgroundModeManager(CommandLine::ForCurrentProcess(),
                                 &profile_manager()->GetProfileInfoCache()));
+#endif
 }
 
 void BrowserProcessImpl::CreateStatusTray() {
@@ -1097,7 +1094,7 @@ void BrowserProcessImpl::CreateStatusTray() {
 }
 
 void BrowserProcessImpl::CreatePrintPreviewDialogController() {
-#if defined(ENABLE_FULL_PRINTING)
+#if defined(ENABLE_PRINT_PREVIEW)
   DCHECK(print_preview_dialog_controller_.get() == NULL);
   print_preview_dialog_controller_ =
       new printing::PrintPreviewDialogController();
@@ -1107,7 +1104,7 @@ void BrowserProcessImpl::CreatePrintPreviewDialogController() {
 }
 
 void BrowserProcessImpl::CreateBackgroundPrintingManager() {
-#if defined(ENABLE_FULL_PRINTING)
+#if defined(ENABLE_PRINT_PREVIEW)
   DCHECK(background_printing_manager_.get() == NULL);
   background_printing_manager_.reset(new printing::BackgroundPrintingManager());
 #else