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

Side by Side Diff: chrome/common/resource_dispatcher.cc

Issue 55049: Add the ability to specify a default MIME type when loading a resource. We'l... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "chrome/common/resource_dispatcher.h" 7 #include "chrome/common/resource_dispatcher.h"
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 class IPCResourceLoaderBridge : public ResourceLoaderBridge { 43 class IPCResourceLoaderBridge : public ResourceLoaderBridge {
44 public: 44 public:
45 IPCResourceLoaderBridge(ResourceDispatcher* dispatcher, 45 IPCResourceLoaderBridge(ResourceDispatcher* dispatcher,
46 const std::string& method, 46 const std::string& method,
47 const GURL& url, 47 const GURL& url,
48 const GURL& policy_url, 48 const GURL& policy_url,
49 const GURL& referrer, 49 const GURL& referrer,
50 const std::string& frame_origin, 50 const std::string& frame_origin,
51 const std::string& main_frame_origin, 51 const std::string& main_frame_origin,
52 const std::string& headers, 52 const std::string& headers,
53 const std::string& default_mime_type,
53 int load_flags, 54 int load_flags,
54 int origin_pid, 55 int origin_pid,
55 ResourceType::Type resource_type, 56 ResourceType::Type resource_type,
56 uint32 request_context, 57 uint32 request_context,
57 int route_id); 58 int route_id);
58 virtual ~IPCResourceLoaderBridge(); 59 virtual ~IPCResourceLoaderBridge();
59 60
60 // ResourceLoaderBridge 61 // ResourceLoaderBridge
61 virtual void AppendDataToUpload(const char* data, int data_len); 62 virtual void AppendDataToUpload(const char* data, int data_len);
62 virtual void AppendFileRangeToUpload(const std::wstring& path, 63 virtual void AppendFileRangeToUpload(const std::wstring& path,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 97
97 IPCResourceLoaderBridge::IPCResourceLoaderBridge( 98 IPCResourceLoaderBridge::IPCResourceLoaderBridge(
98 ResourceDispatcher* dispatcher, 99 ResourceDispatcher* dispatcher,
99 const std::string& method, 100 const std::string& method,
100 const GURL& url, 101 const GURL& url,
101 const GURL& policy_url, 102 const GURL& policy_url,
102 const GURL& referrer, 103 const GURL& referrer,
103 const std::string& frame_origin, 104 const std::string& frame_origin,
104 const std::string& main_frame_origin, 105 const std::string& main_frame_origin,
105 const std::string& headers, 106 const std::string& headers,
107 const std::string& default_mime_type,
106 int load_flags, 108 int load_flags,
107 int origin_pid, 109 int origin_pid,
108 ResourceType::Type resource_type, 110 ResourceType::Type resource_type,
109 uint32 request_context, 111 uint32 request_context,
110 int route_id) 112 int route_id)
111 : peer_(NULL), 113 : peer_(NULL),
112 dispatcher_(dispatcher), 114 dispatcher_(dispatcher),
113 request_id_(-1), 115 request_id_(-1),
114 route_id_(route_id) { 116 route_id_(route_id) {
115 DCHECK(dispatcher_) << "no resource dispatcher"; 117 DCHECK(dispatcher_) << "no resource dispatcher";
116 request_.method = method; 118 request_.method = method;
117 request_.url = url; 119 request_.url = url;
118 request_.policy_url = policy_url; 120 request_.policy_url = policy_url;
119 request_.referrer = referrer; 121 request_.referrer = referrer;
120 request_.frame_origin = frame_origin; 122 request_.frame_origin = frame_origin;
121 request_.main_frame_origin = main_frame_origin; 123 request_.main_frame_origin = main_frame_origin;
122 request_.headers = headers; 124 request_.headers = headers;
125 request_.default_mime_type = default_mime_type;
123 request_.load_flags = load_flags; 126 request_.load_flags = load_flags;
124 request_.origin_pid = origin_pid; 127 request_.origin_pid = origin_pid;
125 request_.resource_type = resource_type; 128 request_.resource_type = resource_type;
126 request_.request_context = request_context; 129 request_.request_context = request_context;
127 130
128 #ifdef LOG_RESOURCE_REQUESTS 131 #ifdef LOG_RESOURCE_REQUESTS
129 url_ = url.possibly_invalid_spec(); 132 url_ = url.possibly_invalid_spec();
130 #endif 133 #endif
131 } 134 }
132 135
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 } 518 }
516 519
517 webkit_glue::ResourceLoaderBridge* ResourceDispatcher::CreateBridge( 520 webkit_glue::ResourceLoaderBridge* ResourceDispatcher::CreateBridge(
518 const std::string& method, 521 const std::string& method,
519 const GURL& url, 522 const GURL& url,
520 const GURL& policy_url, 523 const GURL& policy_url,
521 const GURL& referrer, 524 const GURL& referrer,
522 const std::string& frame_origin, 525 const std::string& frame_origin,
523 const std::string& main_frame_origin, 526 const std::string& main_frame_origin,
524 const std::string& headers, 527 const std::string& headers,
528 const std::string& default_mime_type,
525 int flags, 529 int flags,
526 int origin_pid, 530 int origin_pid,
527 ResourceType::Type resource_type, 531 ResourceType::Type resource_type,
528 uint32 request_context, 532 uint32 request_context,
529 int route_id) { 533 int route_id) {
530 return new webkit_glue::IPCResourceLoaderBridge(this, method, url, policy_url, 534 return new webkit_glue::IPCResourceLoaderBridge(this, method, url, policy_url,
531 referrer, frame_origin, 535 referrer, frame_origin,
532 main_frame_origin, headers, 536 main_frame_origin, headers,
537 default_mime_type,
533 flags, origin_pid, 538 flags, origin_pid,
534 resource_type, 539 resource_type,
535 request_context, route_id); 540 request_context, route_id);
536 } 541 }
537 542
538 bool ResourceDispatcher::IsResourceDispatcherMessage( 543 bool ResourceDispatcher::IsResourceDispatcherMessage(
539 const IPC::Message& message) { 544 const IPC::Message& message) {
540 switch (message.type()) { 545 switch (message.type()) {
541 case ViewMsg_Resource_DownloadProgress::ID: 546 case ViewMsg_Resource_DownloadProgress::ID:
542 case ViewMsg_Resource_UploadProgress::ID: 547 case ViewMsg_Resource_UploadProgress::ID:
543 case ViewMsg_Resource_ReceivedResponse::ID: 548 case ViewMsg_Resource_ReceivedResponse::ID:
544 case ViewMsg_Resource_ReceivedRedirect::ID: 549 case ViewMsg_Resource_ReceivedRedirect::ID:
545 case ViewMsg_Resource_DataReceived::ID: 550 case ViewMsg_Resource_DataReceived::ID:
546 case ViewMsg_Resource_RequestComplete::ID: 551 case ViewMsg_Resource_RequestComplete::ID:
547 return true; 552 return true;
548 553
549 default: 554 default:
550 break; 555 break;
551 } 556 }
552 557
553 return false; 558 return false;
554 } 559 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698