diff options
98 files changed, 467 insertions, 416 deletions
diff --git a/chrome/browser/autocomplete/autocomplete.cc b/chrome/browser/autocomplete/autocomplete.cc index ecc3bbd..4153032 100644 --- a/chrome/browser/autocomplete/autocomplete.cc +++ b/chrome/browser/autocomplete/autocomplete.cc @@ -150,7 +150,7 @@ AutocompleteInput::Type AutocompleteInput::Parse(const std::wstring& text, // the host's validity at this point.) const std::wstring host(text.substr(parts->host.begin, parts->host.len)); const size_t registry_length = - RegistryControlledDomainService::GetRegistryLength(host, false); + net::RegistryControlledDomainService::GetRegistryLength(host, false); if (registry_length == std::wstring::npos) return QUERY; // It's not clear to me that we can reach this... @@ -169,7 +169,7 @@ AutocompleteInput::Type AutocompleteInput::Parse(const std::wstring& text, // See if the host is an IP address. bool is_ip_address; - net_util::CanonicalizeHost(host, &is_ip_address); + net::CanonicalizeHost(host, &is_ip_address); if (is_ip_address) { // If the user originally typed a host that looks like an IP address (a // dotted quad), they probably want to open it. If the original input was diff --git a/chrome/browser/automation/url_request_mock_http_job.cc b/chrome/browser/automation/url_request_mock_http_job.cc index 5df0ed7..0c3cbc7 100644 --- a/chrome/browser/automation/url_request_mock_http_job.cc +++ b/chrome/browser/automation/url_request_mock_http_job.cc @@ -59,7 +59,7 @@ URLRequestJob* URLRequestMockHTTPJob::Factory(URLRequest* request, // Convert the file:/// URL to a path on disk. std::wstring file_path; - net_util::FileURLToFilePath(GURL(file_url), &file_path); + net::FileURLToFilePath(GURL(file_url), &file_path); URLRequestMockHTTPJob* job = new URLRequestMockHTTPJob(request); job->file_path_ = file_path; return job; diff --git a/chrome/browser/automation/url_request_mock_net_error_job.cc b/chrome/browser/automation/url_request_mock_net_error_job.cc index 06adfb7..18ede31 100644 --- a/chrome/browser/automation/url_request_mock_net_error_job.cc +++ b/chrome/browser/automation/url_request_mock_net_error_job.cc @@ -43,7 +43,7 @@ URLRequestMockNetErrorJob::URLMockInfoMap void URLRequestMockNetErrorJob::AddMockedURL(const GURL& url, const std::wstring& base, const std::vector<int>& errors, - X509Certificate* ssl_cert) { + net::X509Certificate* ssl_cert) { #ifndef NDEBUG URLMockInfoMap::const_iterator iter = url_mock_info_map_.find(url); DCHECK(iter == url_mock_info_map_.end()); @@ -83,13 +83,13 @@ URLRequestJob* URLRequestMockNetErrorJob::Factory(URLRequest* request, file_url.append(UTF8ToWide(url.path())); // Convert the file:/// URL to a path on disk. std::wstring file_path; - net_util::FileURLToFilePath(GURL(file_url), &file_path); + net::FileURLToFilePath(GURL(file_url), &file_path); job->file_path_ = file_path; return job; } URLRequestMockNetErrorJob::URLRequestMockNetErrorJob(URLRequest* request, - const std::vector<int>& errors, X509Certificate* cert) + const std::vector<int>& errors, net::X509Certificate* cert) : URLRequestMockHTTPJob(request), errors_(errors), ssl_cert_(cert) { diff --git a/chrome/browser/automation/url_request_mock_net_error_job.h b/chrome/browser/automation/url_request_mock_net_error_job.h index bee1c31..d7abad0 100644 --- a/chrome/browser/automation/url_request_mock_net_error_job.h +++ b/chrome/browser/automation/url_request_mock_net_error_job.h @@ -41,7 +41,7 @@ class URLRequestMockNetErrorJob : public URLRequestMockHTTPJob { public: URLRequestMockNetErrorJob(URLRequest* request, const std::vector<int>& errors, - X509Certificate* ssl_cert); + net::X509Certificate* ssl_cert); virtual ~URLRequestMockNetErrorJob(); virtual void Start(); @@ -56,7 +56,7 @@ class URLRequestMockNetErrorJob : public URLRequestMockHTTPJob { static void AddMockedURL(const GURL& url, const std::wstring& base, const std::vector<int>& errors, - X509Certificate* ssl_cert); + net::X509Certificate* ssl_cert); // Removes the specified |url| from the list of mocked urls. static void RemoveMockedURL(const GURL& url); @@ -66,14 +66,14 @@ class URLRequestMockNetErrorJob : public URLRequestMockHTTPJob { MockInfo() : ssl_cert(NULL) { } MockInfo(std::wstring base, std::vector<int> errors, - X509Certificate* ssl_cert) + net::X509Certificate* ssl_cert) : base(base), errors(errors), ssl_cert(ssl_cert) { } std::wstring base; std::vector<int> errors; - scoped_refptr<X509Certificate> ssl_cert; + scoped_refptr<net::X509Certificate> ssl_cert; }; static URLRequest::ProtocolFactory Factory; @@ -84,7 +84,7 @@ class URLRequestMockNetErrorJob : public URLRequestMockHTTPJob { std::vector<int> errors_; // The certificate to use for SSL errors. - scoped_refptr<X509Certificate> ssl_cert_; + scoped_refptr<net::X509Certificate> ssl_cert_; typedef std::map<GURL, MockInfo> URLMockInfoMap; static URLMockInfoMap url_mock_info_map_; diff --git a/chrome/browser/back_forward_menu_model.cc b/chrome/browser/back_forward_menu_model.cc index 88b5345..6e59162 100644 --- a/chrome/browser/back_forward_menu_model.cc +++ b/chrome/browser/back_forward_menu_model.cc @@ -304,7 +304,7 @@ int BackForwardMenuModel::GetIndexOfNextChapterStop(int start_from, // When going backwards we return the first entry we find that has a // different domain. for (int i = start_from - 1; i >= 0; --i) { - if (!RegistryControlledDomainService::SameDomainOrHost(url, + if (!net::RegistryControlledDomainService::SameDomainOrHost(url, controller->GetEntryAtIndex(i)->GetURL())) return i; } @@ -314,7 +314,7 @@ int BackForwardMenuModel::GetIndexOfNextChapterStop(int start_from, // When going forwards we return the entry before the entry that has a // different domain. for (int i = start_from + 1; i < max_count; ++i) { - if (!RegistryControlledDomainService::SameDomainOrHost(url, + if (!net::RegistryControlledDomainService::SameDomainOrHost(url, controller->GetEntryAtIndex(i)->GetURL())) return i - 1; } diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index bc5ad30..fa76bd9 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -196,7 +196,7 @@ void Browser::RegisterUserPrefs(PrefService* prefs) { prefs->RegisterStringPref(prefs::kHomePage, L"chrome-internal:"); prefs->RegisterBooleanPref(prefs::kHomePageIsNewTabPage, true); prefs->RegisterIntegerPref(prefs::kCookieBehavior, - CookiePolicy::ALLOW_ALL_COOKIES); + net::CookiePolicy::ALLOW_ALL_COOKIES); prefs->RegisterBooleanPref(prefs::kShowHomeButton, false); prefs->RegisterStringPref(prefs::kRecentlySelectedEncoding, L""); } diff --git a/chrome/browser/browser_commands.cc b/chrome/browser/browser_commands.cc index fc54ae8..cdfc7a2 100644 --- a/chrome/browser/browser_commands.cc +++ b/chrome/browser/browser_commands.cc @@ -1115,7 +1115,7 @@ void Browser::DuplicateContentsAt(int index) { // Browser, SelectFileDialog::Listener implementation: void Browser::FileSelected(const std::wstring& path, void* params) { - GURL file_url = net_util::FilePathToFileURL(path); + GURL file_url = net::FilePathToFileURL(path); if (!file_url.is_empty()) OpenURL(file_url, CURRENT_TAB, PageTransition::TYPED); } diff --git a/chrome/browser/browser_init.cc b/chrome/browser/browser_init.cc index f718100..30e8cb5 100644 --- a/chrome/browser/browser_init.cc +++ b/chrome/browser/browser_init.cc @@ -427,7 +427,7 @@ bool BrowserInit::LaunchWithProfile::Launch(Profile* profile, } if (parsed_command_line.HasSwitch(switches::kEnableFileCookies)) - CookieMonster::EnableFileScheme(); + net::CookieMonster::EnableFileScheme(); #ifndef NDEBUG if (parsed_command_line.HasSwitch(switches::kApp)) { diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc index 317ebed..057e254 100644 --- a/chrome/browser/browser_main.cc +++ b/chrome/browser/browser_main.cc @@ -423,7 +423,7 @@ int BrowserMain(CommandLine &parsed_command_line, int show_command, PrepareRestartOnCrashEnviroment(parsed_command_line); // Initialize Winsock. - WinsockInit init; + net::WinsockInit init; // Initialize the DNS prefetch system chrome_browser_net::DnsPrefetcherInit dns_prefetch_init(user_prefs); @@ -443,7 +443,7 @@ int BrowserMain(CommandLine &parsed_command_line, int show_command, RLZTracker::InitRlzDelayed(base::DIR_MODULE, is_first_run); // Config the network module so it has access to resources. - NetModule::SetResourceProvider(NetResourceProvider); + net::NetModule::SetResourceProvider(NetResourceProvider); // Register our global network handler for chrome-resource:// URLs. RegisterURLRequestChromeJob(); diff --git a/chrome/browser/browser_uitest.cc b/chrome/browser/browser_uitest.cc index 8213f8f..0739179 100644 --- a/chrome/browser/browser_uitest.cc +++ b/chrome/browser/browser_uitest.cc @@ -89,7 +89,7 @@ TEST_F(BrowserTest, NoTitle) { std::wstring test_file = test_data_directory_; file_util::AppendToPath(&test_file, L"title1.html"); - NavigateToURL(net_util::FilePathToFileURL(test_file)); + NavigateToURL(net::FilePathToFileURL(test_file)); Sleep(kWaitForActionMsec); // The browser lazily updates the title. EXPECT_EQ(WindowCaptionFromPageTitle(L"title1.html"), GetWindowTitle()); @@ -102,7 +102,7 @@ TEST_F(BrowserTest, Title) { std::wstring test_file = test_data_directory_; file_util::AppendToPath(&test_file, L"title2.html"); - NavigateToURL(net_util::FilePathToFileURL(test_file)); + NavigateToURL(net::FilePathToFileURL(test_file)); Sleep(kWaitForActionMsec); // The browser lazily updates the title. const std::wstring test_title(L"Title Of Awesomeness"); @@ -115,7 +115,7 @@ TEST_F(BrowserTest, WindowsSessionEnd) { std::wstring test_file = test_data_directory_; file_util::AppendToPath(&test_file, L"title1.html"); - NavigateToURL(net_util::FilePathToFileURL(test_file)); + NavigateToURL(net::FilePathToFileURL(test_file)); Sleep(kWaitForActionMsec); // Simulate an end of session. Normally this happens when the user @@ -209,8 +209,8 @@ TEST_F(BrowserTest, DuplicateTab) { std::wstring path_prefix = test_data_directory_; file_util::AppendToPath(&path_prefix, L"session_history"); path_prefix += file_util::kPathSeparator; - GURL url1 = net_util::FilePathToFileURL(path_prefix + L"bot1.html"); - GURL url2 = net_util::FilePathToFileURL(path_prefix + L"bot2.html"); + GURL url1 = net::FilePathToFileURL(path_prefix + L"bot1.html"); + GURL url2 = net::FilePathToFileURL(path_prefix + L"bot2.html"); GURL url3 = GURL("about:blank"); scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); @@ -273,7 +273,7 @@ TEST_F(BrowserTest, NullOpenerRedirectForksProcess) { // Start with a file:// url file_util::AppendToPath(&test_file, L"title2.html"); - tab->NavigateToURL(net_util::FilePathToFileURL(test_file)); + tab->NavigateToURL(net::FilePathToFileURL(test_file)); int orig_tab_count = -1; ASSERT_TRUE(window->GetTabCount(&orig_tab_count)); int orig_process_count = GetBrowserProcessCount(); @@ -311,7 +311,7 @@ TEST_F(BrowserTest, OtherRedirectsDontForkProcess) { // Start with a file:// url file_util::AppendToPath(&test_file, L"title2.html"); - tab->NavigateToURL(net_util::FilePathToFileURL(test_file)); + tab->NavigateToURL(net::FilePathToFileURL(test_file)); int orig_tab_count = -1; ASSERT_TRUE(window->GetTabCount(&orig_tab_count)); int orig_process_count = GetBrowserProcessCount(); @@ -345,7 +345,7 @@ TEST_F(VisibleBrowserTest, WindowOpenClose) { std::wstring test_file(test_data_directory_); file_util::AppendToPath(&test_file, L"window.close.html"); - NavigateToURL(net_util::FilePathToFileURL(test_file)); + NavigateToURL(net::FilePathToFileURL(test_file)); int i; for (i = 0; i < 10; ++i) { diff --git a/chrome/browser/browsing_data_remover.cc b/chrome/browser/browsing_data_remover.cc index e45a374..15ccfb2 100644 --- a/chrome/browser/browsing_data_remover.cc +++ b/chrome/browser/browsing_data_remover.cc @@ -117,7 +117,7 @@ void BrowsingDataRemover::Remove(int remove_mask) { if (remove_mask & REMOVE_COOKIES) { UserMetrics::RecordAction(L"ClearBrowsingData_Cookies", profile_); - CookieMonster* cookie_monster = + net::CookieMonster* cookie_monster = profile_->GetRequestContext()->cookie_store(); cookie_monster->DeleteAllCreatedBetween(delete_begin_, delete_end_, true); } diff --git a/chrome/browser/cert_store.cc b/chrome/browser/cert_store.cc index 04e7c57..0afe65a 100644 --- a/chrome/browser/cert_store.cc +++ b/chrome/browser/cert_store.cc @@ -80,7 +80,7 @@ CertStore::~CertStore() { NOTIFY_RENDERER_PROCESS_TERMINATED, NotificationService::AllSources()); } -int CertStore::StoreCert(X509Certificate* cert, int process_id) { +int CertStore::StoreCert(net::X509Certificate* cert, int process_id) { DCHECK(cert); AutoLock autoLock(cert_lock_); @@ -117,7 +117,7 @@ int CertStore::StoreCert(X509Certificate* cert, int process_id) { } bool CertStore::RetrieveCert(int cert_id, - scoped_refptr<X509Certificate>* cert) { + scoped_refptr<net::X509Certificate>* cert) { AutoLock autoLock(cert_lock_); CertMap::iterator iter = id_to_cert_.find(cert_id); diff --git a/chrome/browser/cert_store.h b/chrome/browser/cert_store.h index 453f0b9..24b5f91 100644 --- a/chrome/browser/cert_store.h +++ b/chrome/browser/cert_store.h @@ -61,12 +61,12 @@ class CertStore : public NotificationObserver { // When all the RenderProcessHosts associated with a cert have exited, the // cert is removed from the store. // Note: ids starts at 1. - int StoreCert(X509Certificate* cert, int render_process_host_id); + int StoreCert(net::X509Certificate* cert, int render_process_host_id); // Retrieves the previously stored cert associated with the specified // |cert_id| and set it in |cert|. Returns false if no cert was found for // that id. - bool RetrieveCert(int cert_id, scoped_refptr<X509Certificate>* cert); + bool RetrieveCert(int cert_id, scoped_refptr<net::X509Certificate>* cert); // NotificationObserver implementation. virtual void Observe(NotificationType type, @@ -86,8 +86,8 @@ class CertStore : public NotificationObserver { static CertStore* instance_; typedef std::multimap<int, int> IDMap; - typedef std::map<int, scoped_refptr<X509Certificate>> CertMap; - typedef std::map<X509Certificate*, int, X509Certificate::LessThan> + typedef std::map<int, scoped_refptr<net::X509Certificate>> CertMap; + typedef std::map<net::X509Certificate*, int, net::X509Certificate::LessThan> ReverseCertMap; IDMap process_id_to_cert_id_; diff --git a/chrome/browser/crash_recovery_uitest.cc b/chrome/browser/crash_recovery_uitest.cc index db032a0..9468d38 100644 --- a/chrome/browser/crash_recovery_uitest.cc +++ b/chrome/browser/crash_recovery_uitest.cc @@ -77,7 +77,7 @@ TEST_F(CrashRecoveryUITest, LoadInNewTab) { // The title of the active tab should change each time this URL is loaded. std::wstring test_file = test_data_directory_; file_util::AppendToPath(&test_file, L"title2.html"); - GURL url(net_util::FilePathToFileURL(test_file)); + GURL url(net::FilePathToFileURL(test_file)); NavigateToURL(url); diff --git a/chrome/browser/download_manager.cc b/chrome/browser/download_manager.cc index 17851ac..a919ee33 100644 --- a/chrome/browser/download_manager.cc +++ b/chrome/browser/download_manager.cc @@ -908,9 +908,9 @@ void DownloadManager::GenerateExtension(const std::wstring& file_name, void DownloadManager::GenerateFilename(DownloadCreateInfo* info, std::wstring* generated_name) { std::wstring file_name = - net_util::GetSuggestedFilename(GURL(info->url), - info->content_disposition, - L"download"); + net::GetSuggestedFilename(GURL(info->url), + info->content_disposition, + L"download"); DCHECK(!file_name.empty()); // Make sure we get the right file extension. diff --git a/chrome/browser/google_util.cc b/chrome/browser/google_util.cc index d3d74f7..9a0beb7 100644 --- a/chrome/browser/google_util.cc +++ b/chrome/browser/google_util.cc @@ -63,8 +63,8 @@ GURL AppendGoogleLocaleParam(const GURL& url) { GURL AppendGoogleTLDParam(const GURL& url) { const std::string google_domain( - RegistryControlledDomainService::GetDomainAndRegistry( - GoogleURLTracker::GoogleURL())); + net::RegistryControlledDomainService::GetDomainAndRegistry( + GoogleURLTracker::GoogleURL())); const size_t first_dot = google_domain.find('.'); if (first_dot == std::string::npos) { NOTREACHED(); diff --git a/chrome/browser/history/redirect_uitest.cc b/chrome/browser/history/redirect_uitest.cc index 75fed14..0ee58f7 100644 --- a/chrome/browser/history/redirect_uitest.cc +++ b/chrome/browser/history/redirect_uitest.cc @@ -102,7 +102,7 @@ TEST_F(RedirectTest, ClientEmptyReferer) { GURL final_url = server.TestServerPageW(std::wstring()); std::wstring test_file = test_data_directory_; file_util::AppendToPath(&test_file, L"file_client_redirect.html"); - GURL first_url = net_util::FilePathToFileURL(test_file); + GURL first_url = net::FilePathToFileURL(test_file); NavigateToURL(first_url); std::vector<GURL> redirects; @@ -128,7 +128,7 @@ TEST_F(RedirectTest, ClientEmptyReferer) { TEST_F(RedirectTest, ClientCancelled) { std::wstring first_path = test_data_directory_; file_util::AppendToPath(&first_path, L"cancelled_redirect_test.html"); - GURL first_url = net_util::FilePathToFileURL(first_path); + GURL first_url = net::FilePathToFileURL(first_path); NavigateToURL(first_url); Sleep(kWaitForActionMsec); @@ -151,7 +151,7 @@ TEST_F(RedirectTest, ClientCancelled) { // %23, but in current_url the anchor will be '#'. std::string final_ref = "myanchor"; std::wstring current_path; - ASSERT_TRUE(net_util::FileURLToFilePath(current_url, ¤t_path)); + ASSERT_TRUE(net::FileURLToFilePath(current_url, ¤t_path)); // Path should remain unchanged. EXPECT_EQ(StringToLowerASCII(first_path), StringToLowerASCII(current_path)); EXPECT_EQ(final_ref, current_url.ref()); @@ -215,7 +215,7 @@ TEST_F(RedirectTest, NoHttpToFile) { TestServer server(kDocRoot); std::wstring test_file = test_data_directory_; file_util::AppendToPath(&test_file, L"http_to_file.html"); - GURL file_url = net_util::FilePathToFileURL(test_file); + GURL file_url = net::FilePathToFileURL(test_file); GURL initial_url = server.TestServerPageW( std::wstring(L"client-redirect?") + UTF8ToWide(file_url.spec())); @@ -236,7 +236,7 @@ TEST_F(RedirectTest, ClientFragments) { TestServer server(kDocRoot); std::wstring test_file = test_data_directory_; file_util::AppendToPath(&test_file, L"ref_redirect.html"); - GURL first_url = net_util::FilePathToFileURL(test_file); + GURL first_url = net::FilePathToFileURL(test_file); std::vector<GURL> redirects; NavigateToURL(first_url); diff --git a/chrome/browser/iframe_uitest.cc b/chrome/browser/iframe_uitest.cc index 9b3b178..7225943 100644 --- a/chrome/browser/iframe_uitest.cc +++ b/chrome/browser/iframe_uitest.cc @@ -38,7 +38,7 @@ class IFrameTest : public UITest { std::wstring test_file = test_data_directory_; file_util::AppendToPath(&test_file, url); - NavigateToURL(net_util::FilePathToFileURL(test_file)); + NavigateToURL(net::FilePathToFileURL(test_file)); Sleep(kWaitForActionMsec); // The browser lazily updates the title. // Make sure the navigation succeeded. diff --git a/chrome/browser/metrics_service_uitest.cc b/chrome/browser/metrics_service_uitest.cc index d78aa11..4d75529 100644 --- a/chrome/browser/metrics_service_uitest.cc +++ b/chrome/browser/metrics_service_uitest.cc @@ -60,12 +60,12 @@ class MetricsServiceTest : public UITest { std::wstring page1_path; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &page1_path)); file_util::AppendToPath(&page1_path, L"title2.html"); - ASSERT_TRUE(window_->AppendTab(net_util::FilePathToFileURL(page1_path))); + ASSERT_TRUE(window_->AppendTab(net::FilePathToFileURL(page1_path))); std::wstring page2_path; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &page2_path)); file_util::AppendToPath(&page2_path, L"iframe.html"); - ASSERT_TRUE(window_->AppendTab(net_util::FilePathToFileURL(page2_path))); + ASSERT_TRUE(window_->AppendTab(net::FilePathToFileURL(page2_path))); } // Get a PrefService whose contents correspond to the Local State file diff --git a/chrome/browser/net/dns_master_unittest.cc b/chrome/browser/net/dns_master_unittest.cc index 804af04..61bef9a 100644 --- a/chrome/browser/net/dns_master_unittest.cc +++ b/chrome/browser/net/dns_master_unittest.cc @@ -165,7 +165,7 @@ TimeDelta BlockingDnsLookup(const std::string& hostname) { // of DNS prefetching. TEST(DnsMasterTest, OsCachesLookupsTest) { SetupNetworkInfrastructure(); - WinsockInit ws_init; + net::WinsockInit ws_init; for (int i = 0; i < 5; i++) { std::string badname; @@ -185,7 +185,7 @@ TEST(DnsMasterTest, StartupShutdownTest) { TEST(DnsMasterTest, BenefitLookupTest) { SetupNetworkInfrastructure(); - WinsockInit ws_init; + net::WinsockInit ws_init; DnsPrefetcherInit dns_init(NULL); // Creates global service . DnsMaster testing_master(TimeDelta::FromMilliseconds(5000)); @@ -262,7 +262,7 @@ TEST(DnsMasterTest, BenefitLookupTest) { TEST(DnsMasterTest, DISABLED_SingleSlaveLookupTest) { SetupNetworkInfrastructure(); - WinsockInit ws_init; + net::WinsockInit ws_init; DnsPrefetcherInit dns_init(NULL); // Creates global service. DnsMaster testing_master(TimeDelta::FromMilliseconds(5000)); @@ -314,7 +314,7 @@ TEST(DnsMasterTest, DISABLED_SingleSlaveLookupTest) { TEST(DnsMasterTest, DISABLED_MultiThreadedLookupTest) { SetupNetworkInfrastructure(); - WinsockInit ws_init; + net::WinsockInit ws_init; DnsMaster testing_master(TimeDelta::FromSeconds(30)); DnsPrefetcherInit dns_init(NULL); @@ -361,7 +361,7 @@ TEST(DnsMasterTest, DISABLED_MultiThreadedLookupTest) { TEST(DnsMasterTest, DISABLED_MultiThreadedSpeedupTest) { SetupNetworkInfrastructure(); - WinsockInit ws_init; + net::WinsockInit ws_init; DnsMaster testing_master(TimeDelta::FromSeconds(30)); DnsPrefetcherInit dns_init(NULL); diff --git a/chrome/browser/page_info_window.cc b/chrome/browser/page_info_window.cc index dc6d8fa..7082e28 100644 --- a/chrome/browser/page_info_window.cc +++ b/chrome/browser/page_info_window.cc @@ -118,7 +118,8 @@ class SecurityTabView : public ChromeViews::View { // Returns a name that can be used to represent the issuer. It tries in this // order CN, O and OU and returns the first non-empty one found. - static std::string GetIssuerName(const X509Certificate::Principal& issuer); + static std::string GetIssuerName( + const net::X509Certificate::Principal& issuer); // Callback from history service with number of visits to url. void OnGotVisitCountToHost(HistoryService::Handle handle, @@ -253,7 +254,7 @@ SecurityTabView::SecurityTabView(Profile* profile, std::wstring identity_title; std::wstring identity_msg; std::wstring connection_msg; - scoped_refptr<X509Certificate> cert; + scoped_refptr<net::X509Certificate> cert; int cert_id = navigation_entry->GetSSLCertID(); int cert_status = navigation_entry->GetSSLCertStatus(); @@ -408,7 +409,7 @@ void SecurityTabView::Layout() { // static std::string SecurityTabView::GetIssuerName( - const X509Certificate::Principal& issuer) { + const net::X509Certificate::Principal& issuer) { if (!issuer.common_name.empty()) return issuer.common_name; if (!issuer.organization_names.empty()) @@ -667,7 +668,7 @@ void PageInfoWindow::CalculateWindowBounds(CRect* bounds) { } void PageInfoWindow::ShowCertDialog(int cert_id) { - scoped_refptr<X509Certificate> cert; + scoped_refptr<net::X509Certificate> cert; CertStore::GetSharedInstance()->RetrieveCert(cert_id, &cert); if (!cert.get()) { // The certificate was not found. Could be that the renderer crashed before diff --git a/chrome/browser/plugin_process_host.cc b/chrome/browser/plugin_process_host.cc index 2240c6f..7ee3015 100644 --- a/chrome/browser/plugin_process_host.cc +++ b/chrome/browser/plugin_process_host.cc @@ -133,7 +133,7 @@ class PluginDownloadUrlHelper : public URLRequest::Delegate { net::AuthChallengeInfo* auth_info); virtual void OnSSLCertificateError(URLRequest* request, int cert_error, - X509Certificate* cert); + net::X509Certificate* cert); virtual void OnResponseStarted(URLRequest* request); virtual void OnReadCompleted(URLRequest* request, int bytes_read); @@ -204,7 +204,7 @@ void PluginDownloadUrlHelper::OnAuthRequired( void PluginDownloadUrlHelper::OnSSLCertificateError(URLRequest* request, int cert_error, - X509Certificate* cert) { + net::X509Certificate* cert) { URLRequest::Delegate::OnSSLCertificateError(request, cert_error, cert); DownloadCompletedHelper(false); } diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc index 3d146e4..626389b 100644 --- a/chrome/browser/profile.cc +++ b/chrome/browser/profile.cc @@ -146,7 +146,7 @@ class ProfileImpl::RequestContext : public URLRequestContext, if (record_mode || playback_mode) { // Don't use existing cookies and use an in-memory store. - cookie_store_ = new CookieMonster(); + cookie_store_ = new net::CookieMonster(); cache->set_mode( record_mode ? net::HttpCache::RECORD : net::HttpCache::PLAYBACK); } @@ -157,11 +157,11 @@ class ProfileImpl::RequestContext : public URLRequestContext, DCHECK(!cookie_store_path.empty()); cookie_db_.reset(new SQLitePersistentCookieStore( cookie_store_path, g_browser_process->db_thread()->message_loop())); - cookie_store_ = new CookieMonster(cookie_db_.get()); + cookie_store_ = new net::CookieMonster(cookie_db_.get()); } - cookie_policy_.SetType( - CookiePolicy::FromInt(prefs_->GetInteger(prefs::kCookieBehavior))); + cookie_policy_.SetType(net::CookiePolicy::FromInt( + prefs_->GetInteger(prefs::kCookieBehavior))); // The first request context to be created is the one for the default // profile - at least until we support multiple profiles. @@ -189,8 +189,8 @@ class ProfileImpl::RequestContext : public URLRequestContext, &RequestContext::OnAcceptLanguageChange, accept_language)); } else if (*pref_name_in == prefs::kCookieBehavior) { - CookiePolicy::Type type = - CookiePolicy::FromInt(prefs_->GetInteger(prefs::kCookieBehavior)); + net::CookiePolicy::Type type = net::CookiePolicy::FromInt( + prefs_->GetInteger(prefs::kCookieBehavior)); g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(this, &RequestContext::OnCookiePolicyChange, @@ -216,7 +216,7 @@ class ProfileImpl::RequestContext : public URLRequestContext, accept_language_ = accept_language; } - void OnCookiePolicyChange(CookiePolicy::Type type) { + void OnCookiePolicyChange(net::CookiePolicy::Type type) { DCHECK(MessageLoop::current() == ChromeThread::GetMessageLoop(ChromeThread::IO)); cookie_policy_.SetType(type); @@ -265,9 +265,9 @@ class OffTheRecordRequestContext : public URLRequestContext, scoped_ptr<net::HttpProxyInfo> proxy_info(CreateProxyInfo(command_line)); http_transaction_factory_ = new net::HttpCache(NULL, 0); - cookie_store_ = new CookieMonster; - cookie_policy_.SetType( - CookiePolicy::FromInt(prefs_->GetInteger(prefs::kCookieBehavior))); + cookie_store_ = new net::CookieMonster; + cookie_policy_.SetType(net::CookiePolicy::FromInt( + prefs_->GetInteger(prefs::kCookieBehavior))); user_agent_ = original_context_->user_agent(); accept_language_ = original_context_->accept_language(); accept_charset_ = original_context_->accept_charset(); @@ -307,8 +307,8 @@ class OffTheRecordRequestContext : public URLRequestContext, &OffTheRecordRequestContext::OnAcceptLanguageChange, accept_language)); } else if (*pref_name_in == prefs::kCookieBehavior) { - CookiePolicy::Type type = - CookiePolicy::FromInt(prefs_->GetInteger(prefs::kCookieBehavior)); + net::CookiePolicy::Type type = net::CookiePolicy::FromInt( + prefs_->GetInteger(prefs::kCookieBehavior)); g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(this, &OffTheRecordRequestContext::OnCookiePolicyChange, @@ -323,7 +323,7 @@ class OffTheRecordRequestContext : public URLRequestContext, accept_language_ = accept_language; } - void OnCookiePolicyChange(CookiePolicy::Type type) { + void OnCookiePolicyChange(net::CookiePolicy::Type type) { DCHECK(MessageLoop::current() == ChromeThread::GetMessageLoop(ChromeThread::IO)); cookie_policy_.SetType(type); diff --git a/chrome/browser/render_view_host.cc b/chrome/browser/render_view_host.cc index 7fe7e4e..c18356a 100644 --- a/chrome/browser/render_view_host.cc +++ b/chrome/browser/render_view_host.cc @@ -389,7 +389,7 @@ void RenderViewHost::DragTargetDragEnter(const WebDropData& drop_data, for (std::vector<std::wstring>::const_iterator iter(drop_data.filenames.begin()); iter != drop_data.filenames.end(); ++iter) { policy->GrantRequestURL(process()->host_id(), - net_util::FilePathToFileURL(*iter)); + net::FilePathToFileURL(*iter)); policy->GrantUploadFile(process()->host_id(), *iter); } Send(new ViewMsg_DragTargetDragEnter(routing_id_, drop_data, client_pt, diff --git a/chrome/browser/resource_dispatcher_host.cc b/chrome/browser/resource_dispatcher_host.cc index 87f504f..c81f9cb 100644 --- a/chrome/browser/resource_dispatcher_host.cc +++ b/chrome/browser/resource_dispatcher_host.cc @@ -1822,7 +1822,7 @@ void ResourceDispatcherHost::OnAuthRequired( void ResourceDispatcherHost::OnSSLCertificateError( URLRequest* request, int cert_error, - X509Certificate* cert) { + net::X509Certificate* cert) { DCHECK(request); SSLManager::OnSSLCertificateError(this, request, cert_error, cert, ui_loop_); } diff --git a/chrome/browser/resource_dispatcher_host.h b/chrome/browser/resource_dispatcher_host.h index 9614e08..a9099a9 100644 --- a/chrome/browser/resource_dispatcher_host.h +++ b/chrome/browser/resource_dispatcher_host.h @@ -350,7 +350,7 @@ class ResourceDispatcherHost : public URLRequest::Delegate { net::AuthChallengeInfo* auth_info); virtual void OnSSLCertificateError(URLRequest* request, int cert_error, - X509Certificate* cert); + net::X509Certificate* cert); virtual void OnResponseStarted(URLRequest* request); virtual void OnReadCompleted(URLRequest* request, int bytes_read); void OnResponseCompleted(URLRequest* request); diff --git a/chrome/browser/resource_dispatcher_host_uitest.cc b/chrome/browser/resource_dispatcher_host_uitest.cc index 0096f55..f39fd04 100644 --- a/chrome/browser/resource_dispatcher_host_uitest.cc +++ b/chrome/browser/resource_dispatcher_host_uitest.cc @@ -229,7 +229,7 @@ TEST_F(ResourceDispatcherTest, CrossSiteNavigationNonBuffered) { std::wstring test_file = test_data_directory_; file_util::AppendToPath(&test_file, L"title2.html"); bool timed_out = false; - tab->NavigateToURLWithTimeout(net_util::FilePathToFileURL(test_file), + tab->NavigateToURLWithTimeout(net::FilePathToFileURL(test_file), kWaitForActionMaxMsec, &timed_out); EXPECT_FALSE(timed_out); diff --git a/chrome/browser/safe_browsing/safe_browsing_service.cc b/chrome/browser/safe_browsing/safe_browsing_service.cc index f7e47f7..8e69d3d 100644 --- a/chrome/browser/safe_browsing/safe_browsing_service.cc +++ b/chrome/browser/safe_browsing/safe_browsing_service.cc @@ -207,7 +207,7 @@ void SafeBrowsingService::DisplayBlockingPage(const GURL& url, entry.render_view_id == render_view_id && entry.result == result && entry.domain == - RegistryControlledDomainService::GetDomainAndRegistry(url)) { + net::RegistryControlledDomainService::GetDomainAndRegistry(url)) { MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( this, &SafeBrowsingService::NotifyClientBlockingComplete, client, true)); @@ -405,8 +405,8 @@ void SafeBrowsingService::OnBlockingPageDone(SafeBrowsingBlockingPage* page, WhiteListedEntry entry; entry.render_process_host_id = page->render_process_host_id(); entry.render_view_id = page->render_view_id(); - entry.domain = - RegistryControlledDomainService::GetDomainAndRegistry(page->url()); + entry.domain = net::RegistryControlledDomainService::GetDomainAndRegistry( + page->url()); entry.result = page->result(); white_listed_entries_.push_back(entry); } diff --git a/chrome/browser/save_file_manager.cc b/chrome/browser/save_file_manager.cc index 886dd07..518f839 100644 --- a/chrome/browser/save_file_manager.cc +++ b/chrome/browser/save_file_manager.cc @@ -519,7 +519,7 @@ void SaveFileManager::SaveLocalFile(const std::wstring& original_file_url, GURL file_url(original_file_url); DCHECK(file_url.SchemeIsFile()); std::wstring file_path; - net_util::FileURLToFilePath(file_url, &file_path); + net::FileURLToFilePath(file_url, &file_path); // If we can not get valid file path from original URL, treat it as // disk error. if (file_path.empty()) diff --git a/chrome/browser/save_package.cc b/chrome/browser/save_package.cc index ef110b7..3aac7a8 100644 --- a/chrome/browser/save_package.cc +++ b/chrome/browser/save_package.cc @@ -237,7 +237,7 @@ bool SavePackage::GenerateFilename(const std::string& disposition, bool need_html_ext, std::wstring* generated_name) { std::wstring file_name = - net_util::GetSuggestedFilename(GURL(url), disposition, kDefaultSaveName); + net::GetSuggestedFilename(GURL(url), disposition, kDefaultSaveName); DCHECK(!file_name.empty()); // Check whether we have same name before. diff --git a/chrome/browser/session_history_uitest.cc b/chrome/browser/session_history_uitest.cc index 06de102..f8f62e3 100644 --- a/chrome/browser/session_history_uitest.cc +++ b/chrome/browser/session_history_uitest.cc @@ -51,7 +51,7 @@ class SessionHistoryTest : public UITest { file_util::AppendToPath(&path_prefix, L"session_history"); path_prefix += file_util::kPathSeparator; - url_prefix_ = UTF8ToWide(net_util::FilePathToFileURL(path_prefix).spec()); + url_prefix_ = UTF8ToWide(net::FilePathToFileURL(path_prefix).spec()); } virtual void SetUp() { diff --git a/chrome/browser/session_restore_uitest.cc b/chrome/browser/session_restore_uitest.cc index 587b30d..903bf0d 100644 --- a/chrome/browser/session_restore_uitest.cc +++ b/chrome/browser/session_restore_uitest.cc @@ -50,9 +50,9 @@ class SessionRestoreUITest : public UITest { file_util::AppendToPath(&path_prefix, L"session_history"); path_prefix += file_util::kPathSeparator; - url1 = net_util::FilePathToFileURL(path_prefix + L"bot1.html"); - url2 = net_util::FilePathToFileURL(path_prefix + L"bot2.html"); - url3 = net_util::FilePathToFileURL(path_prefix + L"bot3.html"); + url1 = net::FilePathToFileURL(path_prefix + L"bot1.html"); + url2 = net::FilePathToFileURL(path_prefix + L"bot2.html"); + url3 = net::FilePathToFileURL(path_prefix + L"bot3.html"); } virtual void QuitBrowserAndRestore() { diff --git a/chrome/browser/site_instance.cc b/chrome/browser/site_instance.cc index efe907f..99f64cb 100644 --- a/chrome/browser/site_instance.cc +++ b/chrome/browser/site_instance.cc @@ -115,7 +115,7 @@ GURL SiteInstance::GetSiteForURL(const GURL& url) { // If this URL has a registered domain, we only want to remember that part. std::string domain = - RegistryControlledDomainService::GetDomainAndRegistry(url); + net::RegistryControlledDomainService::GetDomainAndRegistry(url); if (!domain.empty()) { GURL::Replacements rep; rep.SetHostStr(domain); @@ -155,5 +155,5 @@ bool SiteInstance::IsSameWebSite(const GURL& url1, const GURL& url2) { return false; } - return RegistryControlledDomainService::SameDomainOrHost(url1, url2); + return net::RegistryControlledDomainService::SameDomainOrHost(url1, url2); } diff --git a/chrome/browser/ssl_error_info.cc b/chrome/browser/ssl_error_info.cc index fc6019c..992bece 100644 --- a/chrome/browser/ssl_error_info.cc +++ b/chrome/browser/ssl_error_info.cc @@ -53,7 +53,7 @@ SSLErrorInfo::SSLErrorInfo(const std::wstring& title, // static SSLErrorInfo SSLErrorInfo::CreateError(ErrorType error_type, - X509Certificate* cert, + net::X509Certificate* cert, const GURL& request_url) { std::wstring title, details, short_description; std::vector<std::wstring> extra_info; @@ -257,7 +257,7 @@ int SSLErrorInfo::GetErrorsForCertStatus(int cert_id, }; DCHECK(arraysize(kErrorFlags) == arraysize(kErrorTypes)); - scoped_refptr<X509Certificate> cert = NULL; + scoped_refptr<net::X509Certificate> cert = NULL; int count = 0; for (int i = 0; i < arraysize(kErrorFlags); ++i) { if (cert_status & kErrorFlags[i]) { diff --git a/chrome/browser/ssl_error_info.h b/chrome/browser/ssl_error_info.h index 5739a7b..e1b5a63 100644 --- a/chrome/browser/ssl_error_info.h +++ b/chrome/browser/ssl_error_info.h @@ -64,7 +64,7 @@ class SSLErrorInfo { static ErrorType NetErrorToErrorType(int net_error); static SSLErrorInfo CreateError(ErrorType error_type, - X509Certificate* cert, + net::X509Certificate* cert, const GURL& request_url); // Populates the specified |errors| vector with the errors contained in diff --git a/chrome/browser/ssl_manager.cc b/chrome/browser/ssl_manager.cc index c15436d..0e9b16a 100644 --- a/chrome/browser/ssl_manager.cc +++ b/chrome/browser/ssl_manager.cc @@ -266,7 +266,7 @@ void SSLManager::AddMessageToConsole(const std::wstring& msg, // Delegate API method. -void SSLManager::DenyCertForHost(X509Certificate* cert, +void SSLManager::DenyCertForHost(net::X509Certificate* cert, const std::string& host) { // Remember that we don't like this cert for this host. // TODO(abarth): Do we want to persist this information in the user's profile? @@ -274,7 +274,7 @@ void SSLManager::DenyCertForHost(X509Certificate* cert, } // Delegate API method. -void SSLManager::AllowCertForHost(X509Certificate* cert, +void SSLManager::AllowCertForHost(net::X509Certificate* cert, const std::string& host) { // Remember that we do like this cert for this host. // TODO(abarth): Do we want to persist this information in the user's profile? @@ -282,8 +282,8 @@ void SSLManager::AllowCertForHost(X509Certificate* cert, } // Delegate API method. -X509Certificate::Policy::Judgment SSLManager::QueryPolicy( - X509Certificate* cert, const std::string& host) { +net::X509Certificate::Policy::Judgment SSLManager::QueryPolicy( + net::X509Certificate* cert, const std::string& host) { // TODO(abarth): Do we want to read this information from the user's profile? return cert_policy_for_host_[host].Check(cert); } @@ -512,7 +512,7 @@ SSLManager::CertError::CertError( URLRequest* request, ResourceType::Type resource_type, int cert_error, - X509Certificate* cert, + net::X509Certificate* cert, MessageLoop* ui_loop) : ErrorHandler(rdh, request, ui_loop), cert_error_(cert_error), @@ -529,7 +529,7 @@ SSLManager::CertError::CertError( void SSLManager::OnSSLCertificateError(ResourceDispatcherHost* rdh, URLRequest* request, int cert_error, - X509Certificate* cert, + net::X509Certificate* cert, MessageLoop* ui_loop) { DLOG(INFO) << "OnSSLCertificateError() cert_error: " << cert_error << " url: " << request->url().spec(); @@ -751,7 +751,7 @@ bool SSLManager::DeserializeSecurityInfo(const std::string& state, } // static -bool SSLManager::GetEVCertNames(const X509Certificate& cert, +bool SSLManager::GetEVCertNames(const net::X509Certificate& cert, std::wstring* short_name, std::wstring* ca_name) { DCHECK(short_name || ca_name); diff --git a/chrome/browser/ssl_manager.h b/chrome/browser/ssl_manager.h index c0d6750..943c29c 100644 --- a/chrome/browser/ssl_manager.h +++ b/chrome/browser/ssl_manager.h @@ -215,7 +215,7 @@ class SSLManager : public NotificationObserver { URLRequest* request, ResourceType::Type resource_type, int cert_error, - X509Certificate* cert, + net::X509Certificate* cert, MessageLoop* ui_loop); // ErrorHandler methods @@ -318,14 +318,14 @@ class SSLManager : public NotificationObserver { ConsoleMessageLevel level); // Records that |cert| is permitted to be used for |host| in the future. - void DenyCertForHost(X509Certificate* cert, const std::string& host); + void DenyCertForHost(net::X509Certificate* cert, const std::string& host); // Records that |cert| is not permitted to be used for |host| in the future. - void AllowCertForHost(X509Certificate* cert, const std::string& host); + void AllowCertForHost(net::X509Certificate* cert, const std::string& host); // Queries whether |cert| is allowed or denied for |host|. - X509Certificate::Policy::Judgment QueryPolicy(X509Certificate* cert, - const std::string& host); + net::X509Certificate::Policy::Judgment QueryPolicy( + net::X509Certificate* cert, const std::string& host); // Allow mixed/unsafe content to be visible (non filtered) for the specified // URL. @@ -353,7 +353,7 @@ class SSLManager : public NotificationObserver { static void OnSSLCertificateError(ResourceDispatcherHost* resource_dispatcher, URLRequest* request, int cert_error, - X509Certificate* cert, + net::X509Certificate* cert, MessageLoop* ui_loop); // Called when a mixed-content sub-resource request has been detected. The @@ -414,7 +414,7 @@ class SSLManager : public NotificationObserver { // Sets |short_name| to <organization_name> [<country>] and |ca_name| // to something like: // "Verified by <issuer_organization_name>" - static bool GetEVCertNames(const X509Certificate& cert, + static bool GetEVCertNames(const net::X509Certificate& cert, std::wstring* short_name, std::wstring* ca_name); @@ -470,7 +470,7 @@ class SSLManager : public NotificationObserver { ObserverList<SSLInfoBar> visible_info_bars_; // Certificate policies for each host. - std::map<std::string, X509Certificate::Policy> cert_policy_for_host_; + std::map<std::string, net::X509Certificate::Policy> cert_policy_for_host_; // Domains for which it is OK to show insecure content. std::set<std::string> can_show_insecure_content_for_host_; diff --git a/chrome/browser/ssl_policy.cc b/chrome/browser/ssl_policy.cc index 08f7936..1ae9ae1 100644 --- a/chrome/browser/ssl_policy.cc +++ b/chrome/browser/ssl_policy.cc @@ -303,21 +303,21 @@ class DefaultPolicy : public SSLPolicy { } // First we check if we know the policy for this error. - X509Certificate::Policy::Judgment judgment = + net::X509Certificate::Policy::Judgment judgment = error->manager()->QueryPolicy(error->ssl_info().cert, error->request_url().host()); - switch(judgment) { - case X509Certificate::Policy::ALLOWED: + switch (judgment) { + case net::X509Certificate::Policy::ALLOWED: // We've been told to allow this certificate. error->manager()->SetMaxSecurityStyle( SECURITY_STYLE_AUTHENTICATION_BROKEN); error->ContinueRequest(); break; - case X509Certificate::Policy::DENIED: + case net::X509Certificate::Policy::DENIED: // For now we handle the DENIED as the UNKNOWN, which means a blocking // page is shown to the user every time he comes back to the page. - case X509Certificate::Policy::UNKNOWN: + case net::X509Certificate::Policy::UNKNOWN: // We don't know how to handle this error. Ask our sub-policies. sub_policies_[index]->OnCertError(main_frame_url, error); break; diff --git a/chrome/browser/tab_contents.cc b/chrome/browser/tab_contents.cc index 364ef91..7f6c9e8 100644 --- a/chrome/browser/tab_contents.cc +++ b/chrome/browser/tab_contents.cc @@ -166,7 +166,7 @@ bool TabContents::GetSSLEVText(std::wstring* ev_text, ((entry->GetSSLCertStatus() & net::CERT_STATUS_IS_EV) == 0)) return false; - scoped_refptr<X509Certificate> cert; + scoped_refptr<net::X509Certificate> cert; CertStore::GetSharedInstance()->RetrieveCert(entry->GetSSLCertID(), &cert); if (!cert.get()) { NOTREACHED(); diff --git a/chrome/browser/tab_restore_uitest.cc b/chrome/browser/tab_restore_uitest.cc index 7765902..811b6d2 100644 --- a/chrome/browser/tab_restore_uitest.cc +++ b/chrome/browser/tab_restore_uitest.cc @@ -47,8 +47,8 @@ class TabRestoreUITest : public UITest { std::wstring path_prefix = test_data_directory_; file_util::AppendToPath(&path_prefix, L"session_history"); path_prefix += file_util::kPathSeparator; - url1_ = net_util::FilePathToFileURL(path_prefix + L"bot1.html"); - url2_ = net_util::FilePathToFileURL(path_prefix + L"bot2.html"); + url1_ = net::FilePathToFileURL(path_prefix + L"bot1.html"); + url2_ = net::FilePathToFileURL(path_prefix + L"bot2.html"); } protected: diff --git a/chrome/browser/template_url_model.cc b/chrome/browser/template_url_model.cc index b137915..85e4a78 100644 --- a/chrome/browser/template_url_model.cc +++ b/chrome/browser/template_url_model.cc @@ -174,7 +174,7 @@ std::wstring TemplateURLModel::GenerateKeyword(const GURL& url, // Strip "www." off the front of the keyword; otherwise the keyword won't work // properly. See http://b/issue?id=1205573. - return net_util::StripWWW(UTF8ToWide(url.host())); + return net::StripWWW(UTF8ToWide(url.host())); } // static @@ -195,7 +195,7 @@ std::wstring TemplateURLModel::CleanUserInputKeyword( } // Remove leading "www.". - result = net_util::StripWWW(result); + result = net::StripWWW(result); // Remove trailing "/". return (result.length() > 0 && result[result.length() - 1] == L'/') ? diff --git a/chrome/browser/toolbar_model.cc b/chrome/browser/toolbar_model.cc index e6bf8bc..6321555 100644 --- a/chrome/browser/toolbar_model.cc +++ b/chrome/browser/toolbar_model.cc @@ -200,7 +200,7 @@ void ToolbarModel::GetInfoText(std::wstring* text, ((entry->GetSSLCertStatus() & net::CERT_STATUS_IS_EV) == 0)) return; - scoped_refptr<X509Certificate> cert; + scoped_refptr<net::X509Certificate> cert; CertStore::GetSharedInstance()->RetrieveCert(entry->GetSSLCertID(), &cert); if (!cert.get()) { NOTREACHED(); diff --git a/chrome/browser/url_fixer_upper.cc b/chrome/browser/url_fixer_upper.cc index 9fb2cde..f687d6e 100644 --- a/chrome/browser/url_fixer_upper.cc +++ b/chrome/browser/url_fixer_upper.cc @@ -84,7 +84,7 @@ static wstring FixupPath(const wstring& text) { filename[1] = ':'; // Here, we know the input looks like a file. - GURL file_url = net_util::FilePathToFileURL(filename); + GURL file_url = net::FilePathToFileURL(filename); if (file_url.is_valid()) return gfx::ElideUrl(file_url, ChromeFont(), 0, std::wstring()); @@ -108,7 +108,7 @@ static void AddDesiredTLD(const wstring& desired_tld, // TLD). We disallow unknown registries here so users can input "mail.yahoo" // and hit ctrl-enter to get "www.mail.yahoo.com". const size_t registry_length = - RegistryControlledDomainService::GetRegistryLength(*domain, false); + net::RegistryControlledDomainService::GetRegistryLength(*domain, false); if (registry_length != 0) return; @@ -457,7 +457,7 @@ wstring URLFixerUpper::FixupRelativeFile(const wstring& base_dir, SetCurrentDirectory(old_cur_directory); if (is_file) { - GURL file_url = net_util::FilePathToFileURL(full_path); + GURL file_url = net::FilePathToFileURL(full_path); if (file_url.is_valid()) return gfx::ElideUrl(file_url, ChromeFont(), 0, std::wstring()); // Invalid files fall through to regular processing. diff --git a/chrome/browser/url_fixer_upper_unittest.cc b/chrome/browser/url_fixer_upper_unittest.cc index a885525..713a8f1 100644 --- a/chrome/browser/url_fixer_upper_unittest.cc +++ b/chrome/browser/url_fixer_upper_unittest.cc @@ -164,7 +164,7 @@ static bool IsMatchingFileURL(const std::wstring& url, return false; // contains backslashes std::wstring derived_path; - net_util::FileURLToFilePath(GURL(url), &derived_path); + net::FileURLToFilePath(GURL(url), &derived_path); return (derived_path.length() == full_file_path.length()) && std::equal(derived_path.begin(), derived_path.end(), full_file_path.begin(), CaseInsensitiveCompare<wchar_t>()); @@ -249,7 +249,7 @@ TEST(URLFixerUpperTest, FixupFile) { // reference path std::wstring golden = - UTF8ToWide(net_util::FilePathToFileURL(original).spec()); + UTF8ToWide(net::FilePathToFileURL(original).spec()); // c:\foo\bar.txt -> file:///c:/foo/bar.txt (basic) std::wstring fixedup = URLFixerUpper::FixupURL(original, L""); diff --git a/chrome/browser/views/constrained_window_impl_interactive_uitest.cc b/chrome/browser/views/constrained_window_impl_interactive_uitest.cc index b06efd3..1fd47ea 100644 --- a/chrome/browser/views/constrained_window_impl_interactive_uitest.cc +++ b/chrome/browser/views/constrained_window_impl_interactive_uitest.cc @@ -62,7 +62,7 @@ TEST_F(InteractiveConstrainedWindowTest, UserActivatedResizeToLeavesSpaceForChro file_util::AppendToPath(&filename, L"constrained_files"); file_util::AppendToPath(&filename, L"constrained_window_onload_resizeto.html"); - ASSERT_TRUE(tab->NavigateToURL(net_util::FilePathToFileURL(filename))); + ASSERT_TRUE(tab->NavigateToURL(net::FilePathToFileURL(filename))); gfx::Rect tab_view_bounds; ASSERT_TRUE(window->GetViewBounds(VIEW_ID_TAB_CONTAINER, diff --git a/chrome/browser/views/options/advanced_contents_view.cc b/chrome/browser/views/options/advanced_contents_view.cc index 52ed1df..29382c4 100644 --- a/chrome/browser/views/options/advanced_contents_view.cc +++ b/chrome/browser/views/options/advanced_contents_view.cc @@ -636,16 +636,16 @@ class CookieBehaviorComboModel : public ChromeViews::ComboBox::Model { return L""; } - static int CookiePolicyToIndex(CookiePolicy::Type policy) { + static int CookiePolicyToIndex(net::CookiePolicy::Type policy) { return policy; } - static CookiePolicy::Type IndexToCookiePolicy(int index) { - if (CookiePolicy::ValidType(index)) - return CookiePolicy::FromInt(index); + static net::CookiePolicy::Type IndexToCookiePolicy(int index) { + if (net::CookiePolicy::ValidType(index)) + return net::CookiePolicy::FromInt(index); NOTREACHED(); - return CookiePolicy::ALLOW_ALL_COOKIES; + return net::CookiePolicy::ALLOW_ALL_COOKIES; } private: @@ -775,7 +775,7 @@ void SecuritySection::ItemChanged(ChromeViews::ComboBox* sender, UserMetricsRecordAction(kUserMetrics[filter_policy], profile()->GetPrefs()); filter_mixed_content_.SetValue(filter_policy); } else if (sender == cookie_behavior_combobox_) { - CookiePolicy::Type cookie_policy = + net::CookiePolicy::Type cookie_policy = CookieBehaviorComboModel::IndexToCookiePolicy(new_index); const wchar_t* kUserMetrics[] = { L"Options_AllowAllCookies", @@ -884,7 +884,7 @@ void SecuritySection::NotifyPrefChanged(const std::wstring* pref_name) { if (!pref_name || *pref_name == prefs::kCookieBehavior) { cookie_behavior_combobox_->SetSelectedItem( CookieBehaviorComboModel::CookiePolicyToIndex( - CookiePolicy::FromInt(cookie_behavior_.GetValue()))); + net::CookiePolicy::FromInt(cookie_behavior_.GetValue()))); } if (!pref_name || *pref_name == prefs::kSafeBrowsingEnabled) enable_safe_browsing_checkbox_->SetIsSelected(safe_browsing_.GetValue()); diff --git a/chrome/browser/views/options/cookies_view.cc b/chrome/browser/views/options/cookies_view.cc index bd5424d..8d93fed 100644 --- a/chrome/browser/views/options/cookies_view.cc +++ b/chrome/browser/views/options/cookies_view.cc @@ -66,7 +66,7 @@ class CookiesTableModel : public ChromeViews::TableModel { // Returns information about the Cookie at the specified index. std::string GetDomainAt(int index); - CookieMonster::CanonicalCookie& GetCookieAt(int index); + net::CookieMonster::CanonicalCookie& GetCookieAt(int index); // Remove the specified cookies from the Cookie Monster and update the view. void RemoveCookies(int start_index, int remove_count); @@ -90,8 +90,8 @@ class CookiesTableModel : public ChromeViews::TableModel { // The profile from which this model sources cookies. Profile* profile_; - typedef CookieMonster::CookieList CookieList; - typedef std::vector<CookieMonster::CookieListPair*> CookiePtrList; + typedef net::CookieMonster::CookieList CookieList; + typedef std::vector<net::CookieMonster::CookieListPair*> CookiePtrList; CookieList all_cookies_; CookiePtrList shown_cookies_; @@ -121,7 +121,8 @@ std::string CookiesTableModel::GetDomainAt(int index) { return shown_cookies_.at(index)->first; } -CookieMonster::CanonicalCookie& CookiesTableModel::GetCookieAt(int index) { +net::CookieMonster::CanonicalCookie& CookiesTableModel::GetCookieAt( + int index) { DCHECK(index >= 0 && index < RowCount()); return shown_cookies_.at(index)->second; } @@ -132,7 +133,7 @@ void CookiesTableModel::RemoveCookies(int start_index, int remove_count) { return; } - CookieMonster* monster = profile_->GetRequestContext()->cookie_store(); + net::CookieMonster* monster = profile_->GetRequestContext()->cookie_store(); // We need to update the searched results list, the full cookie list, // and the view. We walk through the search results list (which is what @@ -207,17 +208,18 @@ void CookiesTableModel::SetObserver(ChromeViews::TableModelObserver* observer) { // Returns true if |cookie| matches the specified filter, where "match" is // defined as the cookie's domain, name and value contains filter text // somewhere. -static bool ContainsFilterText(const std::string& domain, - const CookieMonster::CanonicalCookie& cookie, - const std::string& filter) { +static bool ContainsFilterText( + const std::string& domain, + const net::CookieMonster::CanonicalCookie& cookie, + const std::string& filter) { return domain.find(filter) != std::string::npos || cookie.Name().find(filter) != std::string::npos || cookie.Value().find(filter) != std::string::npos; } // Sort ignore the '.' prefix for domain cookies. -static bool CookieSorter(const CookieMonster::CookieListPair& cp1, - const CookieMonster::CookieListPair& cp2) { +static bool CookieSorter(const net::CookieMonster::CookieListPair& cp1, + const net::CookieMonster::CookieListPair& cp2) { bool is1domain = !cp1.first.empty() && cp1.first[0] == '.'; bool is2domain = !cp2.first.empty() && cp2.first[0] == '.'; @@ -235,7 +237,7 @@ static bool CookieSorter(const CookieMonster::CookieListPair& cp1, void CookiesTableModel::LoadCookies() { // mmargh mmargh mmargh! - CookieMonster* cookie_monster = + net::CookieMonster* cookie_monster = profile_->GetRequestContext()->cookie_store(); all_cookies_ = cookie_monster->GetAllCookies(); std::sort(all_cookies_.begin(), all_cookies_.end(), CookieSorter); @@ -335,7 +337,7 @@ class CookieInfoView : public ChromeViews::View { // Update the display from the specified CookieNode. void SetCookie(const std::string& domain, - const CookieMonster::CanonicalCookie& cookie_node); + const net::CookieMonster::CanonicalCookie& cookie_node); // Clears the cookie display to indicate that no or multiple cookies are // selected. @@ -393,8 +395,9 @@ CookieInfoView::CookieInfoView() CookieInfoView::~CookieInfoView() { } -void CookieInfoView::SetCookie(const std::string& domain, - const CookieMonster::CanonicalCookie& cookie) { +void CookieInfoView::SetCookie( + const std::string& domain, + const net::CookieMonster::CanonicalCookie& cookie) { name_value_field_->SetText(UTF8ToWide(cookie.Name())); content_value_field_->SetText(UTF8ToWide(cookie.Value())); domain_value_field_->SetText(UTF8ToWide(domain)); diff --git a/chrome/browser/web_contents.cc b/chrome/browser/web_contents.cc index 5a330e7..0d5ed17 100644 --- a/chrome/browser/web_contents.cc +++ b/chrome/browser/web_contents.cc @@ -1301,7 +1301,8 @@ void WebContents::UpdateHistoryForNavigation(const GURL& display_url, void WebContents::MaybeCloseChildWindows( const ViewHostMsg_FrameNavigate_Params& params) { - if (RegistryControlledDomainService::SameDomainOrHost(last_url_, params.url)) + if (net::RegistryControlledDomainService::SameDomainOrHost( + last_url_, params.url)) return; last_url_ = params.url; @@ -1876,7 +1877,7 @@ void WebContents::DidNavigateAnyFramePreCommit( DownloadManager* download_manager = profile()->GetDownloadManager(); // download_manager can be NULL in unit test context. if (download_manager && download_manager ->in_progress_count() == 0 && - current_entry && !RegistryControlledDomainService::SameDomainOrHost( + current_entry && !net::RegistryControlledDomainService::SameDomainOrHost( current_entry->GetURL(), entry->GetURL())) { TimeDelta time_delta( TimeTicks::Now() - last_download_shelf_show_); diff --git a/chrome/common/gfx/url_elider.cc b/chrome/common/gfx/url_elider.cc index 5ffdfe4..6eff901 100644 --- a/chrome/common/gfx/url_elider.cc +++ b/chrome/common/gfx/url_elider.cc @@ -113,7 +113,7 @@ std::wstring ElideUrl(const GURL& url, // Get domain and registry information from the URL. std::wstring url_domain = UTF8ToWide( - RegistryControlledDomainService::GetDomainAndRegistry(url)); + net::RegistryControlledDomainService::GetDomainAndRegistry(url)); if (url_domain.empty()) url_domain = url_host; @@ -353,7 +353,7 @@ void AppendFormattedHost(const GURL& url, DCHECK(host.begin >= 0 && ((spec.length() == 0 && host.begin == 0) || host.begin < static_cast<int>(spec.length()))); - net_util::IDNToUnicode(&spec[host.begin], host.len, languages, output); + net::IDNToUnicode(&spec[host.begin], host.len, languages, output); new_parsed->host.len = static_cast<int>(output->length()) - new_parsed->host.begin; diff --git a/chrome/common/net/cookie_monster_sqlite.cc b/chrome/common/net/cookie_monster_sqlite.cc index 259b8f2..51c417b 100644 --- a/chrome/common/net/cookie_monster_sqlite.cc +++ b/chrome/common/net/cookie_monster_sqlite.cc @@ -59,9 +59,9 @@ class SQLitePersistentCookieStore::Backend // Batch a cookie add void AddCookie(const std::string& key, - const CookieMonster::CanonicalCookie& cc); + const net::CookieMonster::CanonicalCookie& cc); // Batch a cookie delete - void DeleteCookie(const CookieMonster::CanonicalCookie& cc); + void DeleteCookie(const net::CookieMonster::CanonicalCookie& cc); // Commit and pending operations and close the database, must be called // before the object is destructed. void Close(); @@ -76,24 +76,24 @@ class SQLitePersistentCookieStore::Backend PendingOperation(OperationType op, const std::string& key, - const CookieMonster::CanonicalCookie& cc) + const net::CookieMonster::CanonicalCookie& cc) : op_(op), key_(key), cc_(cc) { } OperationType op() const { return op_; } const std::string& key() const { return key_; } - const CookieMonster::CanonicalCookie& cc() const { return cc_; } + const net::CookieMonster::CanonicalCookie& cc() const { return cc_; } private: OperationType op_; std::string key_; // Only used for OP_ADD - CookieMonster::CanonicalCookie cc_; + net::CookieMonster::CanonicalCookie cc_; }; private: // Batch a cookie operation (add or delete) void BatchOperation(PendingOperation::OperationType op, const std::string& key, - const CookieMonster::CanonicalCookie& cc); + const net::CookieMonster::CanonicalCookie& cc); // Commit our pending operations to the database. void Commit(); // Close() executed on the background thread. @@ -113,19 +113,19 @@ class SQLitePersistentCookieStore::Backend void SQLitePersistentCookieStore::Backend::AddCookie( const std::string& key, - const CookieMonster::CanonicalCookie& cc) { + const net::CookieMonster::CanonicalCookie& cc) { BatchOperation(PendingOperation::COOKIE_ADD, key, cc); } void SQLitePersistentCookieStore::Backend::DeleteCookie( - const CookieMonster::CanonicalCookie& cc) { + const net::CookieMonster::CanonicalCookie& cc) { BatchOperation(PendingOperation::COOKIE_DELETE, std::string(), cc); } void SQLitePersistentCookieStore::Backend::BatchOperation( PendingOperation::OperationType op, const std::string& key, - const CookieMonster::CanonicalCookie& cc) { + const net::CookieMonster::CanonicalCookie& cc) { // Commit every 30 seconds. static const int kCommitIntervalMs = 30 * 1000; // Commit right away if we have more than 512 outstanding operations. @@ -288,7 +288,7 @@ bool InitTable(sqlite3* db) { } // namespace bool SQLitePersistentCookieStore::Load( - std::vector<CookieMonster::KeyedCanonicalCookie>* cookies) { + std::vector<net::CookieMonster::KeyedCanonicalCookie>* cookies) { DCHECK(!path_.empty()); sqlite3* db; if (sqlite3_open(WideToUTF8(path_).c_str(), &db) != SQLITE_OK) { @@ -323,8 +323,8 @@ bool SQLitePersistentCookieStore::Load( while (smt.step() == SQLITE_ROW) { std::string key = smt.column_string(1); - scoped_ptr<CookieMonster::CanonicalCookie> cc( - new CookieMonster::CanonicalCookie( + scoped_ptr<net::CookieMonster::CanonicalCookie> cc( + new net::CookieMonster::CanonicalCookie( smt.column_string(2), // name smt.column_string(3), // value smt.column_string(4), // path @@ -340,8 +340,8 @@ bool SQLitePersistentCookieStore::Load( DLOG_IF(WARNING, cc->CreationDate() > Time::Now()) << L"CreationDate too recent"; cookies->push_back( - CookieMonster::KeyedCanonicalCookie(smt.column_string(1), - cc.release())); + net::CookieMonster::KeyedCanonicalCookie(smt.column_string(1), + cc.release())); } // Create the backend, this will take ownership of the db pointer. @@ -366,13 +366,13 @@ bool SQLitePersistentCookieStore::EnsureDatabaseVersion(sqlite3* db) { void SQLitePersistentCookieStore::AddCookie( const std::string& key, - const CookieMonster::CanonicalCookie& cc) { + const net::CookieMonster::CanonicalCookie& cc) { if (backend_.get()) backend_->AddCookie(key, cc); } void SQLitePersistentCookieStore::DeleteCookie( - const CookieMonster::CanonicalCookie& cc) { + const net::CookieMonster::CanonicalCookie& cc) { if (backend_.get()) backend_->DeleteCookie(cc); } diff --git a/chrome/common/net/cookie_monster_sqlite.h b/chrome/common/net/cookie_monster_sqlite.h index 49de96a..44d1e1dd 100644 --- a/chrome/common/net/cookie_monster_sqlite.h +++ b/chrome/common/net/cookie_monster_sqlite.h @@ -43,17 +43,17 @@ struct sqlite3; class SQLitePersistentCookieStore - : public CookieMonster::PersistentCookieStore { + : public net::CookieMonster::PersistentCookieStore { public: SQLitePersistentCookieStore(const std::wstring& path, MessageLoop* background_loop); ~SQLitePersistentCookieStore(); - virtual bool Load(std::vector<CookieMonster::KeyedCanonicalCookie>*); + virtual bool Load(std::vector<net::CookieMonster::KeyedCanonicalCookie>*); virtual void AddCookie(const std::string&, - const CookieMonster::CanonicalCookie&); - virtual void DeleteCookie(const CookieMonster::CanonicalCookie&); + const net::CookieMonster::CanonicalCookie&); + virtual void DeleteCookie(const net::CookieMonster::CanonicalCookie&); private: class Backend; diff --git a/chrome/common/net/url_request_intercept_job.cc b/chrome/common/net/url_request_intercept_job.cc index 4da58d0c..3f245de 100644 --- a/chrome/common/net/url_request_intercept_job.cc +++ b/chrome/common/net/url_request_intercept_job.cc @@ -160,10 +160,10 @@ void URLRequestInterceptJob::GetResponseInfo(net::HttpResponseInfo* info) { << request_->url(); info->ssl_info.cert = - new X509Certificate(request_->url().GetWithEmptyPath().spec(), - kCertIssuer, - Time::Now(), - Time::Now() + TimeDelta::FromDays(kLifetimeDays)); + new net::X509Certificate(request_->url().GetWithEmptyPath().spec(), + kCertIssuer, + Time::Now(), + Time::Now() + TimeDelta::FromDays(kLifetimeDays)); info->ssl_info.cert_status = 0; info->ssl_info.security_bits = 0; } diff --git a/chrome/common/os_exchange_data.cc b/chrome/common/os_exchange_data.cc index 05984b5..7e311f6 100644 --- a/chrome/common/os_exchange_data.cc +++ b/chrome/common/os_exchange_data.cc @@ -663,8 +663,8 @@ static void CreateValidFileNameFromTitle(const GURL& url, std::wstring* validated) { if (title.empty()) { if (url.is_valid()) { - *validated = net_util::GetSuggestedFilename(url, std::wstring(), - std::wstring()); + *validated = net::GetSuggestedFilename( + url, std::wstring(), std::wstring()); } else { // Nothing else can be done, just use a default. *validated = l10n_util::GetString(IDS_UNTITLED_SHORTCUT_FILE_NAME); diff --git a/chrome/test/accessibility/accessibility_tests.cc b/chrome/test/accessibility/accessibility_tests.cc index 84dee3b..f00f9e4 100644 --- a/chrome/test/accessibility/accessibility_tests.cc +++ b/chrome/test/accessibility/accessibility_tests.cc @@ -218,7 +218,7 @@ TEST_F(AccessibilityTest, TestStarBtnStatusOnNewTab) { ASSERT_TRUE(tab1.get()); std::wstring test_file1 = test_data_directory_; file_util::AppendToPath(&test_file1, L"title1.html"); - tab1->NavigateToURL(net_util::FilePathToFileURL(test_file1)); + tab1->NavigateToURL(net::FilePathToFileURL(test_file1)); Sleep(kWaitForActionMsec); EXPECT_EQ(L"focusable", GetState(p_toolbar, button)); @@ -239,7 +239,7 @@ TEST_F(AccessibilityTest, TestStarBtnStatusOnNewTab) { old_tab_count = new_tab_count; std::wstring test_file2 = test_data_directory_; file_util::AppendToPath(&test_file2, L"title1.html"); - ASSERT_TRUE(window->AppendTab(net_util::FilePathToFileURL(test_file2))); + ASSERT_TRUE(window->AppendTab(net::FilePathToFileURL(test_file2))); ASSERT_TRUE(window->WaitForTabCountToChange(old_tab_count, &new_tab_count, 5000)); // Check tab count. Also, check accessibility object's children. @@ -320,7 +320,7 @@ TEST_F(AccessibilityTest, DISABLED_TestBackBtnStatusOnNewTab) { ASSERT_TRUE(tab1.get()); std::wstring test_file1 = test_data_directory_; file_util::AppendToPath(&test_file1, L"title1.html"); - tab1->NavigateToURL(net_util::FilePathToFileURL(test_file1)); + tab1->NavigateToURL(net::FilePathToFileURL(test_file1)); Sleep(kWaitForActionMsec); if (win_util::GetWinVersion() > win_util::WINVERSION_2000) { EXPECT_EQ(L"has popup, focusable", @@ -356,7 +356,7 @@ TEST_F(AccessibilityTest, DISABLED_TestBackBtnStatusOnNewTab) { old_tab_count = new_tab_count; std::wstring test_file2 = test_data_directory_; file_util::AppendToPath(&test_file2, L"title1.html"); - ASSERT_TRUE(window->AppendTab(net_util::FilePathToFileURL(test_file2))); + ASSERT_TRUE(window->AppendTab(net::FilePathToFileURL(test_file2))); ASSERT_TRUE(window->WaitForTabCountToChange(old_tab_count, &new_tab_count, 5000)); // Check tab count. Also, check accessibility object's children. @@ -441,7 +441,7 @@ TEST_F(AccessibilityTest, DISABLED_TestForwardBtnStatusOnNewTab) { ASSERT_TRUE(tab1.get()); std::wstring test_file1 = test_data_directory_; file_util::AppendToPath(&test_file1, L"title1.html"); - tab1->NavigateToURL(net_util::FilePathToFileURL(test_file1)); + tab1->NavigateToURL(net::FilePathToFileURL(test_file1)); Sleep(kWaitForActionMsec); if (win_util::GetWinVersion() > win_util::WINVERSION_2000) { EXPECT_EQ(L"has popup, focusable, unavailable", @@ -486,7 +486,7 @@ TEST_F(AccessibilityTest, DISABLED_TestForwardBtnStatusOnNewTab) { old_tab_count = new_tab_count; std::wstring test_file2 = test_data_directory_; file_util::AppendToPath(&test_file2, L"title1.html"); - ASSERT_TRUE(window->AppendTab(net_util::FilePathToFileURL(test_file2))); + ASSERT_TRUE(window->AppendTab(net::FilePathToFileURL(test_file2))); ASSERT_TRUE(window->WaitForTabCountToChange(old_tab_count, &new_tab_count, 5000)); // Check tab count. diff --git a/chrome/test/automation/automation_proxy_uitest.cc b/chrome/test/automation/automation_proxy_uitest.cc index b639007..74a2eef 100644 --- a/chrome/test/automation/automation_proxy_uitest.cc +++ b/chrome/test/automation/automation_proxy_uitest.cc @@ -197,7 +197,7 @@ TEST_F(AutomationProxyVisibleTest, AppendTab) { std::wstring filename(test_data_directory_); file_util::AppendToPath(&filename, L"title2.html"); - ASSERT_TRUE(window->AppendTab(net_util::FilePathToFileURL(filename))); + ASSERT_TRUE(window->AppendTab(net::FilePathToFileURL(filename))); int appended_tab_index; // Append tab will also be active tab @@ -266,7 +266,7 @@ TEST_F(AutomationProxyTest, NavigateToURL) { std::wstring filename(test_data_directory_); file_util::AppendToPath(&filename, L"title2.html"); - tab->NavigateToURL(net_util::FilePathToFileURL(filename)); + tab->NavigateToURL(net::FilePathToFileURL(filename)); ASSERT_TRUE(tab->GetTabTitle(&title)); ASSERT_STREQ(L"Title Of Awesomeness", title.c_str()); @@ -284,7 +284,7 @@ TEST_F(AutomationProxyTest, DISABLED_NavigateToURLWithTimeout1) { file_util::AppendToPath(&filename, L"title2.html"); bool is_timeout; - tab->NavigateToURLWithTimeout(net_util::FilePathToFileURL(filename), + tab->NavigateToURLWithTimeout(net::FilePathToFileURL(filename), 10000, &is_timeout); ASSERT_FALSE(is_timeout); @@ -292,7 +292,7 @@ TEST_F(AutomationProxyTest, DISABLED_NavigateToURLWithTimeout1) { ASSERT_TRUE(tab->GetTabTitle(&title)); ASSERT_STREQ(L"Title Of Awesomeness", title.c_str()); - tab->NavigateToURLWithTimeout(net_util::FilePathToFileURL(filename), + tab->NavigateToURLWithTimeout(net::FilePathToFileURL(filename), 1, &is_timeout); ASSERT_TRUE(is_timeout); @@ -311,13 +311,13 @@ TEST_F(AutomationProxyTest, DISABLED_NavigateToURLWithTimeout2) { file_util::AppendToPath(&filename1, L"title1.html"); bool is_timeout; - tab->NavigateToURLWithTimeout(net_util::FilePathToFileURL(filename1), + tab->NavigateToURLWithTimeout(net::FilePathToFileURL(filename1), 1, &is_timeout); ASSERT_TRUE(is_timeout); std::wstring filename2(test_data_directory_); file_util::AppendToPath(&filename2, L"title2.html"); - tab->NavigateToURLWithTimeout(net_util::FilePathToFileURL(filename2), + tab->NavigateToURLWithTimeout(net::FilePathToFileURL(filename2), 10000, &is_timeout); ASSERT_FALSE(is_timeout); @@ -341,7 +341,7 @@ TEST_F(AutomationProxyTest, GoBackForward) { std::wstring filename(test_data_directory_); file_util::AppendToPath(&filename, L"title2.html"); - ASSERT_TRUE(tab->NavigateToURL(net_util::FilePathToFileURL(filename))); + ASSERT_TRUE(tab->NavigateToURL(net::FilePathToFileURL(filename))); ASSERT_TRUE(tab->GetTabTitle(&title)); ASSERT_STREQ(L"Title Of Awesomeness", title.c_str()); @@ -370,7 +370,7 @@ TEST_F(AutomationProxyTest, GetCurrentURL) { std::wstring filename(test_data_directory_); file_util::AppendToPath(&filename, L"cookie1.html"); - GURL newurl = net_util::FilePathToFileURL(filename); + GURL newurl = net::FilePathToFileURL(filename); ASSERT_TRUE(tab->NavigateToURL(newurl)); ASSERT_TRUE(tab->GetCurrentURL(&url)); // compare canonical urls... @@ -476,7 +476,7 @@ TEST_F(AutomationProxyTest, NavigateToURLAsync) { std::wstring filename(test_data_directory_); file_util::AppendToPath(&filename, L"cookie1.html"); - GURL newurl = net_util::FilePathToFileURL(filename); + GURL newurl = net::FilePathToFileURL(filename); ASSERT_TRUE(tab->NavigateToURLAsync(newurl)); std::string value = WaitUntilCookieNonEmpty(tab.get(), newurl, @@ -664,7 +664,7 @@ TEST_F(AutomationProxyTest, ConstrainedWindowTest) { file_util::AppendToPath(&filename, L"constrained_files"); file_util::AppendToPath(&filename, L"constrained_window.html"); - ASSERT_TRUE(tab->NavigateToURL(net_util::FilePathToFileURL(filename))); + ASSERT_TRUE(tab->NavigateToURL(net::FilePathToFileURL(filename))); int count; ASSERT_TRUE(tab->WaitForChildWindowCountToChange(0, &count, 5000)); @@ -698,7 +698,7 @@ TEST_F(AutomationProxyTest, CantEscapeByOnloadMoveto) { file_util::AppendToPath(&filename, L"constrained_files"); file_util::AppendToPath(&filename, L"constrained_window_onload_moveto.html"); - ASSERT_TRUE(tab->NavigateToURL(net_util::FilePathToFileURL(filename))); + ASSERT_TRUE(tab->NavigateToURL(net::FilePathToFileURL(filename))); int count; ASSERT_TRUE(tab->WaitForChildWindowCountToChange(0, &count, 5000)); diff --git a/chrome/test/page_cycler/page_cycler_test.cc b/chrome/test/page_cycler/page_cycler_test.cc index 421c665..b9a77bd 100644 --- a/chrome/test/page_cycler/page_cycler_test.cc +++ b/chrome/test/page_cycler/page_cycler_test.cc @@ -86,7 +86,7 @@ class PageCyclerTest : public UITest { file_util::AppendToPath(&test_path, L"page_cycler"); file_util::AppendToPath(&test_path, name); file_util::AppendToPath(&test_path, L"start.html"); - test_url = net_util::FilePathToFileURL(test_path); + test_url = net::FilePathToFileURL(test_path); } // run N iterations diff --git a/chrome/test/plugin/plugin_test.cpp b/chrome/test/plugin/plugin_test.cpp index c9f16c1..98a4300 100644 --- a/chrome/test/plugin/plugin_test.cpp +++ b/chrome/test/plugin/plugin_test.cpp @@ -114,7 +114,7 @@ class PluginTest : public UITest { PathService::Get(chrome::DIR_TEST_DATA, &path); file_util::AppendToPath(&path, L"plugin"); file_util::AppendToPath(&path, test_case); - return net_util::FilePathToFileURL(path); + return net::FilePathToFileURL(path); } // Waits for the test case to finish. diff --git a/chrome/test/selenium/selenium_test.cc b/chrome/test/selenium/selenium_test.cc index 043def8..5db6bb1 100644 --- a/chrome/test/selenium/selenium_test.cc +++ b/chrome/test/selenium/selenium_test.cc @@ -125,7 +125,7 @@ class SeleniumTest : public UITest { file_util::AppendToPath(&test_path, L"core"); file_util::AppendToPath(&test_path, L"TestRunner.html"); - GURL test_url(net_util::FilePathToFileURL(test_path)); + GURL test_url(net::FilePathToFileURL(test_path)); scoped_ptr<TabProxy> tab(GetActiveTab()); tab->NavigateToURL(test_url); diff --git a/chrome/test/tab_switching/tab_switching_test.cc b/chrome/test/tab_switching/tab_switching_test.cc index f2c572b..fb16816 100644 --- a/chrome/test/tab_switching/tab_switching_test.cc +++ b/chrome/test/tab_switching/tab_switching_test.cc @@ -148,7 +148,7 @@ class TabSwitchingUITest : public UITest { file_name += files[i]; file_name += file_util::kPathSeparator; file_name += L"index.html"; - browser_proxy_->AppendTab(net_util::FilePathToFileURL(file_name)); + browser_proxy_->AppendTab(net::FilePathToFileURL(file_name)); number_of_new_tabs_opened++; } diff --git a/chrome/test/ui/layout_plugin_uitest.cpp b/chrome/test/ui/layout_plugin_uitest.cpp index 1a3e973..5743580 100644 --- a/chrome/test/ui/layout_plugin_uitest.cpp +++ b/chrome/test/ui/layout_plugin_uitest.cpp @@ -57,7 +57,7 @@ TEST_F(LayoutPluginTester, UnloadNoCrash) { std::wstring path; PathService::Get(chrome::DIR_TEST_DATA, &path); file_util::AppendToPath(&path, L"npapi/layout_test_plugin.html"); - NavigateToURL(net_util::FilePathToFileURL(path)); + NavigateToURL(net::FilePathToFileURL(path)); std::wstring title; TabProxy* tab = GetActiveTab(); diff --git a/chrome/test/ui/npapi_uitest.cpp b/chrome/test/ui/npapi_uitest.cpp index cf81db6..bd292e6 100644 --- a/chrome/test/ui/npapi_uitest.cpp +++ b/chrome/test/ui/npapi_uitest.cpp @@ -101,7 +101,7 @@ protected: PathService::Get(chrome::DIR_TEST_DATA, &path); file_util::AppendToPath(&path, L"npapi"); file_util::AppendToPath(&path, test_case); - return net_util::FilePathToFileURL(path); + return net::FilePathToFileURL(path); } // Waits for the test case to finish. diff --git a/net/base/cookie_monster.cc b/net/base/cookie_monster.cc index 0483acb..b8dd8e7 100644 --- a/net/base/cookie_monster.cc +++ b/net/base/cookie_monster.cc @@ -88,7 +88,10 @@ #define COOKIE_DLOG(severity) DLOG_IF(INFO, 0) #endif -/*static*/ bool CookieMonster::enable_file_scheme_ = false; +namespace net { + +// static +bool CookieMonster::enable_file_scheme_ = false; // static void CookieMonster::EnableFileScheme() { @@ -266,7 +269,7 @@ static bool GetCookieDomainKey(const GURL& url, // domain=.my.domain.com -- for compatibility we do the same here. Firefox // also treats domain=.....my.domain.com like domain=.my.domain.com, but // neither IE nor Safari do this, and we don't either. - std::string cookie_domain(net_util::CanonicalizeHost(pc.Domain(), NULL)); + std::string cookie_domain(net::CanonicalizeHost(pc.Domain(), NULL)); if (cookie_domain.empty()) return false; if (cookie_domain[0] != '.') @@ -1041,3 +1044,5 @@ std::string CookieMonster::CanonicalCookie::DebugString() const { name_.c_str(), value_.c_str(), path_.c_str(), creation_date_.ToTimeT()); } + +} // namespace diff --git a/net/base/cookie_monster.h b/net/base/cookie_monster.h index cf7f2a6..cb76655 100644 --- a/net/base/cookie_monster.h +++ b/net/base/cookie_monster.h @@ -43,6 +43,8 @@ class GURL; +namespace net { + // The cookie monster is the system for storing and retrieving cookies. It has // an in-memory list of all cookies, and synchronizes non-session cookies to an // optional permanent storage that implements the PersistentCookieStore @@ -328,4 +330,6 @@ class CookieMonster::PersistentCookieStore { DISALLOW_EVIL_CONSTRUCTORS(CookieMonster::PersistentCookieStore); }; +} // namespace net + #endif // NET_BASE_COOKIE_MONSTER_H__ diff --git a/net/base/cookie_monster_perftest.cc b/net/base/cookie_monster_perftest.cc index d5d93a7..83b6ee2 100644 --- a/net/base/cookie_monster_perftest.cc +++ b/net/base/cookie_monster_perftest.cc @@ -45,7 +45,7 @@ TEST(ParsedCookieTest, TestParseCookies) { std::string cookie(kCookieLine); PerfTimeLogger timer("Parsed_cookie_parse_cookies"); for (int i = 0; i < kNumCookies; ++i) { - CookieMonster::ParsedCookie pc(cookie); + net::CookieMonster::ParsedCookie pc(cookie); EXPECT_TRUE(pc.IsValid()); } timer.Done(); @@ -56,7 +56,7 @@ TEST(ParsedCookieTest, TestParseBigCookies) { cookie += kCookieLine; PerfTimeLogger timer("Parsed_cookie_parse_big_cookies"); for (int i = 0; i < kNumCookies; ++i) { - CookieMonster::ParsedCookie pc(cookie); + net::CookieMonster::ParsedCookie pc(cookie); EXPECT_TRUE(pc.IsValid()); } timer.Done(); @@ -65,7 +65,7 @@ TEST(ParsedCookieTest, TestParseBigCookies) { static const GURL kUrlGoogle("http://www.google.izzle"); TEST(CookieMonsterTest, TestAddCookiesOnSingleHost) { - CookieMonster cm; + net::CookieMonster cm; std::vector<std::string> cookies; for (int i = 0; i < kNumCookies; i++) { cookies.push_back(StringPrintf("a%03d=b", i)); @@ -92,7 +92,7 @@ TEST(CookieMonsterTest, TestAddCookiesOnSingleHost) { } TEST(CookieMonsterTest, TestAddCookieOnManyHosts) { - CookieMonster cm; + net::CookieMonster cm; std::string cookie(kCookieLine); std::vector<GURL> gurls; // just wanna have ffffuunnn for (int i = 0; i < kNumCookies; ++i) { diff --git a/net/base/cookie_monster_unittest.cc b/net/base/cookie_monster_unittest.cc index fbe1019..484f661 100644 --- a/net/base/cookie_monster_unittest.cc +++ b/net/base/cookie_monster_unittest.cc @@ -46,7 +46,7 @@ namespace { TEST(ParsedCookieTest, TestBasic) { - CookieMonster::ParsedCookie pc("a=b"); + net::CookieMonster::ParsedCookie pc("a=b"); EXPECT_TRUE(pc.IsValid()); EXPECT_FALSE(pc.IsSecure()); EXPECT_EQ(pc.Name(), "a"); @@ -54,7 +54,7 @@ TEST(ParsedCookieTest, TestBasic) { } TEST(ParsedCookieTest, TestQuoted) { - CookieMonster::ParsedCookie pc("a=\"b=;\"; path=\"/\""); + net::CookieMonster::ParsedCookie pc("a=\"b=;\"; path=\"/\""); EXPECT_TRUE(pc.IsValid()); EXPECT_FALSE(pc.IsSecure()); EXPECT_TRUE(pc.HasPath()); @@ -67,7 +67,7 @@ TEST(ParsedCookieTest, TestQuoted) { } TEST(ParsedCookieTest, TestNameless) { - CookieMonster::ParsedCookie pc("BLAHHH; path=/; secure;"); + net::CookieMonster::ParsedCookie pc("BLAHHH; path=/; secure;"); EXPECT_TRUE(pc.IsValid()); EXPECT_TRUE(pc.IsSecure()); EXPECT_TRUE(pc.HasPath()); @@ -77,7 +77,7 @@ TEST(ParsedCookieTest, TestNameless) { } TEST(ParsedCookieTest, TestAttributeCase) { - CookieMonster::ParsedCookie pc("BLAHHH; Path=/; sECuRe; httpONLY"); + net::CookieMonster::ParsedCookie pc("BLAHHH; Path=/; sECuRe; httpONLY"); EXPECT_TRUE(pc.IsValid()); EXPECT_TRUE(pc.IsSecure()); EXPECT_TRUE(pc.IsHttpOnly()); @@ -88,7 +88,7 @@ TEST(ParsedCookieTest, TestAttributeCase) { } TEST(ParsedCookieTest, TestDoubleQuotedNameless) { - CookieMonster::ParsedCookie pc("\"BLA\\\"HHH\"; path=/; secure;"); + net::CookieMonster::ParsedCookie pc("\"BLA\\\"HHH\"; path=/; secure;"); EXPECT_TRUE(pc.IsValid()); EXPECT_TRUE(pc.IsSecure()); EXPECT_TRUE(pc.HasPath()); @@ -98,21 +98,21 @@ TEST(ParsedCookieTest, TestDoubleQuotedNameless) { } TEST(ParsedCookieTest, QuoteOffTheEnd) { - CookieMonster::ParsedCookie pc("a=\"B"); + net::CookieMonster::ParsedCookie pc("a=\"B"); EXPECT_TRUE(pc.IsValid()); EXPECT_EQ(pc.Name(), "a"); EXPECT_EQ(pc.Value(), "\"B"); } TEST(ParsedCookieTest, MissingName) { - CookieMonster::ParsedCookie pc("=ABC"); + net::CookieMonster::ParsedCookie pc("=ABC"); EXPECT_TRUE(pc.IsValid()); EXPECT_EQ(pc.Name(), ""); EXPECT_EQ(pc.Value(), "ABC"); } TEST(ParsedCookieTest, MissingValue) { - CookieMonster::ParsedCookie pc("ABC=; path = /wee"); + net::CookieMonster::ParsedCookie pc("ABC=; path = /wee"); EXPECT_TRUE(pc.IsValid()); EXPECT_EQ(pc.Name(), "ABC"); EXPECT_EQ(pc.Value(), ""); @@ -121,7 +121,7 @@ TEST(ParsedCookieTest, MissingValue) { } TEST(ParsedCookieTest, Whitespace) { - CookieMonster::ParsedCookie pc(" A = BC ;secure;;; httponly"); + net::CookieMonster::ParsedCookie pc(" A = BC ;secure;;; httponly"); EXPECT_TRUE(pc.IsValid()); EXPECT_EQ(pc.Name(), "A"); EXPECT_EQ(pc.Value(), "BC"); @@ -131,7 +131,7 @@ TEST(ParsedCookieTest, Whitespace) { EXPECT_TRUE(pc.IsHttpOnly()); } TEST(ParsedCookieTest, MultipleEquals) { - CookieMonster::ParsedCookie pc(" A=== BC ;secure;;; httponly"); + net::CookieMonster::ParsedCookie pc(" A=== BC ;secure;;; httponly"); EXPECT_TRUE(pc.IsValid()); EXPECT_EQ(pc.Name(), "A"); EXPECT_EQ(pc.Value(), "== BC"); @@ -142,9 +142,9 @@ TEST(ParsedCookieTest, MultipleEquals) { } TEST(ParsedCookieTest, TrailingWhitespace) { - CookieMonster::ParsedCookie pc("ANCUUID=zohNumRKgI0oxyhSsV3Z7D; " - "expires=Sun, 18-Apr-2027 21:06:29 GMT; " - "path=/ ; "); + net::CookieMonster::ParsedCookie pc("ANCUUID=zohNumRKgI0oxyhSsV3Z7D; " + "expires=Sun, 18-Apr-2027 21:06:29 GMT; " + "path=/ ; "); EXPECT_TRUE(pc.IsValid()); EXPECT_EQ(pc.Name(), "ANCUUID"); EXPECT_TRUE(pc.HasExpires()); @@ -156,43 +156,43 @@ TEST(ParsedCookieTest, TrailingWhitespace) { TEST(ParsedCookieTest, TooManyPairs) { std::string blankpairs; - blankpairs.resize(CookieMonster::ParsedCookie::kMaxPairs - 1, ';'); + blankpairs.resize(net::CookieMonster::ParsedCookie::kMaxPairs - 1, ';'); - CookieMonster::ParsedCookie pc1(blankpairs + "secure"); + net::CookieMonster::ParsedCookie pc1(blankpairs + "secure"); EXPECT_TRUE(pc1.IsValid()); EXPECT_TRUE(pc1.IsSecure()); - CookieMonster::ParsedCookie pc2(blankpairs + ";secure"); + net::CookieMonster::ParsedCookie pc2(blankpairs + ";secure"); EXPECT_TRUE(pc2.IsValid()); EXPECT_FALSE(pc2.IsSecure()); } // TODO some better test cases for invalid cookies. TEST(ParsedCookieTest, InvalidWhitespace) { - CookieMonster::ParsedCookie pc(" "); + net::CookieMonster::ParsedCookie pc(" "); EXPECT_FALSE(pc.IsValid()); } TEST(ParsedCookieTest, InvalidTooLong) { std::string maxstr; - maxstr.resize(CookieMonster::ParsedCookie::kMaxCookieSize, 'a'); + maxstr.resize(net::CookieMonster::ParsedCookie::kMaxCookieSize, 'a'); - CookieMonster::ParsedCookie pc1(maxstr); + net::CookieMonster::ParsedCookie pc1(maxstr); EXPECT_TRUE(pc1.IsValid()); - CookieMonster::ParsedCookie pc2(maxstr + "A"); + net::CookieMonster::ParsedCookie pc2(maxstr + "A"); EXPECT_FALSE(pc2.IsValid()); } TEST(ParsedCookieTest, InvalidEmpty) { - CookieMonster::ParsedCookie pc(""); + net::CookieMonster::ParsedCookie pc(""); EXPECT_FALSE(pc.IsValid()); } TEST(ParsedCookieTest, EmbeddedTerminator) { - CookieMonster::ParsedCookie pc1("AAA=BB\0ZYX"); - CookieMonster::ParsedCookie pc2("AAA=BB\rZYX"); - CookieMonster::ParsedCookie pc3("AAA=BB\nZYX"); + net::CookieMonster::ParsedCookie pc1("AAA=BB\0ZYX"); + net::CookieMonster::ParsedCookie pc2("AAA=BB\rZYX"); + net::CookieMonster::ParsedCookie pc3("AAA=BB\nZYX"); EXPECT_TRUE(pc1.IsValid()); EXPECT_EQ(pc1.Name(), "AAA"); EXPECT_EQ(pc1.Value(), "BB"); @@ -213,7 +213,7 @@ static const char kValidDomainCookieLine[] = "A=B; path=/; domain=google.izzle"; TEST(CookieMonsterTest, DomainTest) { GURL url_google(kUrlGoogle); - CookieMonster cm; + net::CookieMonster cm; EXPECT_TRUE(cm.SetCookie(url_google, "A=B")); EXPECT_EQ(cm.GetCookies(url_google), "A=B"); EXPECT_TRUE(cm.SetCookie(url_google, "C=D; domain=.google.izzle")); @@ -244,7 +244,7 @@ TEST(CookieMonsterTest, DomainTest) { // FireFox recognizes domains containing trailing periods as valid. // IE and Safari do not. Assert the expected policy here. TEST(CookieMonsterTest, DomainWithTrailingDotTest) { - CookieMonster cm; + net::CookieMonster cm; GURL url_google("http://www.google.com"); EXPECT_FALSE(cm.SetCookie(url_google, "a=1; domain=.www.google.com.")); @@ -255,7 +255,7 @@ TEST(CookieMonsterTest, DomainWithTrailingDotTest) { // Test that cookies can bet set on higher level domains. // http://b/issue?id=896491 TEST(CookieMonsterTest, ValidSubdomainTest) { - CookieMonster cm; + net::CookieMonster cm; GURL url_abcd("http://a.b.c.d.com"); GURL url_bcd("http://b.c.d.com"); GURL url_cd("http://c.d.com"); @@ -284,7 +284,7 @@ TEST(CookieMonsterTest, ValidSubdomainTest) { // http://b/issue?id=896472 TEST(CookieMonsterTest, InvalidDomainTest) { { - CookieMonster cm; + net::CookieMonster cm; GURL url_foobar("http://foo.bar.com"); // More specific sub-domain than allowed. @@ -321,7 +321,7 @@ TEST(CookieMonsterTest, InvalidDomainTest) { // Make sure the cookie code hasn't gotten its subdomain string handling // reversed, missed a suffix check, etc. It's important here that the two // hosts below have the same domain + registry. - CookieMonster cm; + net::CookieMonster cm; GURL url_foocom("http://foo.com.com"); EXPECT_FALSE(cm.SetCookie(url_foocom, "a=1; domain=.foo.com.com.com")); EXPECT_EQ(cm.GetCookies(url_foocom), ""); @@ -333,16 +333,16 @@ TEST(CookieMonsterTest, InvalidDomainTest) { // http://b/issue?id=889898 TEST(CookieMonsterTest, DomainWithoutLeadingDotTest) { { // The omission of dot results in setting a domain cookie. - CookieMonster cm; - GURL url_hosted("http://manage.hosted.filefront.com"); - GURL url_filefront("http://www.filefront.com"); - EXPECT_TRUE(cm.SetCookie(url_hosted, "sawAd=1; domain=filefront.com")); - EXPECT_EQ(cm.GetCookies(url_hosted), "sawAd=1"); - EXPECT_EQ(cm.GetCookies(url_filefront), "sawAd=1"); + net::CookieMonster cm; + GURL url_hosted("http://manage.hosted.filefront.com"); + GURL url_filefront("http://www.filefront.com"); + EXPECT_TRUE(cm.SetCookie(url_hosted, "sawAd=1; domain=filefront.com")); + EXPECT_EQ(cm.GetCookies(url_hosted), "sawAd=1"); + EXPECT_EQ(cm.GetCookies(url_filefront), "sawAd=1"); } { // Even when the domains match exactly, don't consider it host cookie. - CookieMonster cm; + net::CookieMonster cm; GURL url("http://www.google.com"); EXPECT_TRUE(cm.SetCookie(url, "a=1; domain=www.google.com")); EXPECT_EQ(cm.GetCookies(url), "a=1"); @@ -354,7 +354,7 @@ TEST(CookieMonsterTest, DomainWithoutLeadingDotTest) { // Test that the domain specified in cookie string is treated case-insensitive // http://b/issue?id=896475. TEST(CookieMonsterTest, CaseInsensitiveDomainTest) { - CookieMonster cm; + net::CookieMonster cm; GURL url_google("http://www.google.com"); EXPECT_TRUE(cm.SetCookie(url_google, "a=1; domain=.GOOGLE.COM")); EXPECT_TRUE(cm.SetCookie(url_google, "b=2; domain=.wWw.gOOgLE.coM")); @@ -364,83 +364,83 @@ TEST(CookieMonsterTest, CaseInsensitiveDomainTest) { TEST(CookieMonsterTest, TestIpAddress) { GURL url_ip("http://1.2.3.4/weee"); { - CookieMonster cm; - EXPECT_TRUE(cm.SetCookie(url_ip, kValidCookieLine)); - EXPECT_EQ(cm.GetCookies(url_ip), "A=B"); + net::CookieMonster cm; + EXPECT_TRUE(cm.SetCookie(url_ip, kValidCookieLine)); + EXPECT_EQ(cm.GetCookies(url_ip), "A=B"); } { // IP addresses should not be able to set domain cookies. - CookieMonster cm; - EXPECT_FALSE(cm.SetCookie(url_ip, "b=2; domain=.1.2.3.4")); - EXPECT_FALSE(cm.SetCookie(url_ip, "c=3; domain=.3.4")); - EXPECT_EQ(cm.GetCookies(url_ip), ""); + net::CookieMonster cm; + EXPECT_FALSE(cm.SetCookie(url_ip, "b=2; domain=.1.2.3.4")); + EXPECT_FALSE(cm.SetCookie(url_ip, "c=3; domain=.3.4")); + EXPECT_EQ(cm.GetCookies(url_ip), ""); } } // Test host cookies, and setting of cookies on TLD. TEST(CookieMonsterTest, TestNonDottedAndTLD) { { - CookieMonster cm; - GURL url("http://com/"); - // Allow setting on "com", (but only as a host cookie). - EXPECT_TRUE(cm.SetCookie(url, "a=1")); - EXPECT_FALSE(cm.SetCookie(url, "b=2; domain=.com")); - EXPECT_FALSE(cm.SetCookie(url, "c=3; domain=com")); - EXPECT_EQ(cm.GetCookies(url), "a=1"); - // Make sure it doesn't show up for a normal .com, it should be a host - // not a domain cookie. - EXPECT_EQ(cm.GetCookies(GURL("http://hopefully-no-cookies.com/")), ""); - EXPECT_EQ(cm.GetCookies(GURL("http://.com/")), ""); + net::CookieMonster cm; + GURL url("http://com/"); + // Allow setting on "com", (but only as a host cookie). + EXPECT_TRUE(cm.SetCookie(url, "a=1")); + EXPECT_FALSE(cm.SetCookie(url, "b=2; domain=.com")); + EXPECT_FALSE(cm.SetCookie(url, "c=3; domain=com")); + EXPECT_EQ(cm.GetCookies(url), "a=1"); + // Make sure it doesn't show up for a normal .com, it should be a host + // not a domain cookie. + EXPECT_EQ(cm.GetCookies(GURL("http://hopefully-no-cookies.com/")), ""); + EXPECT_EQ(cm.GetCookies(GURL("http://.com/")), ""); } { // http://com. should be treated the same as http://com. - CookieMonster cm; - GURL url("http://com./index.html"); - EXPECT_TRUE(cm.SetCookie(url, "a=1")); - EXPECT_EQ(cm.GetCookies(url), "a=1"); - EXPECT_EQ(cm.GetCookies(GURL("http://hopefully-no-cookies.com./")), ""); + net::CookieMonster cm; + GURL url("http://com./index.html"); + EXPECT_TRUE(cm.SetCookie(url, "a=1")); + EXPECT_EQ(cm.GetCookies(url), "a=1"); + EXPECT_EQ(cm.GetCookies(GURL("http://hopefully-no-cookies.com./")), ""); } { // Should not be able to set host cookie from a subdomain. - CookieMonster cm; - GURL url("http://a.b"); - EXPECT_FALSE(cm.SetCookie(url, "a=1; domain=.b")); - EXPECT_FALSE(cm.SetCookie(url, "b=2; domain=b")); - EXPECT_EQ(cm.GetCookies(url), ""); + net::CookieMonster cm; + GURL url("http://a.b"); + EXPECT_FALSE(cm.SetCookie(url, "a=1; domain=.b")); + EXPECT_FALSE(cm.SetCookie(url, "b=2; domain=b")); + EXPECT_EQ(cm.GetCookies(url), ""); } { // Same test as above, but explicitly on a known TLD (com). - CookieMonster cm; - GURL url("http://google.com"); - EXPECT_FALSE(cm.SetCookie(url, "a=1; domain=.com")); - EXPECT_FALSE(cm.SetCookie(url, "b=2; domain=com")); - EXPECT_EQ(cm.GetCookies(url), ""); + net::CookieMonster cm; + GURL url("http://google.com"); + EXPECT_FALSE(cm.SetCookie(url, "a=1; domain=.com")); + EXPECT_FALSE(cm.SetCookie(url, "b=2; domain=com")); + EXPECT_EQ(cm.GetCookies(url), ""); } { // Make sure can't set cookie on TLD which is dotted. - CookieMonster cm; - GURL url("http://google.co.uk"); - EXPECT_FALSE(cm.SetCookie(url, "a=1; domain=.co.uk")); - EXPECT_FALSE(cm.SetCookie(url, "b=2; domain=.uk")); - EXPECT_EQ(cm.GetCookies(url), ""); - EXPECT_EQ(cm.GetCookies(GURL("http://something-else.co.uk")), ""); - EXPECT_EQ(cm.GetCookies(GURL("http://something-else.uk")), ""); + net::CookieMonster cm; + GURL url("http://google.co.uk"); + EXPECT_FALSE(cm.SetCookie(url, "a=1; domain=.co.uk")); + EXPECT_FALSE(cm.SetCookie(url, "b=2; domain=.uk")); + EXPECT_EQ(cm.GetCookies(url), ""); + EXPECT_EQ(cm.GetCookies(GURL("http://something-else.co.uk")), ""); + EXPECT_EQ(cm.GetCookies(GURL("http://something-else.uk")), ""); } { // Intranet URLs should only be able to set host cookies. - CookieMonster cm; - GURL url("http://b"); - EXPECT_TRUE(cm.SetCookie(url, "a=1")); - EXPECT_FALSE(cm.SetCookie(url, "b=2; domain=.b")); - EXPECT_FALSE(cm.SetCookie(url, "c=3; domain=b")); - EXPECT_EQ(cm.GetCookies(url), "a=1"); + net::CookieMonster cm; + GURL url("http://b"); + EXPECT_TRUE(cm.SetCookie(url, "a=1")); + EXPECT_FALSE(cm.SetCookie(url, "b=2; domain=.b")); + EXPECT_FALSE(cm.SetCookie(url, "c=3; domain=b")); + EXPECT_EQ(cm.GetCookies(url), "a=1"); } } // Test reading/writing cookies when the domain ends with a period, // as in "www.google.com." TEST(CookieMonsterTest, TestHostEndsWithDot) { - CookieMonster cm; + net::CookieMonster cm; GURL url("http://www.google.com"); GURL url_with_dot("http://www.google.com."); EXPECT_TRUE(cm.SetCookie(url, "a=1")); @@ -460,19 +460,19 @@ TEST(CookieMonsterTest, TestHostEndsWithDot) { } TEST(CookieMonsterTest, InvalidScheme) { - CookieMonster cm; + net::CookieMonster cm; EXPECT_FALSE(cm.SetCookie(GURL(kUrlFtp), kValidCookieLine)); } TEST(CookieMonsterTest, InvalidScheme_Read) { - CookieMonster cm; + net::CookieMonster cm; EXPECT_TRUE(cm.SetCookie(GURL(kUrlGoogle), kValidDomainCookieLine)); EXPECT_EQ(cm.GetCookies(GURL(kUrlFtp)), ""); } TEST(CookieMonsterTest, PathTest) { std::string url("http://www.google.izzle"); - CookieMonster cm; + net::CookieMonster cm; EXPECT_TRUE(cm.SetCookie(GURL(url), "A=B; path=/wee")); EXPECT_EQ(cm.GetCookies(GURL(url + "/wee")), "A=B"); EXPECT_EQ(cm.GetCookies(GURL(url + "/wee/")), "A=B"); @@ -489,11 +489,11 @@ TEST(CookieMonsterTest, PathTest) { TEST(CookieMonsterTest, HttpOnlyTest) { GURL url_google(kUrlGoogle); - CookieMonster cm; + net::CookieMonster cm; EXPECT_TRUE(cm.SetCookie(url_google, "A=B; httponly")); EXPECT_EQ(cm.GetCookies(url_google), ""); - EXPECT_EQ(cm.GetCookiesWithOptions(url_google, - CookieMonster::INCLUDE_HTTPONLY), "A=B"); + EXPECT_EQ(cm.GetCookiesWithOptions( + url_google, net::CookieMonster::INCLUDE_HTTPONLY), "A=B"); } // From: http://support.microsoft.com/kb/167296. @@ -506,12 +506,12 @@ static void UnixTimeToFileTime(time_t t, LPFILETIME pft) { } static uint64 UnixTimeToUTC(time_t t) { - FILETIME ftime; - LARGE_INTEGER li; - UnixTimeToFileTime(t, &ftime); - li.LowPart = ftime.dwLowDateTime; - li.HighPart = ftime.dwHighDateTime; - return li.QuadPart; + FILETIME ftime; + LARGE_INTEGER li; + UnixTimeToFileTime(t, &ftime); + li.LowPart = ftime.dwLowDateTime; + li.HighPart = ftime.dwHighDateTime; + return li.QuadPart; } TEST(CookieMonsterTest, TestCookieDateParsing) { @@ -592,7 +592,7 @@ TEST(CookieMonsterTest, TestCookieDateParsing) { Time parsed_time; for (int i = 0; i < arraysize(tests); ++i) { - parsed_time = CookieMonster::ParseCookieTime(tests[i].str); + parsed_time = net::CookieMonster::ParseCookieTime(tests[i].str); if (!tests[i].valid) { EXPECT_FALSE(!parsed_time.is_null()) << tests[i].str; continue; @@ -604,7 +604,7 @@ TEST(CookieMonsterTest, TestCookieDateParsing) { TEST(CookieMonsterTest, TestCookieDeletion) { GURL url_google(kUrlGoogle); - CookieMonster cm; + net::CookieMonster cm; // Create a session cookie. EXPECT_TRUE(cm.SetCookie(url_google, kValidCookieLine)); @@ -647,7 +647,7 @@ TEST(CookieMonsterTest, TestCookieDeletion) { TEST(CookieMonsterTest, TestCookieDeleteAll) { GURL url_google(kUrlGoogle); - CookieMonster cm; + net::CookieMonster cm; EXPECT_TRUE(cm.SetCookie(url_google, kValidCookieLine)); EXPECT_EQ(cm.GetCookies(url_google), "A=B"); @@ -661,7 +661,7 @@ TEST(CookieMonsterTest, TestCookieDeleteAll) { TEST(CookieMonsterTest, TestCookieDeleteAllCreatedAfterTimestamp) { GURL url_google(kUrlGoogle); - CookieMonster cm; + net::CookieMonster cm; Time now = Time::Now(); // Nothing has been added so nothing should be deleted. @@ -689,7 +689,7 @@ TEST(CookieMonsterTest, TestCookieDeleteAllCreatedAfterTimestamp) { TEST(CookieMonsterTest, TestCookieDeleteAllCreatedBetweenTimestamps) { GURL url_google(kUrlGoogle); - CookieMonster cm; + net::CookieMonster cm; Time now = Time::Now(); // Nothing has been added so nothing should be deleted. @@ -732,7 +732,7 @@ TEST(CookieMonsterTest, TestCookieDeleteAllCreatedBetweenTimestamps) { TEST(CookieMonsterTest, TestSecure) { GURL url_google(kUrlGoogle); GURL url_google_secure(kUrlGoogleSecure); - CookieMonster cm; + net::CookieMonster cm; EXPECT_TRUE(cm.SetCookie(url_google, "A=B")); EXPECT_EQ(cm.GetCookies(url_google), "A=B"); @@ -765,7 +765,7 @@ static int CountInString(const std::string& str, char c) { TEST(CookieMonsterTest, TestHostGarbageCollection) { GURL url_google(kUrlGoogle); - CookieMonster cm; + net::CookieMonster cm; // Add a bunch of cookies on a single host, should purge them. for (int i = 0; i < 101; i++) { std::string cookie = StringPrintf("a%03d=b", i); @@ -779,7 +779,7 @@ TEST(CookieMonsterTest, TestHostGarbageCollection) { } TEST(CookieMonsterTest, TestTotalGarbageCollection) { - CookieMonster cm; + net::CookieMonster cm; // Add a bunch of cookies on a bunch of host, some should get purged. for (int i = 0; i < 2000; ++i) { GURL url(StringPrintf("http://a%04d.izzle", i)); @@ -804,7 +804,7 @@ TEST(CookieMonsterTest, TestTotalGarbageCollection) { TEST(CookieMonsterTest, NetUtilCookieTest) { const GURL test_url(L"http://mojo.jojo.google.izzle/"); - CookieMonster cm; + net::CookieMonster cm; EXPECT_TRUE(cm.SetCookie(test_url, "foo=bar")); std::string value = cm.GetCookies(test_url); @@ -820,10 +820,11 @@ TEST(CookieMonsterTest, NetUtilCookieTest) { EXPECT_TRUE(result.find("y=2") != std::string::npos) << result; } -static bool FindAndDeleteCookie(CookieMonster& cm, const std::string& domain, +static bool FindAndDeleteCookie(net::CookieMonster& cm, + const std::string& domain, const std::string& name) { - CookieMonster::CookieList cookies = cm.GetAllCookies(); - for (CookieMonster::CookieList::iterator it = cookies.begin(); + net::CookieMonster::CookieList cookies = cm.GetAllCookies(); + for (net::CookieMonster::CookieList::iterator it = cookies.begin(); it != cookies.end(); ++it) if (it->first == domain && it->second.Name() == name) return cm.DeleteCookie(domain, it->second, false); @@ -833,7 +834,7 @@ static bool FindAndDeleteCookie(CookieMonster& cm, const std::string& domain, TEST(CookieMonsterTest, TestDeleteSingleCookie) { GURL url_google(kUrlGoogle); - CookieMonster cm; + net::CookieMonster cm; EXPECT_TRUE(cm.SetCookie(url_google, "A=B")); EXPECT_TRUE(cm.SetCookie(url_google, "C=D")); EXPECT_TRUE(cm.SetCookie(url_google, "E=F")); diff --git a/net/base/cookie_policy.cc b/net/base/cookie_policy.cc index f0b2199e..da859ee 100644 --- a/net/base/cookie_policy.cc +++ b/net/base/cookie_policy.cc @@ -27,10 +27,13 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#include "base/logging.h" #include "net/base/cookie_policy.h" + +#include "base/logging.h" #include "net/base/registry_controlled_domain.h" +namespace net { + bool CookiePolicy::CanGetCookies(const GURL& url, const GURL& policy_url) { switch (type_) { case CookiePolicy::ALLOW_ALL_COOKIES: @@ -53,7 +56,7 @@ bool CookiePolicy::CanSetCookie(const GURL& url, const GURL& policy_url) { if (policy_url.is_empty()) return true; // Empty policy URL should indicate a first-party request - return RegistryControlledDomainService::SameDomainOrHost(url, policy_url); + return net::RegistryControlledDomainService::SameDomainOrHost(url, policy_url); case CookiePolicy::BLOCK_ALL_COOKIES: return false; default: @@ -62,5 +65,7 @@ bool CookiePolicy::CanSetCookie(const GURL& url, const GURL& policy_url) { } } -CookiePolicy::CookiePolicy() - : type_(CookiePolicy::ALLOW_ALL_COOKIES) { }
\ No newline at end of file +CookiePolicy::CookiePolicy() : type_(CookiePolicy::ALLOW_ALL_COOKIES) { +} + +} // namespace net diff --git a/net/base/cookie_policy.h b/net/base/cookie_policy.h index 0523c95..6c7b0e6 100644 --- a/net/base/cookie_policy.h +++ b/net/base/cookie_policy.h @@ -32,6 +32,8 @@ #include "googleurl/src/gurl.h" +namespace net { + // The CookiePolicy class implements third-party cookie blocking. class CookiePolicy { public: @@ -69,4 +71,6 @@ class CookiePolicy { DISALLOW_EVIL_CONSTRUCTORS(CookiePolicy); }; +} // namespace net + #endif // NET_BASE_COOKIE_POLICY_H__ diff --git a/net/base/cookie_policy_unittest.cc b/net/base/cookie_policy_unittest.cc index e63ec24..7d2ce8e 100644 --- a/net/base/cookie_policy_unittest.cc +++ b/net/base/cookie_policy_unittest.cc @@ -49,7 +49,7 @@ class CookiePolicyTest : public testing::Test { } // namespace TEST_F(CookiePolicyTest, DefaultPolicyTest) { - CookiePolicy cp; + net::CookiePolicy cp; EXPECT_TRUE(cp.CanGetCookies(url_google_, url_google_)); EXPECT_TRUE(cp.CanGetCookies(url_google_, url_google_secure_)); EXPECT_TRUE(cp.CanGetCookies(url_google_, url_google_mail_)); @@ -64,8 +64,8 @@ TEST_F(CookiePolicyTest, DefaultPolicyTest) { } TEST_F(CookiePolicyTest, AllowAllCookiesTest) { - CookiePolicy cp; - cp.SetType(CookiePolicy::ALLOW_ALL_COOKIES); + net::CookiePolicy cp; + cp.SetType(net::CookiePolicy::ALLOW_ALL_COOKIES); EXPECT_TRUE(cp.CanGetCookies(url_google_, url_google_)); EXPECT_TRUE(cp.CanGetCookies(url_google_, url_google_secure_)); @@ -81,8 +81,8 @@ TEST_F(CookiePolicyTest, AllowAllCookiesTest) { } TEST_F(CookiePolicyTest, BlockThirdPartyCookiesTest) { - CookiePolicy cp; - cp.SetType(CookiePolicy::BLOCK_THIRD_PARTY_COOKIES); + net::CookiePolicy cp; + cp.SetType(net::CookiePolicy::BLOCK_THIRD_PARTY_COOKIES); EXPECT_TRUE(cp.CanGetCookies(url_google_, url_google_)); EXPECT_TRUE(cp.CanGetCookies(url_google_, url_google_secure_)); @@ -98,8 +98,8 @@ TEST_F(CookiePolicyTest, BlockThirdPartyCookiesTest) { } TEST_F(CookiePolicyTest, BlockAllCookiesTest) { - CookiePolicy cp; - cp.SetType(CookiePolicy::BLOCK_ALL_COOKIES); + net::CookiePolicy cp; + cp.SetType(net::CookiePolicy::BLOCK_ALL_COOKIES); EXPECT_FALSE(cp.CanGetCookies(url_google_, url_google_)); EXPECT_FALSE(cp.CanGetCookies(url_google_, url_google_secure_)); diff --git a/net/base/listen_socket_unittest.h b/net/base/listen_socket_unittest.h index 8160ade..243696c 100644 --- a/net/base/listen_socket_unittest.h +++ b/net/base/listen_socket_unittest.h @@ -99,7 +99,7 @@ class ListenSocketTester : InitializeCriticalSection(&lock_); semaphore_ = CreateSemaphore(NULL, 0, MAX_QUEUE_SIZE, NULL); server_ = NULL; - WinsockInit::Init(); + net::WinsockInit::Init(); thread_.reset(new Thread("socketio_test")); thread_->Start(); @@ -148,7 +148,7 @@ class ListenSocketTester : } thread_.reset(); loop_ = NULL; - WinsockInit::Cleanup(); + net::WinsockInit::Cleanup(); } void ReportAction(const ListenSocketTestAction& action) { diff --git a/net/base/net_module.cc b/net/base/net_module.cc index 7fa21f2..df5b883 100644 --- a/net/base/net_module.cc +++ b/net/base/net_module.cc @@ -29,6 +29,8 @@ #include "net/base/net_module.h" +namespace net { + static NetModule::ResourceProvider resource_provider; // static @@ -42,3 +44,5 @@ std::string NetModule::GetResource(int key) { ResourceProvider func = resource_provider; return func ? func(key) : std::string(); } + +} // namespace net diff --git a/net/base/net_module.h b/net/base/net_module.h index 37698cc..2ae3774 100644 --- a/net/base/net_module.h +++ b/net/base/net_module.h @@ -34,6 +34,8 @@ #include "base/basictypes.h" +namespace net { + // Defines global initializers and associated methods for the net module. // // The network module does not have direct access to the way application @@ -57,4 +59,6 @@ class NetModule { DISALLOW_IMPLICIT_CONSTRUCTORS(NetModule); }; +} // namespace net + #endif // NET_BASE_NET_MODULE_H__ diff --git a/net/base/net_util.cc b/net/base/net_util.cc index 61b5f87..e339838 100644 --- a/net/base/net_util.cc +++ b/net/base/net_util.cc @@ -660,7 +660,7 @@ std::wstring LocalizedDateTime(const FILETIME* filetime) { } // namespace -namespace net_util { +namespace net { GURL FilePathToFileURL(const std::wstring& file_path) { // Produce a URL like "file:///C:/foo" for a regular file, or @@ -992,4 +992,4 @@ bool IsPortAllowedByFtp(int port) { return IsPortAllowedByDefault(port); } -} // namespace net_util +} // namespace net diff --git a/net/base/net_util.h b/net/base/net_util.h index d0955a1..ab89182 100644 --- a/net/base/net_util.h +++ b/net/base/net_util.h @@ -39,7 +39,7 @@ class GURL; -namespace net_util { +namespace net { // Given the full path to a file name, creates a file: URL. The returned URL // may not be valid if the input is malformed. @@ -148,6 +148,6 @@ bool IsPortAllowedByDefault(int port); // restricted. bool IsPortAllowedByFtp(int port); -} // namespace net_util +} // namespace net #endif // NET_BASE_NET_UTIL_H__ diff --git a/net/base/net_util_unittest.cc b/net/base/net_util_unittest.cc index c0b1f7c..4c49c37 100644 --- a/net/base/net_util_unittest.cc +++ b/net/base/net_util_unittest.cc @@ -55,12 +55,12 @@ TEST(NetUtilTest, FileURLConversion) { std::wstring output; for (int i = 0; i < arraysize(round_trip_cases); i++) { // convert to the file URL - GURL file_url(net_util::FilePathToFileURL(round_trip_cases[i].file)); + GURL file_url(net::FilePathToFileURL(round_trip_cases[i].file)); EXPECT_EQ(std::wstring(round_trip_cases[i].url), UTF8ToWide(file_url.spec())); // Back to the filename. - EXPECT_TRUE(net_util::FileURLToFilePath(file_url, &output)); + EXPECT_TRUE(net::FileURLToFilePath(file_url, &output)); EXPECT_EQ(std::wstring(round_trip_cases[i].file), output); } @@ -76,7 +76,7 @@ TEST(NetUtilTest, FileURLConversion) { {L"C:\\foo\\bar.txt", L"file:\\\\\\c:/foo/bar.txt"}, }; for (int i = 0; i < arraysize(url_cases); i++) { - net_util::FileURLToFilePath(GURL(url_cases[i].url), &output); + net::FileURLToFilePath(GURL(url_cases[i].url), &output); EXPECT_EQ(std::wstring(url_cases[i].file), output); } @@ -84,7 +84,7 @@ TEST(NetUtilTest, FileURLConversion) { // they might be stored with wide characters const wchar_t utf8[] = L"file:///d:/Chinese/\xe6\x89\x80\xe6\x9c\x89\xe4\xb8\xad\xe6\x96\x87\xe7\xbd\x91\xe9\xa1\xb5.doc"; const wchar_t wide[] = L"D:\\Chinese\\\x6240\x6709\x4e2d\x6587\x7f51\x9875.doc"; - EXPECT_TRUE(net_util::FileURLToFilePath(GURL(utf8), &output)); + EXPECT_TRUE(net::FileURLToFilePath(GURL(utf8), &output)); EXPECT_EQ(std::wstring(wide), output); // Unfortunately, UTF8ToWide discards invalid UTF8 input. @@ -93,13 +93,13 @@ TEST(NetUtilTest, FileURLConversion) { // the input is preserved in UTF-8 const char invalid_utf8[] = "file:///d:/Blah/\xff.doc"; const wchar_t invalid_wide[] = L"D:\\Blah\\\xff.doc"; - EXPECT_TRUE(net_util::FileURLToFilePath( + EXPECT_TRUE(net::FileURLToFilePath( GURL(std::string(invalid_utf8)), &output)); EXPECT_EQ(std::wstring(invalid_wide), output); #endif // Test that if a file URL is malformed, we get a failure - EXPECT_FALSE(net_util::FileURLToFilePath(GURL("filefoobar"), &output)); + EXPECT_FALSE(net::FileURLToFilePath(GURL("filefoobar"), &output)); } // Just a bunch of fake headers. @@ -138,14 +138,14 @@ TEST(NetUtilTest, GetSpecificHeader) { // Test first with google_headers. for (size_t i = 0; i < arraysize(tests); ++i) { - std::wstring result = net_util::GetSpecificHeader(google_headers, - tests[i].header_name); + std::wstring result = net::GetSpecificHeader(google_headers, + tests[i].header_name); EXPECT_EQ(result, tests[i].expected); } // Test again with empty headers. for (size_t i = 0; i < arraysize(tests); ++i) { - std::wstring result = net_util::GetSpecificHeader(L"", tests[i].header_name); + std::wstring result = net::GetSpecificHeader(L"", tests[i].header_name); EXPECT_EQ(result, std::wstring()); } } @@ -171,18 +171,18 @@ TEST(NetUtilTest, GetHeaderParamValue) { // TODO(mpcomplete): add tests for other formats of headers. for (size_t i = 0; i < arraysize(tests); ++i) { - std::wstring header_value = net_util::GetSpecificHeader(google_headers, - tests[i].header_name); - std::wstring result = net_util::GetHeaderParamValue(header_value, - tests[i].param_name); + std::wstring header_value = + net::GetSpecificHeader(google_headers, tests[i].header_name); + std::wstring result = + net::GetHeaderParamValue(header_value, tests[i].param_name); EXPECT_EQ(result, tests[i].expected); } for (size_t i = 0; i < arraysize(tests); ++i) { - std::wstring header_value = net_util::GetSpecificHeader(L"", - tests[i].header_name); - std::wstring result = net_util::GetHeaderParamValue(header_value, - tests[i].param_name); + std::wstring header_value = + net::GetSpecificHeader(L"", tests[i].header_name); + std::wstring result = + net::GetHeaderParamValue(header_value, tests[i].param_name); EXPECT_EQ(result, std::wstring()); } } @@ -260,7 +260,7 @@ TEST(NetUtilTest, GetFileNameFromCD) { }; for (size_t i = 0; i < arraysize(tests); ++i) { EXPECT_EQ(tests[i].expected, - net_util::GetFileNameFromCD(tests[i].header_field)); + net::GetFileNameFromCD(tests[i].header_field)); } } @@ -548,10 +548,10 @@ TEST(NetUtilTest, IDNToUnicode) { for (int i = 0; i < arraysize(idn_cases); i++) { for (int j = 0; j < arraysize(languages); j++) { std::wstring output; - net_util::IDNToUnicode(idn_cases[i].input, - static_cast<int>(strlen(idn_cases[i].input)), - languages[j], - &output); + net::IDNToUnicode(idn_cases[i].input, + static_cast<int>(strlen(idn_cases[i].input)), + languages[j], + &output); std::wstring expected(idn_cases[i].unicode_allowed[j] ? idn_cases[i].unicode_output : ASCIIToWide(idn_cases[i].input)); @@ -561,10 +561,10 @@ TEST(NetUtilTest, IDNToUnicode) { } TEST(NetUtilTest, StripWWW) { - EXPECT_EQ(L"", net_util::StripWWW(L"")); - EXPECT_EQ(L"", net_util::StripWWW(L"www.")); - EXPECT_EQ(L"blah", net_util::StripWWW(L"www.blah")); - EXPECT_EQ(L"blah", net_util::StripWWW(L"blah")); + EXPECT_EQ(L"", net::StripWWW(L"")); + EXPECT_EQ(L"", net::StripWWW(L"www.")); + EXPECT_EQ(L"blah", net::StripWWW(L"www.blah")); + EXPECT_EQ(L"blah", net::StripWWW(L"blah")); } TEST(NetUtilTest, GetSuggestedFilename) { @@ -663,7 +663,7 @@ TEST(NetUtilTest, GetSuggestedFilename) { L"test.html"}, }; for (int i = 0; i < arraysize(test_cases); ++i) { - std::wstring filename = net_util::GetSuggestedFilename( + std::wstring filename = net::GetSuggestedFilename( GURL(test_cases[i].url), test_cases[i].content_disp_header, test_cases[i].default_filename); EXPECT_EQ(std::wstring(test_cases[i].expected_filename), filename); diff --git a/net/base/registry_controlled_domain.cc b/net/base/registry_controlled_domain.cc index b573d17..f0aad4c 100644 --- a/net/base/registry_controlled_domain.cc +++ b/net/base/registry_controlled_domain.cc @@ -48,6 +48,8 @@ #include "net/base/net_util.h" #include "net/base/registry_controlled_domain.h" +namespace net { + // This list of rules is used by unit tests and any other time that the main // resource file is not available. It should be kept exceedingly short to // avoid impacting unit test performance. @@ -73,8 +75,7 @@ std::string RegistryControlledDomainService::GetDomainAndRegistry( std::string RegistryControlledDomainService::GetDomainAndRegistry( const std::string& host) { bool is_ip_address; - const std::string canon_host(net_util::CanonicalizeHost(host, - &is_ip_address)); + const std::string canon_host(net::CanonicalizeHost(host, &is_ip_address)); if (canon_host.empty() || is_ip_address) return std::string(); return GetDomainAndRegistryImpl(canon_host); @@ -84,8 +85,7 @@ std::string RegistryControlledDomainService::GetDomainAndRegistry( std::string RegistryControlledDomainService::GetDomainAndRegistry( const std::wstring& host) { bool is_ip_address; - const std::string canon_host(net_util::CanonicalizeHost(host, - &is_ip_address)); + const std::string canon_host(net::CanonicalizeHost(host, &is_ip_address)); if (canon_host.empty() || is_ip_address) return std::string(); return GetDomainAndRegistryImpl(canon_host); @@ -133,8 +133,7 @@ size_t RegistryControlledDomainService::GetRegistryLength( const std::string& host, bool allow_unknown_registries) { bool is_ip_address; - const std::string canon_host(net_util::CanonicalizeHost(host, - &is_ip_address)); + const std::string canon_host(net::CanonicalizeHost(host, &is_ip_address)); if (canon_host.empty()) return std::string::npos; if (is_ip_address) @@ -148,8 +147,7 @@ size_t RegistryControlledDomainService::GetRegistryLength( const std::wstring& host, bool allow_unknown_registries) { bool is_ip_address; - const std::string canon_host(net_util::CanonicalizeHost(host, - &is_ip_address)); + const std::string canon_host(net::CanonicalizeHost(host, &is_ip_address)); if (canon_host.empty()) return std::string::npos; if (is_ip_address) @@ -349,3 +347,5 @@ bool RegistryControlledDomainService::StringSegment::operator<( } return (len_ < other.len_); } + +} // namespace net diff --git a/net/base/registry_controlled_domain.h b/net/base/registry_controlled_domain.h index 6b5adbc..72d7512 100644 --- a/net/base/registry_controlled_domain.h +++ b/net/base/registry_controlled_domain.h @@ -117,6 +117,8 @@ class GURL; +namespace net { + // This class is a singleton. class RegistryControlledDomainService { public: @@ -295,4 +297,6 @@ class RegistryControlledDomainService { DISALLOW_EVIL_CONSTRUCTORS(RegistryControlledDomainService); }; +} // namespace net + #endif // NET_BASE_REGISTRY_CONTROLLED_DOMAIN_H__ diff --git a/net/base/registry_controlled_domain_unittest.cc b/net/base/registry_controlled_domain_unittest.cc index cd74fc5..590f17b 100644 --- a/net/base/registry_controlled_domain_unittest.cc +++ b/net/base/registry_controlled_domain_unittest.cc @@ -37,17 +37,17 @@ class TestRegistryControlledDomainService; static TestRegistryControlledDomainService* test_instance_; class TestRegistryControlledDomainService : - public RegistryControlledDomainService { + public net::RegistryControlledDomainService { public: // Deletes the instance so a new one will be created. static void ResetInstance() { - RegistryControlledDomainService::ResetInstance(); + net::RegistryControlledDomainService::ResetInstance(); } // Sets and parses the given data. static void UseDomainData(const std::string& data) { - RegistryControlledDomainService::UseDomainData(data); + net::RegistryControlledDomainService::UseDomainData(data); } private: diff --git a/net/base/winsock_init.cc b/net/base/winsock_init.cc index e164b92..0bef93a 100644 --- a/net/base/winsock_init.cc +++ b/net/base/winsock_init.cc @@ -33,6 +33,8 @@ #include "base/singleton.h" +namespace net { + WinsockInit::WinsockInit() : did_init_(false) { did_init_ = Init(); } @@ -55,3 +57,5 @@ WinsockInit::~WinsockInit() { void EnsureWinsockInit() { Singleton<WinsockInit>::get(); } + +} // namespace net diff --git a/net/base/winsock_init.h b/net/base/winsock_init.h index 40d0557..6415bef 100644 --- a/net/base/winsock_init.h +++ b/net/base/winsock_init.h @@ -37,6 +37,8 @@ #ifndef NET_BASE_WINSOCK_INIT_H_ #define NET_BASE_WINSOCK_INIT_H_ +namespace net { + class WinsockInit { public: WinsockInit(); @@ -53,4 +55,6 @@ class WinsockInit { // destroyed at application exit. This may be called multiple times. void EnsureWinsockInit(); +} // namespace net + #endif // NET_BASE_WINSOCK_INIT_H_ diff --git a/net/base/x509_certificate.cc b/net/base/x509_certificate.cc index 445f128..e82f245 100644 --- a/net/base/x509_certificate.cc +++ b/net/base/x509_certificate.cc @@ -42,6 +42,8 @@ #pragma comment(lib, "crypt32.lib") +namespace net { + namespace { // Returns true if this cert fingerprint is the null (all zero) fingerprint. @@ -567,3 +569,5 @@ void X509Certificate::Policy::Deny(X509Certificate* cert) { allowed_.erase(cert->fingerprint()); denied_.insert(cert->fingerprint()); } + +} // namespace net diff --git a/net/base/x509_certificate.h b/net/base/x509_certificate.h index 217b331..3d0f779 100644 --- a/net/base/x509_certificate.h +++ b/net/base/x509_certificate.h @@ -27,8 +27,8 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#ifndef CHROME_COMMON_NET_X509_CERTIFICATE_H__ -#define CHROME_COMMON_NET_X509_CERTIFICATE_H__ +#ifndef NET_BASE_X509_CERTIFICATE_H_ +#define NET_BASE_X509_CERTIFICATE_H_ #include <windows.h> #include <wincrypt.h> @@ -42,6 +42,8 @@ class Pickle; +namespace net { + // X509Certificate represents an X.509 certificate used by SSL. class X509Certificate : public base::RefCountedThreadSafe<X509Certificate> { public: @@ -210,4 +212,6 @@ class X509Certificate : public base::RefCountedThreadSafe<X509Certificate> { DISALLOW_EVIL_CONSTRUCTORS(X509Certificate); }; -#endif // CHROME_COMMON_NET_X509_CERTIFICATE_H__ +} // namespace net + +#endif // NET_BASE_X509_CERTIFICATE_H_ diff --git a/net/http/http_transaction_winhttp.cc b/net/http/http_transaction_winhttp.cc index 6570b0d..1c0914b 100644 --- a/net/http/http_transaction_winhttp.cc +++ b/net/http/http_transaction_winhttp.cc @@ -1549,7 +1549,7 @@ void HttpTransactionWinHttp::PopulateAuthChallenge() { std::wstring::const_iterator space = find(auth_header.begin(), auth_header.end(), ' '); auth_info->scheme.assign(auth_header.begin(), space); - auth_info->realm = net_util::GetHeaderParamValue(auth_header, L"realm"); + auth_info->realm = GetHeaderParamValue(auth_header, L"realm"); // Now auth_info has been fully populated. Before we swap it with // response_.auth_challenge, update the auth cache key and remove any diff --git a/net/url_request/mime_sniffer_proxy.h b/net/url_request/mime_sniffer_proxy.h index af02dfd..9263863 100644 --- a/net/url_request/mime_sniffer_proxy.h +++ b/net/url_request/mime_sniffer_proxy.h @@ -68,7 +68,7 @@ class MimeSnifferProxy : public URLRequest::Delegate { } virtual void OnSSLCertificateError(URLRequest* request, int cert_error, - X509Certificate* cert) { + net::X509Certificate* cert) { delegate_->OnSSLCertificateError(request, cert_error, cert); } diff --git a/net/url_request/url_request.h b/net/url_request/url_request.h index 6740975..ed0eac1 100644 --- a/net/url_request/url_request.h +++ b/net/url_request/url_request.h @@ -144,7 +144,7 @@ class URLRequest { // indicating what's wrong with the certificate. virtual void OnSSLCertificateError(URLRequest* request, int cert_error, - X509Certificate* cert) { + net::X509Certificate* cert) { request->Cancel(); } diff --git a/net/url_request/url_request_context.h b/net/url_request/url_request_context.h index 63b8f45..e23a6ba 100644 --- a/net/url_request/url_request_context.h +++ b/net/url_request/url_request_context.h @@ -44,7 +44,9 @@ #include "net/base/cookie_policy.h" #include "net/http/http_transaction_factory.h" +namespace net { class CookieMonster; +} // Subclass to provide application-specific context for URLRequest instances. class URLRequestContext : @@ -62,10 +64,10 @@ class URLRequestContext : } // Gets the cookie store for this context. - CookieMonster* cookie_store() { return cookie_store_; } + net::CookieMonster* cookie_store() { return cookie_store_; } // Gets the cookie policy for this context. - CookiePolicy* cookie_policy() { return &cookie_policy_; } + net::CookiePolicy* cookie_policy() { return &cookie_policy_; } // Gets the FTP realm authentication cache for this context. net::AuthCache* ftp_auth_cache() { return &ftp_auth_cache_; } @@ -90,8 +92,8 @@ class URLRequestContext : // The following members are expected to be initialized and owned by // subclasses. net::HttpTransactionFactory* http_transaction_factory_; - CookieMonster* cookie_store_; - CookiePolicy cookie_policy_; + net::CookieMonster* cookie_store_; + net::CookiePolicy cookie_policy_; net::AuthCache ftp_auth_cache_; std::string user_agent_; bool is_off_the_record_; diff --git a/net/url_request/url_request_file_dir_job.cc b/net/url_request/url_request_file_dir_job.cc index 5845abf..a0fcf7a 100644 --- a/net/url_request/url_request_file_dir_job.cc +++ b/net/url_request/url_request_file_dir_job.cc @@ -131,11 +131,11 @@ void URLRequestFileDirJob::OnListFile(const WIN32_FIND_DATA& data) { // We wait to write out the header until we get the first file, so that we // can catch errors from DirectoryLister and show an error page. if (!wrote_header_) { - data_.append(net_util::GetDirectoryListingHeader(WideToUTF8(dir_path_))); + data_.append(net::GetDirectoryListingHeader(WideToUTF8(dir_path_))); wrote_header_ = true; } - data_.append(net_util::GetDirectoryListingEntry( + data_.append(net::GetDirectoryListingEntry( WideToUTF8(data.cFileName), data.dwFileAttributes, size, &local_time)); // TODO(darin): coalesce more? diff --git a/net/url_request/url_request_file_job.cc b/net/url_request/url_request_file_job.cc index e469047..a738b3a 100644 --- a/net/url_request/url_request_file_job.cc +++ b/net/url_request/url_request_file_job.cc @@ -75,7 +75,7 @@ DWORD WINAPI NetworkFileThread(LPVOID param) { URLRequestJob* URLRequestFileJob::Factory(URLRequest* request, const std::string& scheme) { std::wstring file_path; - if (net_util::FileURLToFilePath(request->url(), &file_path)) { + if (net::FileURLToFilePath(request->url(), &file_path)) { if (file_path[file_path.size() - 1] == file_util::kPathSeparator) { // Only directories have trailing slashes. return new URLRequestFileDirJob(request, file_path); @@ -343,7 +343,7 @@ bool URLRequestFileJob::IsRedirectResponse(GURL* location, if (!resolved) return false; - *location = net_util::FilePathToFileURL(new_path); + *location = net::FilePathToFileURL(new_path); *http_status_code = 301; return true; } diff --git a/net/url_request/url_request_ftp_job.cc b/net/url_request/url_request_ftp_job.cc index 7c9b5e8..23a726d 100644 --- a/net/url_request/url_request_ftp_job.cc +++ b/net/url_request/url_request_ftp_job.cc @@ -79,7 +79,7 @@ URLRequestJob* URLRequestFtpJob::Factory(URLRequest* request, DCHECK(scheme == "ftp"); if (request->url().has_port() && - !net_util::IsPortAllowedByFtp(request->url().IntPort())) + !net::IsPortAllowedByFtp(request->url().IntPort())) return new URLRequestErrorJob(request, net::ERR_UNSAFE_PORT); return new URLRequestFtpJob(request); @@ -396,7 +396,7 @@ void URLRequestFtpJob::OnFindFile(DWORD last_error) { // We don't know the encoding, and can't assume utf8, so pass the 8bit // directly to the browser for it to decide. - string file_entry = net_util::GetDirectoryListingEntry( + string file_entry = net::GetDirectoryListingEntry( find_data_.cFileName, find_data_.dwFileAttributes, size, &find_data_.ftLastWriteTime); WriteData(&file_entry, true); @@ -413,14 +413,14 @@ void URLRequestFtpJob::OnStartDirectoryTraversal() { state_ = GETTING_DIRECTORY; // Unescape the URL path and pass the raw 8bit directly to the browser. - string html = net_util::GetDirectoryListingHeader( + string html = net::GetDirectoryListingHeader( UnescapeURLComponent(request_->url().path(), UnescapeRule::SPACES | UnescapeRule::URL_SPECIAL_CHARS)); // If this isn't top level directory (i.e. the path isn't "/",) add a link to // the parent directory. if (request_->url().path().length() > 1) - html.append(net_util::GetDirectoryListingEntry("..", 0, 0, NULL)); + html.append(net::GetDirectoryListingEntry("..", 0, 0, NULL)); WriteData(&html, true); diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc index b0d2b8c..9e89faa 100644 --- a/net/url_request/url_request_http_job.cc +++ b/net/url_request/url_request_http_job.cc @@ -49,7 +49,7 @@ URLRequestJob* URLRequestHttpJob::Factory(URLRequest* request, const std::string& scheme) { DCHECK(scheme == "http" || scheme == "https"); - if (!net_util::IsPortAllowedByDefault(request->url().IntPort())) + if (!net::IsPortAllowedByDefault(request->url().IntPort())) return new URLRequestErrorJob(request, net::ERR_UNSAFE_PORT); if (!request->context() || @@ -486,7 +486,7 @@ void URLRequestHttpJob::AddExtraHeaders() { request_->policy_url())) { std::string cookies = request_->context()->cookie_store()-> GetCookiesWithOptions(request_->url(), - CookieMonster::INCLUDE_HTTPONLY); + net::CookieMonster::INCLUDE_HTTPONLY); if (!cookies.empty()) request_info_.extra_headers += "Cookie: " + cookies + "\r\n"; } diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc index 6f842bb..0ce504b 100644 --- a/net/url_request/url_request_unittest.cc +++ b/net/url_request/url_request_unittest.cc @@ -571,7 +571,7 @@ TEST(URLRequestTest, ResolveShortcutTest) { TestDelegate d; { - TestURLRequest r(net_util::FilePathToFileURL(lnk_path), &d); + TestURLRequest r(net::FilePathToFileURL(lnk_path), &d); r.Start(); EXPECT_TRUE(r.is_pending()); @@ -626,7 +626,7 @@ TEST(URLRequestTest, ContentTypeNormalizationTest) { TEST(URLRequestTest, FileDirCancelTest) { // Put in mock resource provider. - NetModule::SetResourceProvider(TestNetResourceProvider); + net::NetModule::SetResourceProvider(TestNetResourceProvider); TestDelegate d; { @@ -636,7 +636,7 @@ TEST(URLRequestTest, FileDirCancelTest) { file_util::AppendToPath(&file_path, L"data"); file_util::AppendToPath(&file_path, L""); - TestURLRequest req(net_util::FilePathToFileURL(file_path), &d); + TestURLRequest req(net::FilePathToFileURL(file_path), &d); req.Start(); EXPECT_TRUE(req.is_pending()); @@ -649,7 +649,7 @@ TEST(URLRequestTest, FileDirCancelTest) { #endif // Take out mock resource provider. - NetModule::SetResourceProvider(NULL); + net::NetModule::SetResourceProvider(NULL); } TEST(URLRequestTest, RestrictRedirects) { diff --git a/net/url_request/url_request_unittest.h b/net/url_request/url_request_unittest.h index 0ee0043..d8a8809 100644 --- a/net/url_request/url_request_unittest.h +++ b/net/url_request/url_request_unittest.h @@ -153,7 +153,7 @@ class TestDelegate : public URLRequest::Delegate { virtual void OnSSLCertificateError(URLRequest* request, int cert_error, - X509Certificate* cert) { + net::X509Certificate* cert) { // Ignore SSL errors, we test the server is started and shut it down by // performing GETs, no security restrictions should apply as we always want // these GETs to go through. diff --git a/webkit/glue/dom_operations_unittest.cc b/webkit/glue/dom_operations_unittest.cc index 3865ea7..72b25df 100644 --- a/webkit/glue/dom_operations_unittest.cc +++ b/webkit/glue/dom_operations_unittest.cc @@ -66,7 +66,7 @@ void DomOperationsTests::GetSavableResourceLinksForPage( const std::wstring& page_file_path, const std::set<GURL>& expected_resources_set) { // Convert local file path to file URL. - GURL file_url = net_util::FilePathToFileURL(page_file_path); + GURL file_url = net::FilePathToFileURL(page_file_path); // Load the test file. test_shell_->ResetTestController(); std::wstring file_wurl = ASCIIToWide(file_url.spec()); @@ -122,7 +122,7 @@ TEST_F(DomOperationsTests, GetSavableResourceLinksWithPageHasValidLinks) { std::wstring expected_frame_url = page_file_path; file_util::AppendToPath(&expected_frame_url, expected_frame_links[i]); expected_resources_set.insert( - net_util::FilePathToFileURL(expected_frame_url)); + net::FilePathToFileURL(expected_frame_url)); } file_util::AppendToPath(&page_file_path, std::wstring(L"youtube_1.htm")); @@ -145,7 +145,7 @@ TEST_F(DomOperationsTests, GetSavableResourceLinksWithPageHasInvalidLinks) { std::wstring expected_frame_url = page_file_path; file_util::AppendToPath(&expected_frame_url, expected_frame_links[i]); expected_resources_set.insert( - net_util::FilePathToFileURL(expected_frame_url)); + net::FilePathToFileURL(expected_frame_url)); } file_util::AppendToPath(&page_file_path, std::wstring(L"youtube_2.htm")); diff --git a/webkit/glue/dom_serializer_unittest.cc b/webkit/glue/dom_serializer_unittest.cc index afc4db0..b649032 100644 --- a/webkit/glue/dom_serializer_unittest.cc +++ b/webkit/glue/dom_serializer_unittest.cc @@ -263,7 +263,7 @@ bool IsMetaElement(const WebCore::Node* node, WebCore::String* charset_info) { TEST_F(DomSerializerTests, SerialzeHTMLDOMWithDocType) { std::wstring page_file_path = data_dir_; file_util::AppendToPath(&page_file_path, L"dom_serializer/youtube_1.htm"); - GURL file_url = net_util::FilePathToFileURL(page_file_path); + GURL file_url = net::FilePathToFileURL(page_file_path); ASSERT_TRUE(file_url.SchemeIsFile()); std::wstring page_url = ASCIIToWide(file_url.spec()); // Load the test file. @@ -295,7 +295,7 @@ TEST_F(DomSerializerTests, SerialzeHTMLDOMWithDocType) { TEST_F(DomSerializerTests, SerialzeHTMLDOMWithoutDocType) { std::wstring page_file_path = data_dir_; file_util::AppendToPath(&page_file_path, L"dom_serializer/youtube_2.htm"); - GURL file_url = net_util::FilePathToFileURL(page_file_path); + GURL file_url = net::FilePathToFileURL(page_file_path); ASSERT_TRUE(file_url.SchemeIsFile()); std::wstring page_url = ASCIIToWide(file_url.spec()); // Load the test file. @@ -332,7 +332,7 @@ TEST_F(DomSerializerTests, SerialzeXMLDocWithBuiltInEntities) { std::string orginal_contents; ASSERT_TRUE(file_util::ReadFileToString(page_file_path, &orginal_contents)); // Get file URL. - GURL file_url = net_util::FilePathToFileURL(page_file_path); + GURL file_url = net::FilePathToFileURL(page_file_path); ASSERT_TRUE(file_url.SchemeIsFile()); std::wstring page_url = ASCIIToWide(file_url.spec()); // Load the test file. @@ -354,7 +354,7 @@ TEST_F(DomSerializerTests, SerialzeHTMLDOMWithAddingMOTW) { std::string orginal_contents; ASSERT_TRUE(file_util::ReadFileToString(page_file_path, &orginal_contents)); // Get file URL. - GURL file_url = net_util::FilePathToFileURL(page_file_path); + GURL file_url = net::FilePathToFileURL(page_file_path); ASSERT_TRUE(file_url.SchemeIsFile()); std::wstring page_url = ASCIIToWide(file_url.spec()); // Make sure original contents does not have MOTW; @@ -385,7 +385,7 @@ TEST_F(DomSerializerTests, SerialzeHTMLDOMWithNoMetaCharsetInOriginalDoc) { std::wstring page_file_path = data_dir_; file_util::AppendToPath(&page_file_path, L"dom_serializer/youtube_1.htm"); // Get file URL. - GURL file_url = net_util::FilePathToFileURL(page_file_path); + GURL file_url = net::FilePathToFileURL(page_file_path); ASSERT_TRUE(file_url.SchemeIsFile()); std::wstring page_url = ASCIIToWide(file_url.spec()); // Load the test file. @@ -448,7 +448,7 @@ TEST_F(DomSerializerTests, std::wstring page_file_path = data_dir_; file_util::AppendToPath(&page_file_path, L"dom_serializer/youtube_2.htm"); // Get file URL. - GURL file_url = net_util::FilePathToFileURL(page_file_path); + GURL file_url = net::FilePathToFileURL(page_file_path); ASSERT_TRUE(file_url.SchemeIsFile()); std::wstring page_url = ASCIIToWide(file_url.spec()); // Load the test file. @@ -516,7 +516,7 @@ TEST_F(DomSerializerTests, SerialzeHTMLDOMWithEntitiesInText) { std::string orginal_contents; ASSERT_TRUE(file_util::ReadFileToString(page_file_path, &orginal_contents)); // Get file URL. - GURL file_url = net_util::FilePathToFileURL(page_file_path); + GURL file_url = net::FilePathToFileURL(page_file_path); ASSERT_TRUE(file_url.SchemeIsFile()); std::wstring page_url = ASCIIToWide(file_url.spec()); // Load the test file. @@ -557,7 +557,7 @@ TEST_F(DomSerializerTests, SerialzeHTMLDOMWithEntitiesInAttributeValue) { std::string orginal_contents; ASSERT_TRUE(file_util::ReadFileToString(page_file_path, &orginal_contents)); // Get file URL. - GURL file_url = net_util::FilePathToFileURL(page_file_path); + GURL file_url = net::FilePathToFileURL(page_file_path); ASSERT_TRUE(file_url.SchemeIsFile()); std::wstring page_url = ASCIIToWide(file_url.spec()); // Load the test file. @@ -598,11 +598,11 @@ TEST_F(DomSerializerTests, SerialzeHTMLDOMWithBaseTag) { std::wstring page_file_path = data_dir_; file_util::AppendToPath(&page_file_path, L"dom_serializer\\"); // Get page dir URL which is base URL of this file. - GURL path_dir_url = net_util::FilePathToFileURL(page_file_path); + GURL path_dir_url = net::FilePathToFileURL(page_file_path); // Get file path. file_util::AppendToPath(&page_file_path, L"html_doc_has_base_tag.htm"); // Get file URL. - GURL file_url = net_util::FilePathToFileURL(page_file_path); + GURL file_url = net::FilePathToFileURL(page_file_path); ASSERT_TRUE(file_url.SchemeIsFile()); std::wstring page_url = ASCIIToWide(file_url.spec()); // Load the test file. diff --git a/webkit/glue/multipart_response_delegate.cc b/webkit/glue/multipart_response_delegate.cc index e9cc258..c44f6b9 100644 --- a/webkit/glue/multipart_response_delegate.cc +++ b/webkit/glue/multipart_response_delegate.cc @@ -192,10 +192,8 @@ bool MultipartResponseDelegate::ParseHeaders() { // Create a ResourceResponse based on the original set of headers + the // replacement headers. We only replace the same few headers that gecko // does. See netwerk/streamconv/converters/nsMultiMixedConv.cpp. - std::string mime_type = net_util::GetSpecificHeader(headers, - "content-type"); - std::string charset = net_util::GetHeaderParamValue(mime_type, - "charset"); + std::string mime_type = net::GetSpecificHeader(headers, "content-type"); + std::string charset = net::GetHeaderParamValue(mime_type, "charset"); WebCore::ResourceResponse response(original_response_.url(), webkit_glue::StdStringToString(mime_type.c_str()), -1, @@ -224,7 +222,7 @@ bool MultipartResponseDelegate::ParseHeaders() { }; for (int i = 0; i < arraysize(replace_headers); ++i) { std::string name(replace_headers[i]); - std::string value = net_util::GetSpecificHeader(headers, name); + std::string value = net::GetSpecificHeader(headers, name); if (!value.empty()) { response.setHTTPHeaderField(webkit_glue::StdStringToString(name.c_str()), webkit_glue::StdStringToString(value.c_str())); diff --git a/webkit/glue/resource_handle_win.cc b/webkit/glue/resource_handle_win.cc index f309274..f0c4940 100644 --- a/webkit/glue/resource_handle_win.cc +++ b/webkit/glue/resource_handle_win.cc @@ -165,7 +165,7 @@ static ResourceResponse MakeResourceResponse( if (info.headers) { std::string disp_val; if (info.headers->EnumerateHeader(NULL, "content-disposition", &disp_val)) { - suggested_filename = net_util::GetSuggestedFilename( + suggested_filename = net::GetSuggestedFilename( webkit_glue::KURLToGURL(kurl), disp_val, std::wstring()); } } @@ -552,8 +552,7 @@ void ResourceHandleInternal::OnReceivedResponse( std::string content_type; info.headers->EnumerateHeader(NULL, "content-type", &content_type); - std::string boundary = net_util::GetHeaderParamValue(content_type, - "boundary"); + std::string boundary = net::GetHeaderParamValue(content_type, "boundary"); TrimString(boundary, " \"", &boundary); // If there's no boundary, just handle the request normally. In the gecko // code, nsMultiMixedConv::OnStartRequest throws an exception. diff --git a/webkit/tools/test_shell/plugin_tests.cc b/webkit/tools/test_shell/plugin_tests.cc index bfde855..7f5be5f 100644 --- a/webkit/tools/test_shell/plugin_tests.cc +++ b/webkit/tools/test_shell/plugin_tests.cc @@ -54,7 +54,7 @@ class PluginTest : public TestShellTest { class RequestContext : public TestURLRequestContext { public: RequestContext() { - cookie_store_ = new CookieMonster(); + cookie_store_ = new net::CookieMonster(); } virtual ~RequestContext() { @@ -68,7 +68,7 @@ class PluginTest : public TestShellTest { void NavigateToURL(const std::wstring& test_url) { ASSERT_TRUE(file_util::PathExists(test_url)); - test_url_ = net_util::FilePathToFileURL(test_url); + test_url_ = net::FilePathToFileURL(test_url); test_shell_->LoadURL(test_url.c_str()); } diff --git a/webkit/tools/test_shell/test_shell_main.cc b/webkit/tools/test_shell/test_shell_main.cc index 0256fed..468ec36 100644 --- a/webkit/tools/test_shell/test_shell_main.cc +++ b/webkit/tools/test_shell/test_shell_main.cc @@ -174,7 +174,7 @@ int main(int argc, char* argv[]) if (layout_test_mode || parsed_command_line.HasSwitch(test_shell::kEnableFileCookies)) - CookieMonster::EnableFileScheme(); + net::CookieMonster::EnableFileScheme(); std::wstring cache_path = parsed_command_line.GetSwitchValue(test_shell::kCacheDir); @@ -192,7 +192,7 @@ int main(int argc, char* argv[]) icu_util::Initialize(); // Config the network module so it has access to a limited set of resources. - NetModule::SetResourceProvider(NetResourceProvider); + net::NetModule::SetResourceProvider(NetResourceProvider); INITCOMMONCONTROLSEX InitCtrlEx; diff --git a/webkit/tools/test_shell/test_shell_request_context.cc b/webkit/tools/test_shell/test_shell_request_context.cc index 0406e01..16282f2 100644 --- a/webkit/tools/test_shell/test_shell_request_context.cc +++ b/webkit/tools/test_shell/test_shell_request_context.cc @@ -45,7 +45,7 @@ TestShellRequestContext::TestShellRequestContext( void TestShellRequestContext::Init( const std::wstring& cache_path, net::HttpCache::Mode cache_mode) { - cookie_store_ = new CookieMonster(); + cookie_store_ = new net::CookieMonster(); user_agent_ = webkit_glue::GetDefaultUserAgent(); |