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/browser_process_impl.h" | 5 #include "chrome/browser/browser_process_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <map> | 9 #include <map> |
10 #include <utility> | 10 #include <utility> |
(...skipping 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1189 content::BrowserThread::GetMessageLoopProxyForThread( | 1189 content::BrowserThread::GetMessageLoopProxyForThread( |
1190 content::BrowserThread::UI), | 1190 content::BrowserThread::UI), |
1191 content::BrowserThread::GetMessageLoopProxyForThread( | 1191 content::BrowserThread::GetMessageLoopProxyForThread( |
1192 content::BrowserThread::IO), | 1192 content::BrowserThread::IO), |
1193 blocking_task_runner); | 1193 blocking_task_runner); |
1194 #endif // defined(OS_ANDROID) | 1194 #endif // defined(OS_ANDROID) |
1195 } | 1195 } |
1196 | 1196 |
1197 void BrowserProcessImpl::ApplyDefaultBrowserPolicy() { | 1197 void BrowserProcessImpl::ApplyDefaultBrowserPolicy() { |
1198 if (local_state()->GetBoolean(prefs::kDefaultBrowserSettingEnabled)) { | 1198 if (local_state()->GetBoolean(prefs::kDefaultBrowserSettingEnabled)) { |
| 1199 // The worker pointer is reference counted. While it is running, the |
| 1200 // message loops of the FILE and UI thread will hold references to it |
| 1201 // and it will be automatically freed once all its tasks have finished. |
1199 scoped_refptr<shell_integration::DefaultWebClientWorker> | 1202 scoped_refptr<shell_integration::DefaultWebClientWorker> |
1200 set_browser_worker = new shell_integration::DefaultBrowserWorker(NULL); | 1203 set_browser_worker = new shell_integration::DefaultBrowserWorker( |
| 1204 nullptr, |
| 1205 /*delete_observer=*/false); |
| 1206 // The user interaction must always be disabled when applying the default |
| 1207 // browser policy since it is done at each browser startup and the result |
| 1208 // of the interaction cannot be forced. |
| 1209 set_browser_worker->set_interactive_permitted(false); |
1201 set_browser_worker->StartSetAsDefault(); | 1210 set_browser_worker->StartSetAsDefault(); |
1202 } | 1211 } |
1203 } | 1212 } |
1204 | 1213 |
1205 void BrowserProcessImpl::ApplyAllowCrossOriginAuthPromptPolicy() { | 1214 void BrowserProcessImpl::ApplyAllowCrossOriginAuthPromptPolicy() { |
1206 bool value = local_state()->GetBoolean(prefs::kAllowCrossOriginAuthPrompt); | 1215 bool value = local_state()->GetBoolean(prefs::kAllowCrossOriginAuthPrompt); |
1207 ResourceDispatcherHost::Get()->SetAllowCrossOriginAuthPrompt(value); | 1216 ResourceDispatcherHost::Get()->SetAllowCrossOriginAuthPrompt(value); |
1208 } | 1217 } |
1209 | 1218 |
1210 void BrowserProcessImpl::ApplyMetricsReportingPolicy() { | 1219 void BrowserProcessImpl::ApplyMetricsReportingPolicy() { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1282 } | 1291 } |
1283 | 1292 |
1284 void BrowserProcessImpl::OnAutoupdateTimer() { | 1293 void BrowserProcessImpl::OnAutoupdateTimer() { |
1285 if (CanAutorestartForUpdate()) { | 1294 if (CanAutorestartForUpdate()) { |
1286 DLOG(WARNING) << "Detected update. Restarting browser."; | 1295 DLOG(WARNING) << "Detected update. Restarting browser."; |
1287 RestartBackgroundInstance(); | 1296 RestartBackgroundInstance(); |
1288 } | 1297 } |
1289 } | 1298 } |
1290 | 1299 |
1291 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1300 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
OLD | NEW |