| OLD | NEW | 
|     1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |     1 // Copyright (c) 2012 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/profiles/profile_impl.h" |     5 #include "chrome/browser/profiles/profile_impl.h" | 
|     6  |     6  | 
|     7 #include "base/bind.h" |     7 #include "base/bind.h" | 
|     8 #include "base/command_line.h" |     8 #include "base/command_line.h" | 
|     9 #include "base/compiler_specific.h" |     9 #include "base/compiler_specific.h" | 
|    10 #include "base/environment.h" |    10 #include "base/environment.h" | 
| (...skipping 10 matching lines...) Expand all  Loading... | 
|    21 #include "chrome/browser/background/background_contents_service_factory.h" |    21 #include "chrome/browser/background/background_contents_service_factory.h" | 
|    22 #include "chrome/browser/background/background_mode_manager.h" |    22 #include "chrome/browser/background/background_mode_manager.h" | 
|    23 #include "chrome/browser/bookmarks/bookmark_model.h" |    23 #include "chrome/browser/bookmarks/bookmark_model.h" | 
|    24 #include "chrome/browser/browser_process.h" |    24 #include "chrome/browser/browser_process.h" | 
|    25 #include "chrome/browser/chrome_plugin_service_filter.h" |    25 #include "chrome/browser/chrome_plugin_service_filter.h" | 
|    26 #include "chrome/browser/content_settings/cookie_settings.h" |    26 #include "chrome/browser/content_settings/cookie_settings.h" | 
|    27 #include "chrome/browser/content_settings/host_content_settings_map.h" |    27 #include "chrome/browser/content_settings/host_content_settings_map.h" | 
|    28 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |    28 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 
|    29 #include "chrome/browser/download/download_service.h" |    29 #include "chrome/browser/download/download_service.h" | 
|    30 #include "chrome/browser/download/download_service_factory.h" |    30 #include "chrome/browser/download/download_service_factory.h" | 
|    31 #include "chrome/browser/extensions/component_loader.h" |  | 
|    32 #include "chrome/browser/extensions/extension_devtools_manager.h" |  | 
|    33 #include "chrome/browser/extensions/extension_error_reporter.h" |  | 
|    34 #include "chrome/browser/extensions/extension_event_router.h" |    31 #include "chrome/browser/extensions/extension_event_router.h" | 
|    35 #include "chrome/browser/extensions/extension_info_map.h" |  | 
|    36 #include "chrome/browser/extensions/extension_message_service.h" |  | 
|    37 #include "chrome/browser/extensions/extension_navigation_observer.h" |  | 
|    38 #include "chrome/browser/extensions/extension_pref_store.h" |    32 #include "chrome/browser/extensions/extension_pref_store.h" | 
 |    33 #include "chrome/browser/extensions/extension_pref_value_map.h" | 
