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

Side by Side Diff: chrome/browser/profiles/off_the_record_profile_impl.cc

Issue 2479593006: Move enable extensions define to a build flag. (Closed)
Patch Set: Merge Created 4 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
OLDNEW
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/off_the_record_profile_impl.h" 5 #include "chrome/browser/profiles/off_the_record_profile_impl.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 #include "components/proxy_config/pref_proxy_config_tracker.h" 49 #include "components/proxy_config/pref_proxy_config_tracker.h"
50 #include "components/sync_preferences/pref_service_syncable.h" 50 #include "components/sync_preferences/pref_service_syncable.h"
51 #include "components/user_prefs/user_prefs.h" 51 #include "components/user_prefs/user_prefs.h"
52 #include "components/zoom/zoom_event_manager.h" 52 #include "components/zoom/zoom_event_manager.h"
53 #include "content/public/browser/browser_thread.h" 53 #include "content/public/browser/browser_thread.h"
54 #include "content/public/browser/host_zoom_map.h" 54 #include "content/public/browser/host_zoom_map.h"
55 #include "content/public/browser/render_process_host.h" 55 #include "content/public/browser/render_process_host.h"
56 #include "content/public/browser/storage_partition.h" 56 #include "content/public/browser/storage_partition.h"
57 #include "content/public/browser/url_data_source.h" 57 #include "content/public/browser/url_data_source.h"
58 #include "content/public/browser/web_contents.h" 58 #include "content/public/browser/web_contents.h"
59 #include "extensions/features/features.h"
59 #include "net/http/http_server_properties.h" 60 #include "net/http/http_server_properties.h"
60 #include "net/http/transport_security_state.h" 61 #include "net/http/transport_security_state.h"
61 #include "storage/browser/database/database_tracker.h" 62 #include "storage/browser/database/database_tracker.h"
62 63
63 #if defined(OS_ANDROID) 64 #if defined(OS_ANDROID)
64 #include "components/prefs/scoped_user_pref_update.h" 65 #include "components/prefs/scoped_user_pref_update.h"
65 #include "components/proxy_config/proxy_prefs.h" 66 #include "components/proxy_config/proxy_prefs.h"
66 #endif // defined(OS_ANDROID) 67 #endif // defined(OS_ANDROID)
67 68
68 #if defined(OS_CHROMEOS) 69 #if defined(OS_CHROMEOS)
69 #include "chrome/browser/chromeos/preferences.h" 70 #include "chrome/browser/chromeos/preferences.h"
70 #include "chrome/browser/chromeos/profiles/profile_helper.h" 71 #include "chrome/browser/chromeos/profiles/profile_helper.h"
71 #endif 72 #endif
72 73
73 #if !defined(OS_CHROMEOS) 74 #if !defined(OS_CHROMEOS)
74 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" 75 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h"
75 #endif 76 #endif
76 77
77 #if defined(ENABLE_EXTENSIONS) 78 #if BUILDFLAG(ENABLE_EXTENSIONS)
78 #include "chrome/browser/extensions/extension_service.h" 79 #include "chrome/browser/extensions/extension_service.h"
79 #include "chrome/browser/extensions/extension_special_storage_policy.h" 80 #include "chrome/browser/extensions/extension_special_storage_policy.h"
80 #include "components/guest_view/browser/guest_view_manager.h" 81 #include "components/guest_view/browser/guest_view_manager.h"
81 #include "extensions/browser/api/web_request/web_request_api.h" 82 #include "extensions/browser/api/web_request/web_request_api.h"
82 #include "extensions/browser/extension_system.h" 83 #include "extensions/browser/extension_system.h"
83 #include "extensions/common/extension.h" 84 #include "extensions/common/extension.h"
84 #endif 85 #endif
85 86
86 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) 87 #if BUILDFLAG(ENABLE_SUPERVISED_USERS)
87 #include "chrome/browser/content_settings/content_settings_supervised_provider.h " 88 #include "chrome/browser/content_settings/content_settings_supervised_provider.h "
88 #include "chrome/browser/supervised_user/supervised_user_settings_service.h" 89 #include "chrome/browser/supervised_user/supervised_user_settings_service.h"
89 #include "chrome/browser/supervised_user/supervised_user_settings_service_factor y.h" 90 #include "chrome/browser/supervised_user/supervised_user_settings_service_factor y.h"
90 #endif 91 #endif
91 92
92 using content::BrowserThread; 93 using content::BrowserThread;
93 using content::DownloadManagerDelegate; 94 using content::DownloadManagerDelegate;
94 using content::HostZoomMap; 95 using content::HostZoomMap;
95 96
96 #if defined(ENABLE_EXTENSIONS) 97 #if BUILDFLAG(ENABLE_EXTENSIONS)
97 namespace { 98 namespace {
98 99
99 void NotifyOTRProfileCreatedOnIOThread(void* original_profile, 100 void NotifyOTRProfileCreatedOnIOThread(void* original_profile,
100 void* otr_profile) { 101 void* otr_profile) {
101 extensions::ExtensionWebRequestEventRouter::GetInstance() 102 extensions::ExtensionWebRequestEventRouter::GetInstance()
102 ->OnOTRBrowserContextCreated(original_profile, otr_profile); 103 ->OnOTRBrowserContextCreated(original_profile, otr_profile);
103 } 104 }
104 105
105 void NotifyOTRProfileDestroyedOnIOThread(void* original_profile, 106 void NotifyOTRProfileDestroyedOnIOThread(void* original_profile,
106 void* otr_profile) { 107 void* otr_profile) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 IncognitoModePrefs::GetAvailability(profile_->GetPrefs()) != 147 IncognitoModePrefs::GetAvailability(profile_->GetPrefs()) !=
147 IncognitoModePrefs::DISABLED); 148 IncognitoModePrefs::DISABLED);
148 149
149 TrackZoomLevelsFromParent(); 150 TrackZoomLevelsFromParent();
150 151
151 #if defined(ENABLE_PLUGINS) 152 #if defined(ENABLE_PLUGINS)
152 ChromePluginServiceFilter::GetInstance()->RegisterResourceContext( 153 ChromePluginServiceFilter::GetInstance()->RegisterResourceContext(
153 this, io_data_->GetResourceContextNoInit()); 154 this, io_data_->GetResourceContextNoInit());
154 #endif 155 #endif
155 156
156 #if defined(ENABLE_EXTENSIONS) 157 #if BUILDFLAG(ENABLE_EXTENSIONS)
157 // Make the chrome//extension-icon/ resource available. 158 // Make the chrome//extension-icon/ resource available.
158 extensions::ExtensionIconSource* icon_source = 159 extensions::ExtensionIconSource* icon_source =
159 new extensions::ExtensionIconSource(profile_); 160 new extensions::ExtensionIconSource(profile_);
160 content::URLDataSource::Add(this, icon_source); 161 content::URLDataSource::Add(this, icon_source);
161 162
162 BrowserThread::PostTask( 163 BrowserThread::PostTask(
163 BrowserThread::IO, FROM_HERE, 164 BrowserThread::IO, FROM_HERE,
164 base::Bind(&NotifyOTRProfileCreatedOnIOThread, profile_, this)); 165 base::Bind(&NotifyOTRProfileCreatedOnIOThread, profile_, this));
165 #endif 166 #endif
166 167
167 // The DomDistillerViewerSource is not a normal WebUI so it must be registered 168 // The DomDistillerViewerSource is not a normal WebUI so it must be registered
168 // as a URLDataSource early. 169 // as a URLDataSource early.
169 dom_distiller::RegisterViewerSource(this); 170 dom_distiller::RegisterViewerSource(this);
170 } 171 }
171 172
172 OffTheRecordProfileImpl::~OffTheRecordProfileImpl() { 173 OffTheRecordProfileImpl::~OffTheRecordProfileImpl() {
173 MaybeSendDestroyedNotification(); 174 MaybeSendDestroyedNotification();
174 175
175 #if defined(ENABLE_PLUGINS) 176 #if defined(ENABLE_PLUGINS)
176 ChromePluginServiceFilter::GetInstance()->UnregisterResourceContext( 177 ChromePluginServiceFilter::GetInstance()->UnregisterResourceContext(
177 io_data_->GetResourceContextNoInit()); 178 io_data_->GetResourceContextNoInit());
178 #endif 179 #endif
179 180
180 BrowserContextDependencyManager::GetInstance()->DestroyBrowserContextServices( 181 BrowserContextDependencyManager::GetInstance()->DestroyBrowserContextServices(
181 this); 182 this);
182 183
183 #if defined(ENABLE_EXTENSIONS) 184 #if BUILDFLAG(ENABLE_EXTENSIONS)
184 BrowserThread::PostTask( 185 BrowserThread::PostTask(
185 BrowserThread::IO, FROM_HERE, 186 BrowserThread::IO, FROM_HERE,
186 base::Bind(&NotifyOTRProfileDestroyedOnIOThread, profile_, this)); 187 base::Bind(&NotifyOTRProfileDestroyedOnIOThread, profile_, this));
187 #endif 188 #endif
188 189
189 if (pref_proxy_config_tracker_) 190 if (pref_proxy_config_tracker_)
190 pref_proxy_config_tracker_->DetachFromPrefService(); 191 pref_proxy_config_tracker_->DetachFromPrefService();
191 192
192 // Clears any data the network stack contains that may be related to the 193 // Clears any data the network stack contains that may be related to the
193 // OTR session. 194 // OTR session.
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 359
359 content::ResourceContext* OffTheRecordProfileImpl::GetResourceContext() { 360 content::ResourceContext* OffTheRecordProfileImpl::GetResourceContext() {
360 return io_data_->GetResourceContext(); 361 return io_data_->GetResourceContext();
361 } 362 }
362 363
363 net::SSLConfigService* OffTheRecordProfileImpl::GetSSLConfigService() { 364 net::SSLConfigService* OffTheRecordProfileImpl::GetSSLConfigService() {
364 return profile_->GetSSLConfigService(); 365 return profile_->GetSSLConfigService();
365 } 366 }
366 367
367 content::BrowserPluginGuestManager* OffTheRecordProfileImpl::GetGuestManager() { 368 content::BrowserPluginGuestManager* OffTheRecordProfileImpl::GetGuestManager() {
368 #if defined(ENABLE_EXTENSIONS) 369 #if BUILDFLAG(ENABLE_EXTENSIONS)
369 return guest_view::GuestViewManager::FromBrowserContext(this); 370 return guest_view::GuestViewManager::FromBrowserContext(this);
370 #else 371 #else
371 return NULL; 372 return NULL;
372 #endif 373 #endif
373 } 374 }
374 375
375 storage::SpecialStoragePolicy* 376 storage::SpecialStoragePolicy*
376 OffTheRecordProfileImpl::GetSpecialStoragePolicy() { 377 OffTheRecordProfileImpl::GetSpecialStoragePolicy() {
377 #if defined(ENABLE_EXTENSIONS) 378 #if BUILDFLAG(ENABLE_EXTENSIONS)
378 return GetExtensionSpecialStoragePolicy(); 379 return GetExtensionSpecialStoragePolicy();
379 #else 380 #else
380 return NULL; 381 return NULL;
381 #endif 382 #endif
382 } 383 }
383 384
384 content::PushMessagingService* 385 content::PushMessagingService*
385 OffTheRecordProfileImpl::GetPushMessagingService() { 386 OffTheRecordProfileImpl::GetPushMessagingService() {
386 // TODO(johnme): Support push messaging in incognito if possible. 387 // TODO(johnme): Support push messaging in incognito if possible.
387 return NULL; 388 return NULL;
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 PrefProxyConfigTracker* OffTheRecordProfileImpl::CreateProxyConfigTracker() { 553 PrefProxyConfigTracker* OffTheRecordProfileImpl::CreateProxyConfigTracker() {
553 #if defined(OS_CHROMEOS) 554 #if defined(OS_CHROMEOS)
554 if (chromeos::ProfileHelper::IsSigninProfile(this)) { 555 if (chromeos::ProfileHelper::IsSigninProfile(this)) {
555 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState( 556 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState(
556 g_browser_process->local_state()); 557 g_browser_process->local_state());
557 } 558 }
558 #endif // defined(OS_CHROMEOS) 559 #endif // defined(OS_CHROMEOS)
559 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfProfile( 560 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfProfile(
560 GetPrefs(), g_browser_process->local_state()); 561 GetPrefs(), g_browser_process->local_state());
561 } 562 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698