summaryrefslogtreecommitdiffstats
path: root/net/base/network_delegate.cc
Commit message (Collapse)AuthorAgeFilesLines
* Make original_response_headers parameter of ↵battre@chromium.org2012-10-201-1/+1
| | | | | | | | | | | NetworkDelegate::OnHeadersReceived const BUG=149890 TBR=tony@chromium.org,mnaganov@chromium.org,jochen@chromium.org Review URL: https://chromiumcodereview.appspot.com/10944013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@163111 0039d316-1c4b-4281-b951-d872f2087c98
* Add histograms for network activity, and total/cumulativetburkard@chromium.org2012-08-201-3/+3
| | | | | | | | histograms for cache/network activity. R=rvargas@chromium.org, mmenke@chromium.org Review URL: https://chromiumcodereview.appspot.com/10834313 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@152398 0039d316-1c4b-4281-b951-d872f2087c98
* Adding histograms showing fraction of page load times spent in the disk ↵tburkard@chromium.org2012-07-301-0/+6
| | | | | | | | | | cache, for full and partial page loads. R=mmenke@chromium.org, jam@chromium.org, willchan@chromium.org, brettw@chromium.org BUG=139210 Review URL: https://chromiumcodereview.appspot.com/10736066 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149007 0039d316-1c4b-4281-b951-d872f2087c98
* Adds NetworkDelegate::NotifyBeforeSocketStreamConnect()bashi@chromium.org2012-06-131-0/+9
| | | | | | | | | | | | | | | This function will be called before an WebSocket tries to connect. This function can do extra work such as policy checks to prevent the connect. ChromeNetworkDelegate implements the function to check URL blacklist. BUG=131046 TEST=net_unittests Review URL: https://chromiumcodereview.appspot.com/10541046 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@141816 0039d316-1c4b-4281-b951-d872f2087c98
* Introduce a delegate to avoid hardcoding "chrome-extension" in net/.joi@chromium.org2012-06-071-0/+5
| | | | | | | | | | | | | Also, deal with a couple of TODOs in the throttling code, and remove metrics we no longer need since we are no longer running field trials for this code. BUG=119760 Review URL: https://chromiumcodereview.appspot.com/10440119 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@141000 0039d316-1c4b-4281-b951-d872f2087c98
* Fix file access on Chrome for ChromeOS on Linuxgspencer@chromium.org2012-05-051-11/+15
| | | | | | | | | | | | | | | so that we can open files in the user's Downloads directory. Shouldn't affect actual ChromeOS or other platforms. BUG=chromium-os:29447 TEST=Ran on Linux, opened files from Downloads folder. Review URL: http://codereview.chromium.org/10068021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@135553 0039d316-1c4b-4281-b951-d872f2087c98
* Do cookie checks in NetworkDelegate instead of the URLRequest::Delegate.jochen@chromium.org2012-03-091-0/+19
| | | | | | | | | | | As a side effect, requests going through URLFetcher now also have to pass cookie checks. Requests from the URLFetcher can be optionally annotated with a render view, so the user can be notified about blocked cookies. This plumbing is done for the alternate nav url fetcher, and the template url fetcher. BUG=116322 TEST=manual/pyauto Review URL: https://chromiumcodereview.appspot.com/9572001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@125831 0039d316-1c4b-4281-b951-d872f2087c98
* Prevent callbacks after URLRequest/URLRequestJob have been ↵battre@chromium.org2012-01-131-3/+3
| | | | | | | | | | | | | | | | | | | | canceled/completed/killed. With this CL, URLRequestJobs notify their NetworkDelegate when they are being destroyed to insure that the NetworkDelegate does not access any of their variables or call callbacks. Also the WebRequest API does not execute any callbacks if they URLRequest has informed the API that the Request has been completed or canceled. Both cases could happen in rare race conditions. BUG=108968 TEST=no Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=117342 Review URL: http://codereview.chromium.org/9147018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117685 0039d316-1c4b-4281-b951-d872f2087c98
* base::Bind: Convert net::NetworkDelegate.jhawkins@chromium.org2011-12-011-10/+10
| | | | | | | | | | R=groby BUG=none TEST=none Review URL: http://codereview.chromium.org/8743019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112534 0039d316-1c4b-4281-b951-d872f2087c98
* Bocking onReceivedHeaders signal for webRequest APIbattre@chromium.org2011-10-051-0/+12
| | | | | | | | | | | | | | This is a new signal that allows extensions to - Modify/Delete cookies of HTTP responses before they are seen by the cookie monster. - Cancel requests based on the length or content type of the HTTP response. BUG=89118 TEST=no Review URL: http://codereview.chromium.org/7931026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@104091 0039d316-1c4b-4281-b951-d872f2087c98
* NetworkDelegate::OnAuthRequired can set or cancel auth, in addition to ↵cbentzel@chromium.org2011-10-031-3/+6
| | | | | | | | | | | | taking no action. BUG=32056 TEST=net_unittests Review URL: http://codereview.chromium.org/8100001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103801 0039d316-1c4b-4281-b951-d872f2087c98
* Begin CompletionCallback switchover.willchan@chromium.org2011-10-011-2/+2
| | | | | | | | | | | | | Rename CompletionCallback to OldCompletionCallback in preparation for introducing a new CompletionCallback based on base::Callback. Also renames other CompletionCallback types like CancelableCompletionCallback and TestCompletionCallback and CompletionCallbackImpl. All using sed with s/CompletionCallback/OldCompletionCallback/g. BUG=98719 TEST=none Review URL: http://codereview.chromium.org/8070013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103650 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 103360 - NetworkDelegate::OnAuthRequired can set authentication or ↵ddorwin@chromium.org2011-09-291-6/+3
| | | | | | | | | | | | | | | | cancel, in addition to observing. TBR=ananta@chromium.org BUG=32056 TEST=net_unittests Review URL: http://codereview.chromium.org/8037038 TBR=cbentzel@chromium.org Review URL: http://codereview.chromium.org/8082010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103372 0039d316-1c4b-4281-b951-d872f2087c98
* NetworkDelegate::OnAuthRequired can set authentication or cancel, in ↵cbentzel@chromium.org2011-09-291-3/+6
| | | | | | | | | | | | | addition to observing. TBR=ananta@chromium.org BUG=32056 TEST=net_unittests Review URL: http://codereview.chromium.org/8037038 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103360 0039d316-1c4b-4281-b951-d872f2087c98
* Add onAuthRequired signal to the webRequest APIjochen@chromium.org2011-08-031-0/+6
| | | | | | | | | | BUG=none TEST=api test Review URL: http://codereview.chromium.org/7538024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@95308 0039d316-1c4b-4281-b951-d872f2087c98
* Replace onRequestSent with onSendHeaders in webrequest APIbattre@chromium.org2011-07-141-10/+3
| | | | | | | | | | | | | | | This CL replaces the onRequestSent signal of the webrequest API with a new onSendHeader signal. The sequence is now: onBeforeRequest -> onBeforeSendHeaders -> onSendHeaders. This change allows us to completely remove the webrequest API from the network transaction layer and stay in the URL request layer. That solve the problem that the network layer may convert one URLRequest to multiple HTTP requests which should be transparent to the webrequest API. It also solves the problem that requests answered from the cache did not trigger an onRequestSent event. Given the choice of removing onRequestSent completely and replacing it with onSendHeaders, I chose the latter so that extensions can see the headers sent to the network after other extensions had a chance to modify them. BUG=no TEST=no Review URL: http://codereview.chromium.org/7353021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92584 0039d316-1c4b-4281-b951-d872f2087c98
* Moved OnBeforeHeadersSent of webRequest API to url_request_http_job.ccbattre@chromium.org2011-06-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | This CL moves the OnBeforeSendHeaders signal from net_http_transaction.cc and net_cache_transaction.cc to url_request_http_job.cc. We do this for several reasons: - deep in the http stack one URL Request can be split into several http requests (with different byte ranges). - We do not want to expose this implementation detail to extension authors. - It is not sufficient to submit only the first OnBeforeSendHeaders event to the extension: If the extension modifies the headers, this modification should apply to all http requests. - from an architectural perspective we do not want to go too deep in order to allow changing the network stack implementation without being limited by the published Extension API (needs to be backwards compatible) BUG=60101 TEST=no Review URL: http://codereview.chromium.org/7039010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90753 0039d316-1c4b-4281-b951-d872f2087c98
* Kill URLRequestJobTracker.willchan@chromium.org2011-05-221-0/+6
| | | | | | | | | | BUG=81160 TEST=none Review URL: http://codereview.chromium.org/7043007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86241 0039d316-1c4b-4281-b951-d872f2087c98
* Create a URLRequestJobFactory to replace the URLRequest globals.willchan@chromium.org2011-05-141-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | URLRequest::Interceptor and URLRequest::ProtocolFactory are globally registered. This causes a variety of problems. This provides a method for replacing them. It used to be the case that we used net::URLRequest::IsHandledProtocol()/net::URLRequest::IsHandledURL() to see if the request would be handled by Chrome, or deferred to an external protocol handler. This required that URLRequest be aware of all protocol handlers. We instead provide ProfileIOData::IsHandledProtocol(), which checks to see if there are any Chrome registered protocol handlers, and if not, checks the default ones in net::URLRequest. Note this doesn't work for custom handlers (registerProtocolHandler) because they are dynamic and profile-specific. We would have to add a member function to ProfileIOData and not use a global. This is problematic since we check ProfileIOData::IsHandledProtocol in the RenderViewContextMenu, which runs on the UI thread, whereas ProfileIOData lives on the IO thread. RenderViewContextMenu is using also using it synchronously, which makes it a pain to support. So, we don't support custom handlers in ProfileIOData::IsHandledProtocol(). This means that "save as" won't work for custom handlers. Seems ok for now. This also fixes the multiprofile/incognito bugs where if a profile registers a custom handler, and then a different profile / an incognito profile registers the same custom handler and then unregisters it, which globally unregisters it, so the original profile is now broken. By removing the use of the globals, we fix this. Also fixes a bunch of style guide violations in the ProtocolHandler/ProtocolHandlerRegistry code. This changelist replaces two existing URLRequest::ProtocolFactory uses: chrome-extension/user-script and custom handlers. Also improve the tests in ResourceDispatcherHost so we don't have to do as many NULL checks. Change the MockResourceContext to create a TestURLRequestContext. BUG=81979 TEST=none Review URL: http://codereview.chromium.org/6960006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85376 0039d316-1c4b-4281-b951-d872f2087c98
* Implemented RequestHeaders field in extraInfoSpec of webRequest APIbattre@chromium.org2011-05-131-2/+3
| | | | | | | | | BUG=60101 TEST=no Review URL: http://codereview.chromium.org/6931055 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85260 0039d316-1c4b-4281-b951-d872f2087c98
* Add a method for PAC script errors to the network delegate.jochen@chromium.org2011-05-031-0/+6
| | | | | | | | | | | Also add a wrapper class to avoid passing around raw NULL pointers, and a bridge so I can invoke the method from other than the IO thread BUG=48930 TEST=net unittests Review URL: http://codereview.chromium.org/6822026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83881 0039d316-1c4b-4281-b951-d872f2087c98
* Flesh out the onBeforeSendHeaders event a bit more. We now send thempcomplete@chromium.org2011-04-271-1/+7
| | | | | | | | | | | | | requestHeaders and allow the extension to modify them. I also changed the network delegate callbacks, so that they accept arguments beyond just a status code, and they do not outlive the object they are bound to. BUG=60101 TEST=automated Review URL: http://codereview.chromium.org/6899001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83246 0039d316-1c4b-4281-b951-d872f2087c98
* Implemented chrome.experimental.webRequest.onCompletedbattre@chromium.org2011-04-231-3/+2
| | | | | | | | | BUG=60101 TEST=run browser_tests Review URL: http://codereview.chromium.org/6883119 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@82793 0039d316-1c4b-4281-b951-d872f2087c98
* Implemented of base functionality of ↵battre@chromium.org2011-04-201-0/+8
| | | | | | | | | | | chrome.experimental.webRequest.onBeforeRedirect BUG=60101 TEST=execute browser tests Review URL: http://codereview.chromium.org/6882043 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@82317 0039d316-1c4b-4281-b951-d872f2087c98
* Implementation of chrome.experimental.webRequest.onRequestSentbattre@chromium.org2011-04-201-0/+7
| | | | | | | | | BUG=60101 TEST=browser_tests --gtest_filter='ExtensionWebRequestApiTest.WebRequestEvents' Review URL: http://codereview.chromium.org/6853014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@82308 0039d316-1c4b-4281-b951-d872f2087c98
* Allow extensions to redirect requests in onBeforeRequest.mpcomplete@chromium.org2011-04-151-5/+6
| | | | | | | | | | | BUG=60101 TEST=no Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=81479 Review URL: http://codereview.chromium.org/6677148 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81782 0039d316-1c4b-4281-b951-d872f2087c98
* Revert "Allow extensions to redirect requests in onBeforeRequest."mpcomplete@chromium.org2011-04-131-6/+5
| | | | | | | The change introduced a regression in the WebRequestEvents api test. TBR=mpcomplete git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81503 0039d316-1c4b-4281-b951-d872f2087c98
* Allow extensions to redirect requests in onBeforeRequest.mpcomplete@chromium.org2011-04-131-5/+6
| | | | | | | | | BUG=60101 TEST=no Review URL: http://codereview.chromium.org/6677148 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81479 0039d316-1c4b-4281-b951-d872f2087c98
* Add request_id to HttpRequestInfo and pass it to the NetworkDelegate for events.mpcomplete@chromium.org2011-03-301-4/+12
| | | | | | | | | | | | | | This lets us look up the request associated with an http transaction and send event details for the webRequest.onBeforeRequest extension event. I also hooked up the onBeforeRequest event for HTTP network and cache transactions so that they are separate from other requests. This lets us have the request header information. BUG=60101 TEST=no Review URL: http://codereview.chromium.org/6698009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79905 0039d316-1c4b-4281-b951-d872f2087c98
* Extends NetworkDelegate to avoid use of static_cast<> when handling ↵tony@chromium.org2011-03-101-0/+6
| | | | | | | | | | | | | | | | | | | | | RegisterProtocolHandler URLs. Currently we use a static_cast<> to convert a URLRequestContext into a ChromeURLRequestContext in a ProtocolFactory. However, ProtocolFactory is global and not all URLRequestContexts are instances of ChromeURLRequestContext, so this will always crash in certain circumstances (such as the one described in the TEST field). This change solves the problem by providing a MaybeCreateURLRequestJob() method in NetworkDelegate and then having the ProtocolHandlerRegistry::Factory() call it instead of casting. BUG=74063 TEST=Requesting a URL that has a registerProtocolHandler() from chrome://net-internals/#tests doesn't crash. Review URL: http://codereview.chromium.org/6592060 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77559 0039d316-1c4b-4281-b951-d872f2087c98
* Implement blocking for webRequest.onBeforeRequest extension event.mpcomplete@chromium.org2011-03-081-2/+4
| | | | | | | | | | | | | I did some measurements with a Release build of chrome, both manually and via the page cycler tests. It seems that a simple empty blocking event listener can add anywhere from a 1 to 30ms delay to request times, largely depending on how many requests are in the queue (when many requests come at once, the last ones to be processed by the extension are delayed the longest). From page cycler data (on my local machine), the average increase in page load time seems to be around 6ms. This is independent of total page load time (which makes sense). BUG=60101 TEST=covered by apitests Review URL: http://codereview.chromium.org/6574049 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77339 0039d316-1c4b-4281-b951-d872f2087c98
* Refactor of NetworkDelegate.willchan@chromium.org2011-02-241-0/+35
* Renames HttpNetworkDelegate to NetworkDelegate, moves to net/base/network_delegate.h. NOTE: this is a layering violation. wtc/eroman/willchan have agreed to this exception because the other solutions are less palatable. * Move the virtuals in NetworkDelegate to the private section. Use non-virtual public interface as the network stack's interface for notifying the delegate. Add sanity checking to the implmentation in NetworkDelegate. The private virtual interface is for consumers to receive notifications. * Remove ExtensionIOEventRouter from ChromeURLRequestContext, it is only used by the ChromeNetworkDelegate. Pass it directly to the ChromeNetworkDelegate's constructor. * Introduce a SystemNetworkDelegate. It does nothing right now. BUG=67232 TEST=none Review URL: http://codereview.chromium.org/6580002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75822 0039d316-1c4b-4281-b951-d872f2087c98