|    39 #include "chrome/browser/extensions/extension_process_manager.h" |    34 #include "chrome/browser/extensions/extension_process_manager.h" | 
|    40 #include "chrome/browser/extensions/extension_service.h" |    35 #include "chrome/browser/extensions/extension_service.h" | 
|    41 #include "chrome/browser/extensions/extension_special_storage_policy.h" |    36 #include "chrome/browser/extensions/extension_special_storage_policy.h" | 
|    42 #include "chrome/browser/extensions/lazy_background_task_queue.h" |    37 #include "chrome/browser/extensions/extension_system.h" | 
|    43 #include "chrome/browser/extensions/unpacked_installer.h" |    38 #include "chrome/browser/extensions/extension_system_factory.h" | 
|    44 #include "chrome/browser/extensions/user_script_master.h" |    39 #include "chrome/browser/extensions/user_script_master.h" | 
|    45 #include "chrome/browser/favicon/favicon_service.h" |    40 #include "chrome/browser/favicon/favicon_service.h" | 
|    46 #include "chrome/browser/geolocation/chrome_geolocation_permission_context.h" |    41 #include "chrome/browser/geolocation/chrome_geolocation_permission_context.h" | 
|    47 #include "chrome/browser/history/history.h" |    42 #include "chrome/browser/history/history.h" | 
|    48 #include "chrome/browser/history/shortcuts_backend.h" |    43 #include "chrome/browser/history/shortcuts_backend.h" | 
|    49 #include "chrome/browser/history/top_sites.h" |    44 #include "chrome/browser/history/top_sites.h" | 
|    50 #include "chrome/browser/instant/instant_controller.h" |    45 #include "chrome/browser/instant/instant_controller.h" | 
|    51 #include "chrome/browser/metrics/metrics_service.h" |    46 #include "chrome/browser/metrics/metrics_service.h" | 
|    52 #include "chrome/browser/net/chrome_url_request_context.h" |    47 #include "chrome/browser/net/chrome_url_request_context.h" | 
|    53 #include "chrome/browser/net/net_pref_observer.h" |    48 #include "chrome/browser/net/net_pref_observer.h" | 
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   221                              PrefService::SYNCABLE_PREF); |   216                              PrefService::SYNCABLE_PREF); | 
|   222 } |   217 } | 
|   223  |   218  | 
|   224 ProfileImpl::ProfileImpl(const FilePath& path, |   219 ProfileImpl::ProfileImpl(const FilePath& path, | 
|   225                          Delegate* delegate, |   220                          Delegate* delegate, | 
|   226                          CreateMode create_mode) |   221                          CreateMode create_mode) | 
|   227     : path_(path), |   222     : path_(path), | 
|   228       ALLOW_THIS_IN_INITIALIZER_LIST(visited_link_event_listener_( |   223       ALLOW_THIS_IN_INITIALIZER_LIST(visited_link_event_listener_( | 
|   229           new VisitedLinkEventListener(this))), |   224           new VisitedLinkEventListener(this))), | 
|   230       ALLOW_THIS_IN_INITIALIZER_LIST(io_data_(this)), |   225       ALLOW_THIS_IN_INITIALIZER_LIST(io_data_(this)), | 
|   231       extension_devtools_manager_(NULL), |  | 
|   232       host_content_settings_map_(NULL), |   226       host_content_settings_map_(NULL), | 
|   233       history_service_created_(false), |   227       history_service_created_(false), | 
|   234       favicon_service_created_(false), |   228       favicon_service_created_(false), | 
|   235       created_web_data_service_(false), |   229       created_web_data_service_(false), | 
|   236       start_time_(Time::Now()), |   230       start_time_(Time::Now()), | 
|   237 #if defined(OS_WIN) |   231 #if defined(OS_WIN) | 
|   238       checked_instant_promo_(false), |   232       checked_instant_promo_(false), | 
|   239 #endif |   233 #endif | 
|   240       delegate_(delegate), |   234       delegate_(delegate), | 
|   241       predictor_(NULL), |   235       predictor_(NULL), | 
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   425           host, &zoom_level); |   419           host, &zoom_level); | 
|   426       DCHECK(success); |   420       DCHECK(success); | 
|   427       host_zoom_map->SetZoomLevel(host, zoom_level); |   421       host_zoom_map->SetZoomLevel(host, zoom_level); | 
|   428     } |   422     } | 
|   429   } |   423   } | 
|   430  |   424  | 
|   431   registrar_.Add(this, content::NOTIFICATION_ZOOM_LEVEL_CHANGED, |   425   registrar_.Add(this, content::NOTIFICATION_ZOOM_LEVEL_CHANGED, | 
|   432                content::Source<HostZoomMap>(host_zoom_map)); |   426                content::Source<HostZoomMap>(host_zoom_map)); | 
|   433 } |   427 } | 
|   434  |   428  | 
|   435 void ProfileImpl::InitExtensions(bool extensions_enabled) { |  | 
|   436   if (user_script_master_ || extension_service_.get()) |  | 
|   437     return;  // Already initialized. |  | 
|   438  |  | 
|   439   const CommandLine* command_line = CommandLine::ForCurrentProcess(); |  | 
|   440   if (command_line->HasSwitch( |  | 
|   441       switches::kEnableExtensionTimelineApi)) { |  | 
|   442     extension_devtools_manager_ = new ExtensionDevToolsManager(this); |  | 
|   443   } |  | 
|   444  |  | 
|   445   // The ExtensionInfoMap needs to be created before the |  | 
|   446   // ExtensionProcessManager. |  | 
|   447   extension_info_map_ = new ExtensionInfoMap(); |  | 
|   448   extension_process_manager_.reset(ExtensionProcessManager::Create(this)); |  | 
|   449   lazy_background_task_queue_.reset(new LazyBackgroundTaskQueue(this)); |  | 
|   450   extension_event_router_.reset(new ExtensionEventRouter(this)); |  | 
|   451   extension_message_service_.reset(new ExtensionMessageService( |  | 
|   452       lazy_background_task_queue_.get())); |  | 
|   453   extension_navigation_observer_.reset(new ExtensionNavigationObserver(this)); |  | 
|   454  |  | 
|   455   ExtensionErrorReporter::Init(true);  // allow noisy errors. |  | 
|   456  |  | 
|   457   user_script_master_ = new UserScriptMaster(this); |  | 
|   458  |  | 
|   459   bool autoupdate_enabled = true; |  | 
|   460 #if defined(OS_CHROMEOS) |  | 
|   461   if (!extensions_enabled) |  | 
|   462     autoupdate_enabled = false; |  | 
|   463   else |  | 
|   464     autoupdate_enabled = !command_line->HasSwitch(switches::kGuestSession); |  | 
|   465 #endif |  | 
|   466   extension_service_.reset(new ExtensionService( |  | 
|   467       this, |  | 
|   468       CommandLine::ForCurrentProcess(), |  | 
|   469       GetPath().AppendASCII(ExtensionService::kInstallDirectoryName), |  | 
|   470       extension_prefs_.get(), |  | 
|   471       autoupdate_enabled, |  | 
|   472       extensions_enabled)); |  | 
|   473  |  | 
|   474   extension_service_->component_loader()->AddDefaultComponentExtensions(); |  | 
|   475   if (command_line->HasSwitch(switches::kLoadComponentExtension)) { |  | 
|   476     CommandLine::StringType path_list = command_line->GetSwitchValueNative( |  | 
|   477         switches::kLoadComponentExtension); |  | 
|   478     StringTokenizerT<CommandLine::StringType, |  | 
|   479         CommandLine::StringType::const_iterator> t(path_list, |  | 
|   480                                                    FILE_PATH_LITERAL(",")); |  | 
|   481     while (t.GetNext()) { |  | 
|   482       // Load the component extension manifest synchronously. |  | 
|   483       // Blocking the UI thread is acceptable here since |  | 
|   484       // this flag designated for developers. |  | 
|   485       base::ThreadRestrictions::ScopedAllowIO allow_io; |  | 
|   486       extension_service_->component_loader()->AddOrReplace( |  | 
|   487           FilePath(t.token())); |  | 
|   488     } |  | 
|   489   } |  | 
|   490   extension_service_->Init(); |  | 
|   491  |  | 
|   492   if (extensions_enabled) { |  | 
|   493     // Load any extensions specified with --load-extension. |  | 
|   494     // TODO(yoz): Seems like this should move into ExtensionService::Init. |  | 
|   495     if (command_line->HasSwitch(switches::kLoadExtension)) { |  | 
|   496       CommandLine::StringType path_list = command_line->GetSwitchValueNative( |  | 
|   497           switches::kLoadExtension); |  | 
|   498       StringTokenizerT<CommandLine::StringType, |  | 
|   499           CommandLine::StringType::const_iterator> t(path_list, |  | 
|   500                                                      FILE_PATH_LITERAL(",")); |  | 
|   501       scoped_refptr<extensions::UnpackedInstaller> installer = |  | 
|   502           extensions::UnpackedInstaller::Create(extension_service_.get()); |  | 
|   503       while (t.GetNext()) { |  | 
|   504         installer->LoadFromCommandLine(FilePath(t.token())); |  | 
|   505       } |  | 
|   506     } |  | 
|   507   } |  | 
|   508  |  | 
|   509   // Make the chrome://extension-icon/ resource available. |  | 
|   510   GetChromeURLDataManager()->AddDataSource(new ExtensionIconSource(this)); |  | 
|   511  |  | 
|   512   // Initialize extension event routers. Note that on Chrome OS, this will |  | 
|   513   // not succeed if the user has not logged in yet, in which case the |  | 
|   514   // event routers are initialized in LoginUtilsImpl::CompleteLogin instead. |  | 
|   515   // The InitEventRouters call used to be in BrowserMain, because when bookmark |  | 
|   516   // import happened on first run, the bookmark bar was not being correctly |  | 
|   517   // initialized (see issue 40144). Now that bookmarks aren't imported and |  | 
|   518   // the event routers need to be initialized for every profile individually, |  | 
|   519   // initialize them with the extension service. |  | 
|   520   // If this profile is being created as part of the import process, never |  | 
|   521   // initialize the event routers. If import is going to run in a separate |  | 
|   522   // process (the profile itself is on the main process), wait for import to |  | 
|   523   // finish before initializing the routers. |  | 
|   524   if (!command_line->HasSwitch(switches::kImport) && |  | 
|   525       !command_line->HasSwitch(switches::kImportFromFile)) { |  | 
|   526     if (g_browser_process->profile_manager()->will_import()) { |  | 
|   527       extension_service_->InitEventRoutersAfterImport(); |  | 
|   528     } else { |  | 
|   529       extension_service_->InitEventRouters(); |  | 
|   530     } |  | 
|   531   } |  | 
|   532 } |  | 
|   533  |  | 
|   534 void ProfileImpl::InitPromoResources() { |   429 void ProfileImpl::InitPromoResources() { | 
|   535   if (promo_resource_service_) |   430   if (promo_resource_service_) | 
|   536     return; |   431     return; | 
|   537  |   432  | 
|   538   promo_resource_service_ = new PromoResourceService(this); |   433   promo_resource_service_ = new PromoResourceService(this); | 
|   539   promo_resource_service_->StartAfterDelay(); |   434   promo_resource_service_->StartAfterDelay(); | 
|   540 } |   435 } | 
|   541  |   436  | 
|   542 void ProfileImpl::InitRegisteredProtocolHandlers() { |   437 void ProfileImpl::InitRegisteredProtocolHandlers() { | 
|   543   if (protocol_handler_registry_) |   438   if (protocol_handler_registry_) | 
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   684       new VisitedLinkMaster(visited_link_event_listener_.get(), this)); |   579       new VisitedLinkMaster(visited_link_event_listener_.get(), this)); | 
|   685     if (!visited_links->Init()) |   580     if (!visited_links->Init()) | 
|   686       return NULL; |   581       return NULL; | 
|   687     visited_link_master_.swap(visited_links); |   582     visited_link_master_.swap(visited_links); | 
|   688   } |   583   } | 
|   689  |   584  | 
|   690   return visited_link_master_.get(); |   585   return visited_link_master_.get(); | 
|   691 } |   586 } | 
|   692  |   587  | 
|   693 ExtensionService* ProfileImpl::GetExtensionService() { |   588 ExtensionService* ProfileImpl::GetExtensionService() { | 
|   694   return extension_service_.get(); |   589   return ExtensionSystemFactory::GetForProfile(this)->extension_service(); | 
|   695 } |   590 } | 
|   696  |   591  | 
|   697 UserScriptMaster* ProfileImpl::GetUserScriptMaster() { |   592 UserScriptMaster* ProfileImpl::GetUserScriptMaster() { | 
|   698   return user_script_master_.get(); |   593   return ExtensionSystemFactory::GetForProfile(this)->user_script_master(); | 
|   699 } |  | 
|   700  |  | 
|   701 ExtensionDevToolsManager* ProfileImpl::GetExtensionDevToolsManager() { |  | 
|   702   return extension_devtools_manager_.get(); |  | 
|   703 } |   594 } | 
|   704  |   595  | 
|   705 ExtensionProcessManager* ProfileImpl::GetExtensionProcessManager() { |   596 ExtensionProcessManager* ProfileImpl::GetExtensionProcessManager() { | 
|   706   return extension_process_manager_.get(); |   597   return ExtensionSystemFactory::GetForProfile(this)->process_manager(); | 
|   707 } |  | 
|   708  |  | 
|   709 ExtensionMessageService* ProfileImpl::GetExtensionMessageService() { |  | 
|   710   return extension_message_service_.get(); |  | 
|   711 } |   598 } | 
|   712  |   599  | 
|   713 ExtensionEventRouter* ProfileImpl::GetExtensionEventRouter() { |   600 ExtensionEventRouter* ProfileImpl::GetExtensionEventRouter() { | 
|   714   return extension_event_router_.get(); |   601   return ExtensionSystemFactory::GetForProfile(this)->event_router(); | 
|   715 } |   602 } | 
|   716  |   603  | 
|   717 ExtensionSpecialStoragePolicy* |   604 ExtensionSpecialStoragePolicy* | 
|   718     ProfileImpl::GetExtensionSpecialStoragePolicy() { |   605     ProfileImpl::GetExtensionSpecialStoragePolicy() { | 
|   719   if (!extension_special_storage_policy_.get()) { |   606   if (!extension_special_storage_policy_.get()) { | 
|   720     extension_special_storage_policy_ = new ExtensionSpecialStoragePolicy( |   607     extension_special_storage_policy_ = new ExtensionSpecialStoragePolicy( | 
|   721         CookieSettings::Factory::GetForProfile(this)); |   608         CookieSettings::Factory::GetForProfile(this)); | 
|   722   } |   609   } | 
|   723   return extension_special_storage_policy_.get(); |   610   return extension_special_storage_policy_.get(); | 
|   724 } |   611 } | 
|   725  |   612  | 
|   726 LazyBackgroundTaskQueue* ProfileImpl::GetLazyBackgroundTaskQueue() { |  | 
|   727   return lazy_background_task_queue_.get(); |  | 
|   728 } |  | 
|   729  |  | 
|   730 void ProfileImpl::OnPrefsLoaded(bool success) { |   613 void ProfileImpl::OnPrefsLoaded(bool success) { | 
|   731   if (!success) { |   614   if (!success) { | 
|   732     if (delegate_) |   615     if (delegate_) | 
|   733       delegate_->OnProfileCreated(this, false, false); |   616       delegate_->OnProfileCreated(this, false, false); | 
|   734     return; |   617     return; | 
|   735   } |   618   } | 
|   736  |   619  | 
|   737   // The Profile class and ProfileManager class may read some prefs so |   620   // The Profile class and ProfileManager class may read some prefs so | 
|   738   // register known prefs as soon as possible. |   621   // register known prefs as soon as possible. | 
|   739   Profile::RegisterUserPrefs(prefs_.get()); |   622   Profile::RegisterUserPrefs(prefs_.get()); | 
|   740   browser::RegisterUserPrefs(prefs_.get()); |   623   browser::RegisterUserPrefs(prefs_.get()); | 
|   741   // TODO(mirandac): remove migration code after 6 months (crbug.com/69995). |   624   // TODO(mirandac): remove migration code after 6 months (crbug.com/69995). | 
|   742   if (g_browser_process->local_state()) { |   625   if (g_browser_process->local_state()) { | 
|   743     browser::MigrateBrowserPrefs(prefs_.get(), |   626     browser::MigrateBrowserPrefs(prefs_.get(), | 
|   744                                  g_browser_process->local_state()); |   627                                  g_browser_process->local_state()); | 
|   745   } |   628   } | 
|   746  |   629  | 
|   747   // The last session exited cleanly if there is no pref for |   630   // The last session exited cleanly if there is no pref for | 
|   748   // kSessionExitedCleanly or the value for kSessionExitedCleanly is true. |   631   // kSessionExitedCleanly or the value for kSessionExitedCleanly is true. | 
|   749   last_session_exited_cleanly_ = |   632   last_session_exited_cleanly_ = | 
|   750       prefs_->GetBoolean(prefs::kSessionExitedCleanly); |   633       prefs_->GetBoolean(prefs::kSessionExitedCleanly); | 
|   751   // Mark the session as open. |   634   // Mark the session as open. | 
|   752   prefs_->SetBoolean(prefs::kSessionExitedCleanly, false); |   635   prefs_->SetBoolean(prefs::kSessionExitedCleanly, false); | 
|   753  |   636  | 
|   754   bool extensions_disabled = |  | 
|   755       prefs_->GetBoolean(prefs::kDisableExtensions) || |  | 
|   756       CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableExtensions); |  | 
|   757  |  | 
|   758   ProfileDependencyManager::GetInstance()->CreateProfileServices(this, false); |   637   ProfileDependencyManager::GetInstance()->CreateProfileServices(this, false); | 
|   759  |   638  | 
|   760   // Ensure that preferences set by extensions are restored in the profile |  | 
|   761   // as early as possible. The constructor takes care of that. |  | 
|   762   extension_prefs_.reset(new ExtensionPrefs( |  | 
|   763       prefs_.get(), |  | 
|   764       GetPath().AppendASCII(ExtensionService::kInstallDirectoryName), |  | 
|   765       GetExtensionPrefValueMap())); |  | 
|   766   extension_prefs_->Init(extensions_disabled); |  | 
|   767  |  | 
|   768   DCHECK(!net_pref_observer_.get()); |   639   DCHECK(!net_pref_observer_.get()); | 
|   769   net_pref_observer_.reset(new NetPrefObserver( |   640   net_pref_observer_.reset(new NetPrefObserver( | 
|   770       prefs_.get(), |   641       prefs_.get(), | 
|   771       prerender::PrerenderManagerFactory::GetForProfile(this), |   642       prerender::PrerenderManagerFactory::GetForProfile(this), | 
|   772       predictor_)); |   643       predictor_)); | 
|   773  |   644  | 
|   774   bool is_new_profile = prefs_->GetInitializationStatus() == |   645   bool is_new_profile = prefs_->GetInitializationStatus() == | 
|   775       PrefService::INITIALIZATION_STATUS_CREATED_NEW_PROFILE; |   646       PrefService::INITIALIZATION_STATUS_CREATED_NEW_PROFILE; | 
|   776   ChromeVersionService::OnProfileLoaded(prefs_.get(), is_new_profile); |   647   ChromeVersionService::OnProfileLoaded(prefs_.get(), is_new_profile); | 
|   777   DoFinalInit(is_new_profile); |   648   DoFinalInit(is_new_profile); | 
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   811   // Even when Chromium is started in OTR mode, a normal profile is always |   682   // Even when Chromium is started in OTR mode, a normal profile is always | 
|   812   // created first. |   683   // created first. | 
|   813   if (!default_request_context_) |   684   if (!default_request_context_) | 
|   814     default_request_context_ = request_context; |   685     default_request_context_ = request_context; | 
|   815  |   686  | 
|   816   return request_context; |   687   return request_context; | 
|   817 } |   688 } | 
|   818  |   689  | 
|   819 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForRenderProcess( |   690 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForRenderProcess( | 
|   820     int renderer_child_id) { |   691     int renderer_child_id) { | 
|   821   if (extension_service_.get()) { |   692   ExtensionService* extension_service = | 
|   822     const Extension* installed_app = extension_service_-> |   693       ExtensionSystemFactory::GetForProfile(this)->extension_service(); | 
 |   694   if (extension_service) { | 
 |   695     const Extension* installed_app = extension_service-> | 
|   823         GetInstalledAppForRenderer(renderer_child_id); |   696         GetInstalledAppForRenderer(renderer_child_id); | 
|   824     if (installed_app != NULL && installed_app->is_storage_isolated() && |   697     if (installed_app != NULL && installed_app->is_storage_isolated() && | 
|   825         installed_app->HasAPIPermission( |   698         installed_app->HasAPIPermission( | 
|   826             ExtensionAPIPermission::kExperimental)) { |   699             ExtensionAPIPermission::kExperimental)) { | 
|   827       return GetRequestContextForIsolatedApp(installed_app->id()); |   700       return GetRequestContextForIsolatedApp(installed_app->id()); | 
|   828     } |   701     } | 
|   829   } |   702   } | 
|   830   return GetRequestContext(); |   703   return GetRequestContext(); | 
|   831 } |   704 } | 
|   832  |   705  | 
| (...skipping 15 matching lines...) Expand all  Loading... | 
|   848  |   721  | 
|   849 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForExtensions() { |   722 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForExtensions() { | 
|   850   return io_data_.GetExtensionsRequestContextGetter(); |   723   return io_data_.GetExtensionsRequestContextGetter(); | 
|   851 } |   724 } | 
|   852  |   725  | 
|   853 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForIsolatedApp( |   726 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForIsolatedApp( | 
|   854     const std::string& app_id) { |   727     const std::string& app_id) { | 
|   855   return io_data_.GetIsolatedAppRequestContextGetter(app_id); |   728   return io_data_.GetIsolatedAppRequestContextGetter(app_id); | 
|   856 } |   729 } | 
|   857  |   730  | 
|   858 void ProfileImpl::RegisterExtensionWithRequestContexts( |  | 
|   859     const Extension* extension) { |  | 
|   860   base::Time install_time; |  | 
|   861   if (extension->location() != Extension::COMPONENT) { |  | 
|   862     install_time = GetExtensionService()->extension_prefs()-> |  | 
|   863         GetInstallTime(extension->id()); |  | 
|   864   } |  | 
|   865   bool incognito_enabled = |  | 
|   866       GetExtensionService()->IsIncognitoEnabled(extension->id()); |  | 
|   867   BrowserThread::PostTask( |  | 
|   868       BrowserThread::IO, FROM_HERE, |  | 
|   869       base::Bind(&ExtensionInfoMap::AddExtension, extension_info_map_.get(), |  | 
|   870                  make_scoped_refptr(extension), install_time, |  | 
|   871                  incognito_enabled)); |  | 
|   872 } |  | 
|   873  |  | 
|   874 void ProfileImpl::UnregisterExtensionWithRequestContexts( |  | 
|   875     const std::string& extension_id, |  | 
|   876     const extension_misc::UnloadedExtensionReason reason) { |  | 
|   877   BrowserThread::PostTask( |  | 
|   878       BrowserThread::IO, FROM_HERE, |  | 
|   879       base::Bind(&ExtensionInfoMap::RemoveExtension, extension_info_map_.get(), |  | 
|   880                  extension_id, reason)); |  | 
|   881 } |  | 
|   882  |  | 
|   883 net::SSLConfigService* ProfileImpl::GetSSLConfigService() { |   731 net::SSLConfigService* ProfileImpl::GetSSLConfigService() { | 
|   884   return ssl_config_service_manager_->Get(); |   732   return ssl_config_service_manager_->Get(); | 
|   885 } |   733 } | 
|   886  |   734  | 
|   887 HostContentSettingsMap* ProfileImpl::GetHostContentSettingsMap() { |   735 HostContentSettingsMap* ProfileImpl::GetHostContentSettingsMap() { | 
|   888   if (!host_content_settings_map_.get()) { |   736   if (!host_content_settings_map_.get()) { | 
|   889     host_content_settings_map_ = new HostContentSettingsMap( |   737     host_content_settings_map_ = new HostContentSettingsMap( | 
|   890         GetPrefs(), GetExtensionService(), false); |   738         GetPrefs(), GetExtensionService(), false); | 
|   891   } |   739   } | 
|   892   return host_content_settings_map_.get(); |   740   return host_content_settings_map_.get(); | 
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1127 } |   975 } | 
|  1128  |   976  | 
|  1129 void ProfileImpl::StopCreateSessionServiceTimer() { |   977 void ProfileImpl::StopCreateSessionServiceTimer() { | 
|  1130   create_session_service_timer_.Stop(); |   978   create_session_service_timer_.Stop(); | 
|  1131 } |   979 } | 
|  1132  |   980  | 
|  1133 void ProfileImpl::EnsureSessionServiceCreated() { |   981 void ProfileImpl::EnsureSessionServiceCreated() { | 
|  1134   SessionServiceFactory::GetForProfile(this); |   982   SessionServiceFactory::GetForProfile(this); | 
|  1135 } |   983 } | 
|  1136  |   984  | 
|  1137 ExtensionInfoMap* ProfileImpl::GetExtensionInfoMap() { |  | 
|  1138   return extension_info_map_.get(); |  | 
|  1139 } |  | 
|  1140  |  | 
|  1141 ChromeURLDataManager* ProfileImpl::GetChromeURLDataManager() { |   985 ChromeURLDataManager* ProfileImpl::GetChromeURLDataManager() { | 
|  1142   if (!chrome_url_data_manager_.get()) |   986   if (!chrome_url_data_manager_.get()) | 
|  1143     chrome_url_data_manager_.reset(new ChromeURLDataManager( |   987     chrome_url_data_manager_.reset(new ChromeURLDataManager( | 
|  1144         io_data_.GetChromeURLDataManagerBackendGetter())); |   988         io_data_.GetChromeURLDataManagerBackendGetter())); | 
|  1145   return chrome_url_data_manager_.get(); |   989   return chrome_url_data_manager_.get(); | 
|  1146 } |   990 } | 
|  1147  |   991  | 
|  1148 PromoCounter* ProfileImpl::GetInstantPromoCounter() { |   992 PromoCounter* ProfileImpl::GetInstantPromoCounter() { | 
|  1149 #if defined(OS_WIN) |   993 #if defined(OS_WIN) | 
|  1150   // TODO: enable this when we're ready to turn on the promo. |   994   // TODO: enable this when we're ready to turn on the promo. | 
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1346                                      FilePath* cache_path, |  1190                                      FilePath* cache_path, | 
|  1347                                      int* max_size) { |  1191                                      int* max_size) { | 
|  1348   DCHECK(cache_path); |  1192   DCHECK(cache_path); | 
|  1349   DCHECK(max_size); |  1193   DCHECK(max_size); | 
|  1350   FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir)); |  1194   FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir)); | 
|  1351   if (!path.empty()) |  1195   if (!path.empty()) | 
|  1352     *cache_path = path; |  1196     *cache_path = path; | 
|  1353   *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : |  1197   *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : | 
|  1354                                  prefs_->GetInteger(prefs::kDiskCacheSize); |  1198                                  prefs_->GetInteger(prefs::kDiskCacheSize); | 
|  1355 } |  1199 } | 
| OLD | NEW |