2014-10-31 11:17:05 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								// Copyright (c) 2013 GitHub, Inc.
							 | 
						
					
						
							
								
									
										
										
										
											2014-04-25 17:49:37 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								// Use of this source code is governed by the MIT license that can be
							 | 
						
					
						
							
								
									
										
										
										
											2013-04-16 00:25:08 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								// found in the LICENSE file.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2014-03-16 08:30:26 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "atom/browser/atom_browser_context.h"
							 | 
						
					
						
							
								
									
										
										
										
											2013-04-16 00:25:08 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2016-08-05 16:35:37 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "atom/browser/api/atom_api_protocol.h"
							 | 
						
					
						
							
								
									
										
										
										
											2016-08-31 05:38:32 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "atom/browser/atom_blob_reader.h"
							 | 
						
					
						
							
								
									
										
										
										
											2014-03-16 08:30:26 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "atom/browser/atom_browser_main_parts.h"
							 | 
						
					
						
							
								
									
										
										
										
											2015-06-22 17:13:49 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "atom/browser/atom_download_manager_delegate.h"
							 | 
						
					
						
							
								
									
										
										
										
											2016-08-26 15:30:02 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "atom/browser/atom_permission_manager.h"
							 | 
						
					
						
							
								
									
										
										
										
											2015-07-14 11:40:07 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "atom/browser/browser.h"
							 | 
						
					
						
							
								
									
										
										
										
											2016-11-09 12:32:51 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "atom/browser/net/about_protocol_handler.h"
							 | 
						
					
						
							
								
									
										
										
										
											2016-08-26 15:30:02 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "atom/browser/net/asar/asar_protocol_handler.h"
							 | 
						
					
						
							
								
									
										
										
										
											2015-11-17 19:03:09 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "atom/browser/net/atom_cert_verifier.h"
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-01 10:22:22 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "atom/browser/net/atom_network_delegate.h"
							 | 
						
					
						
							
								
									
										
										
										
											2014-08-13 17:40:31 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "atom/browser/net/atom_url_request_job_factory.h"
							 | 
						
					
						
							
								
									
										
										
										
											2017-11-28 12:53:42 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "atom/browser/net/cookie_details.h"
							 | 
						
					
						
							
								
									
										
										
										
											2015-05-07 01:45:56 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "atom/browser/net/http_protocol_handler.h"
							 | 
						
					
						
							
								
									
										
										
										
											2015-02-04 15:17:28 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "atom/browser/web_view_manager.h"
							 | 
						
					
						
							
								
									
										
										
										
											2015-07-14 11:40:07 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "atom/common/atom_version.h"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include "atom/common/chrome_version.h"
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-05 13:40:38 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "atom/common/options_switches.h"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include "base/command_line.h"
							 | 
						
					
						
							
								
									
										
										
										
											2015-07-26 16:17:55 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "base/files/file_path.h"
							 | 
						
					
						
							
								
									
										
										
										
											2016-06-15 20:31:29 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "base/memory/ptr_util.h"
							 | 
						
					
						
							
								
									
										
										
										
											2016-01-21 13:51:37 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "base/path_service.h"
							 | 
						
					
						
							
								
									
										
										
										
											2015-07-14 11:40:07 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "base/strings/string_util.h"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include "base/strings/stringprintf.h"
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-18 12:35:51 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "base/task_scheduler/post_task.h"
							 | 
						
					
						
							
								
									
										
										
										
											2014-08-13 17:40:31 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "base/threading/sequenced_worker_pool.h"
							 | 
						
					
						
							
								
									
										
										
										
											2016-01-21 13:51:37 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "chrome/common/chrome_paths.h"
							 | 
						
					
						
							
								
									
										
										
										
											2015-07-26 16:17:55 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "chrome/common/pref_names.h"
							 | 
						
					
						
							
								
									
										
										
										
											2016-06-15 20:31:29 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "components/prefs/pref_registry_simple.h"
							 | 
						
					
						
							
								
									
										
										
										
											2016-08-31 05:38:32 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "content/browser/blob_storage/chrome_blob_storage_context.h"
							 | 
						
					
						
							
								
									
										
										
										
											2013-09-20 16:47:47 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "content/public/browser/browser_thread.h"
							 | 
						
					
						
							
								
									
										
										
										
											2016-08-31 05:38:32 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "content/public/browser/storage_partition.h"
							 | 
						
					
						
							
								
									
										
										
										
											2014-08-13 17:40:31 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "content/public/common/url_constants.h"
							 | 
						
					
						
							
								
									
										
										
										
											2015-07-14 11:40:07 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "content/public/common/user_agent.h"
							 | 
						
					
						
							
								
									
										
										
										
											2015-05-14 20:32:40 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "net/ftp/ftp_network_layer.h"
							 | 
						
					
						
							
								
									
										
										
										
											2014-08-13 17:40:31 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "net/url_request/data_protocol_handler.h"
							 | 
						
					
						
							
								
									
										
										
										
											2015-05-14 20:32:40 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "net/url_request/ftp_protocol_handler.h"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include "net/url_request/url_request_context.h"
							 | 
						
					
						
							
								
									
										
										
										
											2016-08-26 15:30:02 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "net/url_request/url_request_intercepting_job_factory.h"
							 | 
						
					
						
							
								
									
										
										
										
											2014-09-01 15:36:37 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "url/url_constants.h"
							 | 
						
					
						
							
								
									
										
										
										
											2013-04-16 00:25:08 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2013-09-20 16:47:47 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								using content::BrowserThread;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2014-08-13 17:40:31 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								namespace atom {
							 | 
						
					
						
							
								
									
										
										
										
											2013-09-20 16:47:47 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2014-09-23 12:13:46 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								namespace {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-05 13:40:38 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								class NoCacheBackend : public net::HttpCache::BackendFactory {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  int CreateBackend(net::NetLog* net_log,
							 | 
						
					
						
							
								
									
										
										
										
											2016-05-23 10:59:39 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                    std::unique_ptr<disk_cache::Backend>* backend,
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-05 13:40:38 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                    const net::CompletionCallback& callback) override {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return net::ERR_FAILED;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-07-14 11:40:07 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								std::string RemoveWhitespace(const std::string& str) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  std::string trimmed;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (base::RemoveChars(str, " ", &trimmed))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return trimmed;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  else
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return str;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2014-09-23 12:13:46 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}  // namespace
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2016-10-17 16:03:24 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								AtomBrowserContext::AtomBrowserContext(const std::string& partition,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                       bool in_memory,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                       const base::DictionaryValue& options)
							 | 
						
					
						
							
								
									
										
										
										
											2017-11-27 08:57:14 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    : brightray::BrowserContext(partition, in_memory) {
							 | 
						
					
						
							
								
									
										
										
										
											2016-06-22 15:46:46 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  // Construct user agent string.
							 | 
						
					
						
							
								
									
										
										
										
											2015-07-14 11:40:07 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  Browser* browser = Browser::Get();
							 | 
						
					
						
							
								
									
										
										
										
											2015-07-14 12:12:55 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  std::string name = RemoveWhitespace(browser->GetName());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  std::string user_agent;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (name == ATOM_PRODUCT_NAME) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-17 21:55:30 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    user_agent = "Chrome/" CHROME_VERSION_STRING " " ATOM_PRODUCT_NAME
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                 "/" ATOM_VERSION_STRING;
							 | 
						
					
						
							
								
									
										
										
										
											2015-07-14 12:12:55 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  } else {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    user_agent = base::StringPrintf(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        "%s/%s Chrome/%s " ATOM_PRODUCT_NAME "/" ATOM_VERSION_STRING,
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-17 21:55:30 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        name.c_str(), browser->GetVersion().c_str(), CHROME_VERSION_STRING);
							 | 
						
					
						
							
								
									
										
										
										
											2015-07-14 12:12:55 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							
								
									
										
										
										
											2016-06-22 15:46:46 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  user_agent_ = content::BuildUserAgentFromProduct(user_agent);
							 | 
						
					
						
							
								
									
										
										
										
											2016-07-12 22:05:07 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // Read options.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  use_cache_ = true;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  options.GetBoolean("cache", &use_cache_);
							 | 
						
					
						
							
								
									
										
										
										
											2016-07-26 16:34:04 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // Initialize Pref Registry in brightray.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  InitPrefs();
							 | 
						
					
						
							
								
									
										
										
										
											2016-06-22 15:46:46 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-17 21:55:30 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								AtomBrowserContext::~AtomBrowserContext() {}
							 | 
						
					
						
							
								
									
										
										
										
											2016-06-22 15:46:46 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2016-06-22 15:57:51 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void AtomBrowserContext::SetUserAgent(const std::string& user_agent) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  user_agent_ = user_agent;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2017-11-28 12:53:42 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								std::unique_ptr<base::CallbackList<void(const CookieDetails*)>::Subscription>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								AtomBrowserContext::RegisterCookieChangeCallback(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    const base::Callback<void(const CookieDetails*)>& cb) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return cookie_change_sub_list_.Add(cb);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-15 23:02:33 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								std::unique_ptr<net::NetworkDelegate>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								AtomBrowserContext::CreateNetworkDelegate() {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-12 08:48:32 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  return std::make_unique<AtomNetworkDelegate>();
							 | 
						
					
						
							
								
									
										
										
										
											2016-06-22 15:46:46 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								std::string AtomBrowserContext::GetUserAgent() {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return user_agent_;
							 | 
						
					
						
							
								
									
										
										
										
											2015-07-14 11:40:07 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2016-05-23 10:59:39 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								std::unique_ptr<net::URLRequestJobFactory>
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-07 22:44:35 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								AtomBrowserContext::CreateURLRequestJobFactory(
							 | 
						
					
						
							
								
									
										
										
										
											2016-06-15 20:31:29 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    content::ProtocolHandlerMap* protocol_handlers) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  std::unique_ptr<AtomURLRequestJobFactory> job_factory(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      new AtomURLRequestJobFactory);
							 | 
						
					
						
							
								
									
										
										
										
											2014-08-13 17:40:31 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2016-06-15 20:31:29 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  for (auto& it : *protocol_handlers) {
							 | 
						
					
						
							
								
									
										
										
										
											2015-08-12 13:30:19 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    job_factory->SetProtocolHandler(it.first,
							 | 
						
					
						
							
								
									
										
										
										
											2016-06-15 20:31:29 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                                    base::WrapUnique(it.second.release()));
							 | 
						
					
						
							
								
									
										
										
										
											2015-08-12 13:30:19 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							
								
									
										
										
										
											2016-06-15 20:31:29 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  protocol_handlers->clear();
							 | 
						
					
						
							
								
									
										
										
										
											2014-08-13 17:40:31 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2016-11-09 12:32:51 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  job_factory->SetProtocolHandler(url::kAboutScheme,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                  base::WrapUnique(new AboutProtocolHandler));
							 | 
						
					
						
							
								
									
										
										
										
											2014-08-13 17:40:31 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  job_factory->SetProtocolHandler(
							 | 
						
					
						
							
								
									
										
										
										
											2016-07-04 15:08:55 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      url::kDataScheme, base::WrapUnique(new net::DataProtocolHandler));
							 | 
						
					
						
							
								
									
										
										
										
											2014-08-13 17:40:31 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  job_factory->SetProtocolHandler(
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-24 19:31:39 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      url::kFileScheme,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      base::WrapUnique(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          new asar::AsarProtocolHandler(base::CreateTaskRunnerWithTraits(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								              {base::MayBlock(), base::TaskPriority::USER_VISIBLE,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								               base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}))));
							 | 
						
					
						
							
								
									
										
										
										
											2015-05-07 01:45:56 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  job_factory->SetProtocolHandler(
							 | 
						
					
						
							
								
									
										
										
										
											2015-08-12 13:30:19 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      url::kHttpScheme,
							 | 
						
					
						
							
								
									
										
										
										
											2016-07-04 15:08:55 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      base::WrapUnique(new HttpProtocolHandler(url::kHttpScheme)));
							 | 
						
					
						
							
								
									
										
										
										
											2015-05-11 12:56:36 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  job_factory->SetProtocolHandler(
							 | 
						
					
						
							
								
									
										
										
										
											2015-08-12 13:30:19 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      url::kHttpsScheme,
							 | 
						
					
						
							
								
									
										
										
										
											2016-07-04 15:08:55 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      base::WrapUnique(new HttpProtocolHandler(url::kHttpsScheme)));
							 | 
						
					
						
							
								
									
										
										
										
											2015-05-11 12:56:36 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  job_factory->SetProtocolHandler(
							 | 
						
					
						
							
								
									
										
										
										
											2015-08-12 13:30:19 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      url::kWsScheme,
							 | 
						
					
						
							
								
									
										
										
										
											2016-07-04 15:08:55 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      base::WrapUnique(new HttpProtocolHandler(url::kWsScheme)));
							 | 
						
					
						
							
								
									
										
										
										
											2015-05-11 12:56:36 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  job_factory->SetProtocolHandler(
							 | 
						
					
						
							
								
									
										
										
										
											2015-08-12 13:30:19 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      url::kWssScheme,
							 | 
						
					
						
							
								
									
										
										
										
											2016-07-04 15:08:55 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      base::WrapUnique(new HttpProtocolHandler(url::kWssScheme)));
							 | 
						
					
						
							
								
									
										
										
										
											2014-08-13 17:40:31 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-17 15:41:47 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  auto* host_resolver =
							 | 
						
					
						
							
								
									
										
										
										
											2015-08-12 13:30:19 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      url_request_context_getter()->GetURLRequestContext()->host_resolver();
							 | 
						
					
						
							
								
									
										
										
										
											2015-05-21 11:07:25 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  job_factory->SetProtocolHandler(
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-17 21:55:30 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      url::kFtpScheme, net::FtpProtocolHandler::Create(host_resolver));
							 | 
						
					
						
							
								
									
										
										
										
											2015-05-21 11:07:25 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2016-06-15 20:31:29 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  return std::move(job_factory);
							 | 
						
					
						
							
								
									
										
										
										
											2013-09-20 16:47:47 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-05 13:40:38 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								net::HttpCache::BackendFactory*
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								AtomBrowserContext::CreateHttpCacheBackendFactory(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    const base::FilePath& base_path) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
							 | 
						
					
						
							
								
									
										
										
										
											2016-07-12 22:05:07 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (!use_cache_ || command_line->HasSwitch(switches::kDisableHttpCache))
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-05 13:40:38 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    return new NoCacheBackend;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  else
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return brightray::BrowserContext::CreateHttpCacheBackendFactory(base_path);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-06-22 17:13:49 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								content::DownloadManagerDelegate*
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								AtomBrowserContext::GetDownloadManagerDelegate() {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (!download_manager_delegate_.get()) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-17 15:41:47 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    auto* download_manager = content::BrowserContext::GetDownloadManager(this);
							 | 
						
					
						
							
								
									
										
										
										
											2015-06-22 17:13:49 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    download_manager_delegate_.reset(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        new AtomDownloadManagerDelegate(download_manager));
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return download_manager_delegate_.get();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2014-10-22 22:55:13 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								content::BrowserPluginGuestManager* AtomBrowserContext::GetGuestManager() {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (!guest_manager_)
							 | 
						
					
						
							
								
									
										
										
										
											2015-09-05 11:43:30 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    guest_manager_.reset(new WebViewManager);
							 | 
						
					
						
							
								
									
										
										
										
											2014-10-22 22:55:13 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  return guest_manager_.get();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2016-01-30 16:49:18 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								content::PermissionManager* AtomBrowserContext::GetPermissionManager() {
							 | 
						
					
						
							
								
									
										
										
										
											2016-02-01 00:43:29 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (!permission_manager_.get())
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    permission_manager_.reset(new AtomPermissionManager);
							 | 
						
					
						
							
								
									
										
										
										
											2016-01-30 16:49:18 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  return permission_manager_.get();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2017-11-15 10:09:22 -03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								std::unique_ptr<net::CertVerifier> AtomBrowserContext::CreateCertVerifier(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    brightray::RequireCTDelegate* ct_delegate) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return base::WrapUnique(new AtomCertVerifier(ct_delegate));
							 | 
						
					
						
							
								
									
										
										
										
											2015-11-05 19:36:36 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2016-08-04 12:15:45 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								std::vector<std::string> AtomBrowserContext::GetCookieableSchemes() {
							 | 
						
					
						
							
								
									
										
										
										
											2016-08-05 16:35:37 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  auto default_schemes = brightray::BrowserContext::GetCookieableSchemes();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  const auto& standard_schemes = atom::api::GetStandardSchemes();
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-17 21:55:30 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  default_schemes.insert(default_schemes.end(), standard_schemes.begin(),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                         standard_schemes.end());
							 | 
						
					
						
							
								
									
										
										
										
											2016-08-05 16:35:37 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  return default_schemes;
							 | 
						
					
						
							
								
									
										
										
										
											2016-08-04 12:15:45 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2017-11-28 12:53:42 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void AtomBrowserContext::NotifyCookieChange(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    const net::CanonicalCookie& cookie,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    bool removed,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    net::CookieStore::ChangeCause cause) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  CookieDetails cookie_details(&cookie, removed, cause);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  cookie_change_sub_list_.Notify(&cookie_details);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-07-26 16:17:55 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void AtomBrowserContext::RegisterPrefs(PrefRegistrySimple* pref_registry) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  pref_registry->RegisterFilePathPref(prefs::kSelectFileLastDirectory,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                      base::FilePath());
							 | 
						
					
						
							
								
									
										
										
										
											2016-01-21 13:51:37 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  base::FilePath download_dir;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS, &download_dir);
							 | 
						
					
						
							
								
									
										
										
										
											2015-07-26 16:30:02 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  pref_registry->RegisterFilePathPref(prefs::kDownloadDefaultDirectory,
							 | 
						
					
						
							
								
									
										
										
										
											2016-01-21 13:51:37 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                                      download_dir);
							 | 
						
					
						
							
								
									
										
										
										
											2016-03-15 07:51:36 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  pref_registry->RegisterDictionaryPref(prefs::kDevToolsFileSystemPaths);
							 | 
						
					
						
							
								
									
										
										
										
											2015-07-26 16:17:55 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2016-08-31 05:38:32 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								AtomBlobReader* AtomBrowserContext::GetBlobReader() {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (!blob_reader_.get()) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    content::ChromeBlobStorageContext* blob_context =
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        content::ChromeBlobStorageContext::GetFor(this);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    storage::FileSystemContext* file_system_context =
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-17 21:55:30 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        content::BrowserContext::GetStoragePartition(this, nullptr)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            ->GetFileSystemContext();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    blob_reader_.reset(new AtomBlobReader(blob_context, file_system_context));
							 | 
						
					
						
							
								
									
										
										
										
											2016-08-31 05:38:32 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return blob_reader_.get();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-09-05 20:54:36 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								// static
							 | 
						
					
						
							
								
									
										
										
										
											2016-07-12 21:39:54 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								scoped_refptr<AtomBrowserContext> AtomBrowserContext::From(
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-17 21:55:30 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    const std::string& partition,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    bool in_memory,
							 | 
						
					
						
							
								
									
										
										
										
											2016-07-12 21:53:19 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    const base::DictionaryValue& options) {
							 | 
						
					
						
							
								
									
										
										
										
											2016-07-12 21:39:54 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  auto browser_context = brightray::BrowserContext::Get(partition, in_memory);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (browser_context)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return static_cast<AtomBrowserContext*>(browser_context.get());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2016-07-12 22:05:07 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  return new AtomBrowserContext(partition, in_memory, options);
							 | 
						
					
						
							
								
									
										
										
										
											2015-09-05 20:54:36 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2016-07-12 21:39:54 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}  // namespace atom
							 |