| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This is the browser side of the resource dispatcher, it receives requests | 5 // This is the browser side of the resource dispatcher, it receives requests |
| 6 // from the child process (i.e. [Renderer, Plugin, Worker]ProcessHost), and | 6 // from the child process (i.e. [Renderer, Plugin, Worker]ProcessHost), and |
| 7 // dispatches them to URLRequests. It then forwards the messages from the | 7 // dispatches them to URLRequests. It then forwards the messages from the |
| 8 // URLRequests back to the correct process for handling. | 8 // URLRequests back to the correct process for handling. |
| 9 // | 9 // |
| 10 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading | 10 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 void UnregisterDownloadedTempFile(int child_id, int request_id); | 255 void UnregisterDownloadedTempFile(int child_id, int request_id); |
| 256 | 256 |
| 257 // Needed for the sync IPC message dispatcher macros. | 257 // Needed for the sync IPC message dispatcher macros. |
| 258 bool Send(IPC::Message* message); | 258 bool Send(IPC::Message* message); |
| 259 | 259 |
| 260 // Controls if we launch or squash prefetch requests as they arrive | 260 // Controls if we launch or squash prefetch requests as they arrive |
| 261 // from renderers. | 261 // from renderers. |
| 262 static bool is_prefetch_enabled(); | 262 static bool is_prefetch_enabled(); |
| 263 static void set_is_prefetch_enabled(bool value); | 263 static void set_is_prefetch_enabled(bool value); |
| 264 | 264 |
| 265 // Controls whether third-party sub-content can pop-up HTTP basic auth |
| 266 // dialog boxes. |
| 267 bool allow_cross_origin_auth_prompt(); |
| 268 void set_allow_cross_origin_auth_prompt(bool value); |
| 269 |
| 265 // This does not take ownership of the observer. It is expected that the | 270 // This does not take ownership of the observer. It is expected that the |
| 266 // observer have a longer lifetime than the ResourceDispatcherHost. | 271 // observer have a longer lifetime than the ResourceDispatcherHost. |
| 267 void set_observer(Observer* observer) { observer_ = observer; } | 272 void set_observer(Observer* observer) { observer_ = observer; } |
| 268 | 273 |
| 269 private: | 274 private: |
| 270 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, | 275 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, |
| 271 TestBlockedRequestsProcessDies); | 276 TestBlockedRequestsProcessDies); |
| 272 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, | 277 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, |
| 273 IncrementOutstandingRequestsMemoryCost); | 278 IncrementOutstandingRequestsMemoryCost); |
| 274 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, | 279 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 int load_flags); | 426 int load_flags); |
| 422 | 427 |
| 423 // Sends the given notification on the UI thread. The RenderViewHost's | 428 // Sends the given notification on the UI thread. The RenderViewHost's |
| 424 // controller is used as the source. | 429 // controller is used as the source. |
| 425 template <class T> | 430 template <class T> |
| 426 static void NotifyOnUI(NotificationType type, | 431 static void NotifyOnUI(NotificationType type, |
| 427 int render_process_id, | 432 int render_process_id, |
| 428 int render_view_id, | 433 int render_view_id, |
| 429 T* detail); | 434 T* detail); |
| 430 | 435 |
| 436 // Relationship of resource being authenticated with the top level page. |
| 437 enum HttpAuthResourceType { |
| 438 HTTP_AUTH_RESOURCE_TOP, // Top-level page itself |
| 439 HTTP_AUTH_RESOURCE_SAME_DOMAIN, // Sub-content from same domain |
| 440 HTTP_AUTH_RESOURCE_BLOCKED_CROSS, // Blocked Sub-content from cross domain |
| 441 HTTP_AUTH_RESOURCE_ALLOWED_CROSS, // Allowed Sub-content per command line |
| 442 HTTP_AUTH_RESOURCE_LAST |
| 443 }; |
| 444 |
| 445 HttpAuthResourceType HttpAuthResourceTypeOf(net::URLRequest* request); |
| 446 |
| 431 PendingRequestList pending_requests_; | 447 PendingRequestList pending_requests_; |
| 432 | 448 |
| 433 // Collection of temp files downloaded for child processes via | 449 // Collection of temp files downloaded for child processes via |
| 434 // the download_to_file mechanism. We avoid deleting them until | 450 // the download_to_file mechanism. We avoid deleting them until |
| 435 // the client no longer needs them. | 451 // the client no longer needs them. |
| 436 typedef std::map<int, scoped_refptr<webkit_blob::DeletableFileReference> > | 452 typedef std::map<int, scoped_refptr<webkit_blob::DeletableFileReference> > |
| 437 DeletableFilesMap; // key is request id | 453 DeletableFilesMap; // key is request id |
| 438 typedef std::map<int, DeletableFilesMap> | 454 typedef std::map<int, DeletableFilesMap> |
| 439 RegisteredTempFiles; // key is child process id | 455 RegisteredTempFiles; // key is child process id |
| 440 RegisteredTempFiles registered_temp_files_; | 456 RegisteredTempFiles registered_temp_files_; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 // kAvgBytesPerOutstandingRequest) | 510 // kAvgBytesPerOutstandingRequest) |
| 495 int max_outstanding_requests_cost_per_process_; | 511 int max_outstanding_requests_cost_per_process_; |
| 496 | 512 |
| 497 // Used during IPC message dispatching so that the handlers can get a pointer | 513 // Used during IPC message dispatching so that the handlers can get a pointer |
| 498 // to the source of the message. | 514 // to the source of the message. |
| 499 ResourceMessageFilter* filter_; | 515 ResourceMessageFilter* filter_; |
| 500 | 516 |
| 501 Observer* observer_; | 517 Observer* observer_; |
| 502 | 518 |
| 503 static bool is_prefetch_enabled_; | 519 static bool is_prefetch_enabled_; |
| 520 bool allow_cross_origin_auth_prompt_; |
| 504 | 521 |
| 505 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHost); | 522 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHost); |
| 506 }; | 523 }; |
| 507 | 524 |
| 508 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_H_ | 525 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_H_ |
| OLD | NEW |