Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Side by Side Diff: content/browser/loader/resource_dispatcher_host_impl.cc

Issue 1269813002: Add a NavigationThrottle to the public content/ interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@navigation-api
Patch Set: Addressed comments Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading
6 6
7 #include "content/browser/loader/resource_dispatcher_host_impl.h" 7 #include "content/browser/loader/resource_dispatcher_host_impl.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <set> 10 #include <set>
(...skipping 23 matching lines...) Expand all
34 #include "content/browser/download/save_file_manager.h" 34 #include "content/browser/download/save_file_manager.h"
35 #include "content/browser/download/save_file_resource_handler.h" 35 #include "content/browser/download/save_file_resource_handler.h"
36 #include "content/browser/fileapi/chrome_blob_storage_context.h" 36 #include "content/browser/fileapi/chrome_blob_storage_context.h"
37 #include "content/browser/frame_host/navigation_request_info.h" 37 #include "content/browser/frame_host/navigation_request_info.h"
38 #include "content/browser/frame_host/navigator.h" 38 #include "content/browser/frame_host/navigator.h"
39 #include "content/browser/loader/async_resource_handler.h" 39 #include "content/browser/loader/async_resource_handler.h"
40 #include "content/browser/loader/cross_site_resource_handler.h" 40 #include "content/browser/loader/cross_site_resource_handler.h"
41 #include "content/browser/loader/detachable_resource_handler.h" 41 #include "content/browser/loader/detachable_resource_handler.h"
42 #include "content/browser/loader/mime_type_resource_handler.h" 42 #include "content/browser/loader/mime_type_resource_handler.h"
43 #include "content/browser/loader/navigation_resource_handler.h" 43 #include "content/browser/loader/navigation_resource_handler.h"
44 #include "content/browser/loader/navigation_resource_throttle.h"
44 #include "content/browser/loader/navigation_url_loader_impl_core.h" 45 #include "content/browser/loader/navigation_url_loader_impl_core.h"
45 #include "content/browser/loader/power_save_block_resource_throttle.h" 46 #include "content/browser/loader/power_save_block_resource_throttle.h"
46 #include "content/browser/loader/redirect_to_file_resource_handler.h" 47 #include "content/browser/loader/redirect_to_file_resource_handler.h"
47 #include "content/browser/loader/resource_message_filter.h" 48 #include "content/browser/loader/resource_message_filter.h"
48 #include "content/browser/loader/resource_request_info_impl.h" 49 #include "content/browser/loader/resource_request_info_impl.h"
49 #include "content/browser/loader/stream_resource_handler.h" 50 #include "content/browser/loader/stream_resource_handler.h"
50 #include "content/browser/loader/sync_resource_handler.h" 51 #include "content/browser/loader/sync_resource_handler.h"
51 #include "content/browser/loader/throttling_resource_handler.h" 52 #include "content/browser/loader/throttling_resource_handler.h"
52 #include "content/browser/loader/upload_data_stream_builder.h" 53 #include "content/browser/loader/upload_data_stream_builder.h"
53 #include "content/browser/renderer_host/render_view_host_delegate.h" 54 #include "content/browser/renderer_host/render_view_host_delegate.h"
(...skipping 1403 matching lines...) Expand 10 before | Expand all | Expand 10 after
1457 1458
1458 PluginService* plugin_service = nullptr; 1459 PluginService* plugin_service = nullptr;
1459 #if defined(ENABLE_PLUGINS) 1460 #if defined(ENABLE_PLUGINS)
1460 plugin_service = PluginService::GetInstance(); 1461 plugin_service = PluginService::GetInstance();
1461 #endif 1462 #endif
1462 // Insert a buffered event handler before the actual one. 1463 // Insert a buffered event handler before the actual one.
1463 handler.reset(new MimeTypeResourceHandler(handler.Pass(), this, 1464 handler.reset(new MimeTypeResourceHandler(handler.Pass(), this,
1464 plugin_service, request)); 1465 plugin_service, request));
1465 1466
1466 ScopedVector<ResourceThrottle> throttles; 1467 ScopedVector<ResourceThrottle> throttles;
1468
1469 // Add a NavigationResourceThrottle for navigations.
1470 // PlzNavigate: the throttle is unnecessary as communication with the UI
1471 // thread is handled by the NavigationURLloader.
1472 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
1473 switches::kEnableBrowserSideNavigation) &&
1474 IsResourceTypeFrame(resource_type)) {
1475 throttles.push_back(new NavigationResourceThrottle(request));
1476 }
1477
1467 if (delegate_) { 1478 if (delegate_) {
1468 delegate_->RequestBeginning(request, 1479 delegate_->RequestBeginning(request,
1469 resource_context, 1480 resource_context,
1470 appcache_service, 1481 appcache_service,
1471 resource_type, 1482 resource_type,
1472 &throttles); 1483 &throttles);
1473 } 1484 }
1474 1485
1475 if (request->has_upload()) { 1486 if (request->has_upload()) {
1476 // Block power save while uploading data. 1487 // Block power save while uploading data.
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after
2400 load_flags |= net::LOAD_PREFETCH; 2411 load_flags |= net::LOAD_PREFETCH;
2401 } 2412 }
2402 2413
2403 if (is_sync_load) 2414 if (is_sync_load)
2404 load_flags |= net::LOAD_IGNORE_LIMITS; 2415 load_flags |= net::LOAD_IGNORE_LIMITS;
2405 2416
2406 return load_flags; 2417 return load_flags;
2407 } 2418 }
2408 2419
2409 } // namespace content 2420 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698