OLD | NEW |
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 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" | 5 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/debug/trace_event.h" | 13 #include "base/debug/trace_event.h" |
14 #include "base/file_util.h" | 14 #include "base/file_util.h" |
15 #include "base/lazy_instance.h" | 15 #include "base/lazy_instance.h" |
16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
17 #include "base/memory/ref_counted_memory.h" | 17 #include "base/memory/ref_counted_memory.h" |
18 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
19 #include "base/message_loop.h" | 19 #include "base/message_loop.h" |
20 #include "base/path_service.h" | 20 #include "base/path_service.h" |
21 #include "base/string_util.h" | 21 #include "base/string_util.h" |
22 #include "chrome/browser/net/chrome_url_request_context.h" | |
23 #include "chrome/browser/ui/webui/shared_resources_data_source.h" | 22 #include "chrome/browser/ui/webui/shared_resources_data_source.h" |
24 #include "chrome/common/chrome_paths.h" | 23 #include "chrome/common/chrome_paths.h" |
25 #include "chrome/common/chrome_switches.h" | 24 #include "chrome/common/chrome_switches.h" |
26 #include "chrome/common/url_constants.h" | 25 #include "chrome/common/url_constants.h" |
27 #include "content/public/browser/browser_thread.h" | 26 #include "content/public/browser/browser_thread.h" |
28 #include "googleurl/src/url_util.h" | 27 #include "googleurl/src/url_util.h" |
29 #include "grit/platform_locale_settings.h" | 28 #include "grit/platform_locale_settings.h" |
30 #include "net/base/io_buffer.h" | 29 #include "net/base/io_buffer.h" |
31 #include "net/base/net_errors.h" | 30 #include "net/base/net_errors.h" |
32 #include "net/http/http_response_headers.h" | 31 #include "net/http/http_response_headers.h" |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 | 200 |
202 } // namespace | 201 } // namespace |
203 | 202 |
204 // URLRequestChromeJob is a net::URLRequestJob that manages running | 203 // URLRequestChromeJob is a net::URLRequestJob that manages running |
205 // chrome-internal resource requests asynchronously. | 204 // chrome-internal resource requests asynchronously. |
206 // It hands off URL requests to ChromeURLDataManager, which asynchronously | 205 // It hands off URL requests to ChromeURLDataManager, which asynchronously |
207 // calls back once the data is available. | 206 // calls back once the data is available. |
208 class URLRequestChromeJob : public net::URLRequestJob, | 207 class URLRequestChromeJob : public net::URLRequestJob, |
209 public base::SupportsWeakPtr<URLRequestChromeJob> { | 208 public base::SupportsWeakPtr<URLRequestChromeJob> { |
210 public: | 209 public: |
| 210 // |is_incognito| set when job is generated from an incognito profile. |
211 URLRequestChromeJob(net::URLRequest* request, | 211 URLRequestChromeJob(net::URLRequest* request, |
212 net::NetworkDelegate* network_delegate, | 212 net::NetworkDelegate* network_delegate, |
213 ChromeURLDataManagerBackend* backend); | 213 ChromeURLDataManagerBackend* backend, |
| 214 bool is_incognito); |
214 | 215 |
215 // net::URLRequestJob implementation. | 216 // net::URLRequestJob implementation. |
216 virtual void Start() OVERRIDE; | 217 virtual void Start() OVERRIDE; |
217 virtual void Kill() OVERRIDE; | 218 virtual void Kill() OVERRIDE; |
218 virtual bool ReadRawData(net::IOBuffer* buf, | 219 virtual bool ReadRawData(net::IOBuffer* buf, |
219 int buf_size, | 220 int buf_size, |
220 int* bytes_read) OVERRIDE; | 221 int* bytes_read) OVERRIDE; |
221 virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; | 222 virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; |
222 virtual void GetResponseInfo(net::HttpResponseInfo* info) OVERRIDE; | 223 virtual void GetResponseInfo(net::HttpResponseInfo* info) OVERRIDE; |
223 | 224 |
224 // Used to notify that the requested data's |mime_type| is ready. | 225 // Used to notify that the requested data's |mime_type| is ready. |
225 void MimeTypeAvailable(const std::string& mime_type); | 226 void MimeTypeAvailable(const std::string& mime_type); |
226 | 227 |
227 // Called by ChromeURLDataManager to notify us that the data blob is ready | 228 // Called by ChromeURLDataManager to notify us that the data blob is ready |
228 // for us. | 229 // for us. |
229 void DataAvailable(base::RefCountedMemory* bytes); | 230 void DataAvailable(base::RefCountedMemory* bytes); |
230 | 231 |
231 void set_mime_type(const std::string& mime_type) { | 232 void set_mime_type(const std::string& mime_type) { |
232 mime_type_ = mime_type; | 233 mime_type_ = mime_type; |
233 } | 234 } |
234 | 235 |
235 void set_allow_caching(bool allow_caching) { | 236 void set_allow_caching(bool allow_caching) { |
236 allow_caching_ = allow_caching; | 237 allow_caching_ = allow_caching; |
237 } | 238 } |
238 | 239 |
| 240 // Returns true when job was generated from an incognito profile. |
| 241 bool is_incognito() const { |
| 242 return is_incognito_; |
| 243 } |
| 244 |
239 private: | 245 private: |
240 virtual ~URLRequestChromeJob(); | 246 virtual ~URLRequestChromeJob(); |
241 | 247 |
242 // Helper for Start(), to let us start asynchronously. | 248 // Helper for Start(), to let us start asynchronously. |
243 // (This pattern is shared by most net::URLRequestJob implementations.) | 249 // (This pattern is shared by most net::URLRequestJob implementations.) |
244 void StartAsync(); | 250 void StartAsync(); |
245 | 251 |
246 // Do the actual copy from data_ (the data we're serving) into |buf|. | 252 // Do the actual copy from data_ (the data we're serving) into |buf|. |
247 // Separate from ReadRawData so we can handle async I/O. | 253 // Separate from ReadRawData so we can handle async I/O. |
248 void CompleteRead(net::IOBuffer* buf, int buf_size, int* bytes_read); | 254 void CompleteRead(net::IOBuffer* buf, int buf_size, int* bytes_read); |
249 | 255 |
250 // The actual data we're serving. NULL until it's been fetched. | 256 // The actual data we're serving. NULL until it's been fetched. |
251 scoped_refptr<base::RefCountedMemory> data_; | 257 scoped_refptr<base::RefCountedMemory> data_; |
252 // The current offset into the data that we're handing off to our | 258 // The current offset into the data that we're handing off to our |
253 // callers via the Read interfaces. | 259 // callers via the Read interfaces. |
254 int data_offset_; | 260 int data_offset_; |
255 | 261 |
256 // For async reads, we keep around a pointer to the buffer that | 262 // For async reads, we keep around a pointer to the buffer that |
257 // we're reading into. | 263 // we're reading into. |
258 scoped_refptr<net::IOBuffer> pending_buf_; | 264 scoped_refptr<net::IOBuffer> pending_buf_; |
259 int pending_buf_size_; | 265 int pending_buf_size_; |
260 std::string mime_type_; | 266 std::string mime_type_; |
261 | 267 |
262 // If true, set a header in the response to prevent it from being cached. | 268 // If true, set a header in the response to prevent it from being cached. |
263 bool allow_caching_; | 269 bool allow_caching_; |
264 | 270 |
| 271 // True when job is generated from an incognito profile. |
| 272 const bool is_incognito_; |
| 273 |
265 // The backend is owned by ChromeURLRequestContext and always outlives us. | 274 // The backend is owned by ChromeURLRequestContext and always outlives us. |
266 ChromeURLDataManagerBackend* backend_; | 275 ChromeURLDataManagerBackend* backend_; |
267 | 276 |
268 base::WeakPtrFactory<URLRequestChromeJob> weak_factory_; | 277 base::WeakPtrFactory<URLRequestChromeJob> weak_factory_; |
269 | 278 |
270 DISALLOW_COPY_AND_ASSIGN(URLRequestChromeJob); | 279 DISALLOW_COPY_AND_ASSIGN(URLRequestChromeJob); |
271 }; | 280 }; |
272 | 281 |
273 URLRequestChromeJob::URLRequestChromeJob(net::URLRequest* request, | 282 URLRequestChromeJob::URLRequestChromeJob(net::URLRequest* request, |
274 net::NetworkDelegate* network_delegate, | 283 net::NetworkDelegate* network_delegate, |
275 ChromeURLDataManagerBackend* backend) | 284 ChromeURLDataManagerBackend* backend, |
| 285 bool is_incognito) |
276 : net::URLRequestJob(request, network_delegate), | 286 : net::URLRequestJob(request, network_delegate), |
277 data_offset_(0), | 287 data_offset_(0), |
278 pending_buf_size_(0), | 288 pending_buf_size_(0), |
279 allow_caching_(true), | 289 allow_caching_(true), |
| 290 is_incognito_(is_incognito), |
280 backend_(backend), | 291 backend_(backend), |
281 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { | 292 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { |
282 DCHECK(backend); | 293 DCHECK(backend); |
283 } | 294 } |
284 | 295 |
285 URLRequestChromeJob::~URLRequestChromeJob() { | 296 URLRequestChromeJob::~URLRequestChromeJob() { |
286 CHECK(!backend_->HasPendingJob(this)); | 297 CHECK(!backend_->HasPendingJob(this)); |
287 } | 298 } |
288 | 299 |
289 void URLRequestChromeJob::Start() { | 300 void URLRequestChromeJob::Start() { |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 base::Bind(&URLRequestChromeJob::MimeTypeAvailable, job, mime_type)); | 411 base::Bind(&URLRequestChromeJob::MimeTypeAvailable, job, mime_type)); |
401 } | 412 } |
402 | 413 |
403 } // namespace | 414 } // namespace |
404 | 415 |
405 namespace { | 416 namespace { |
406 | 417 |
407 class ChromeProtocolHandler | 418 class ChromeProtocolHandler |
408 : public net::URLRequestJobFactory::ProtocolHandler { | 419 : public net::URLRequestJobFactory::ProtocolHandler { |
409 public: | 420 public: |
410 explicit ChromeProtocolHandler(ChromeURLDataManagerBackend* backend); | 421 // |is_incognito| should be set for incognito profiles. |
| 422 explicit ChromeProtocolHandler(ChromeURLDataManagerBackend* backend, |
| 423 bool is_incognito); |
411 ~ChromeProtocolHandler(); | 424 ~ChromeProtocolHandler(); |
412 | 425 |
413 virtual net::URLRequestJob* MaybeCreateJob( | 426 virtual net::URLRequestJob* MaybeCreateJob( |
414 net::URLRequest* request, | 427 net::URLRequest* request, |
415 net::NetworkDelegate* network_delegate) const OVERRIDE; | 428 net::NetworkDelegate* network_delegate) const OVERRIDE; |
416 | 429 |
417 private: | 430 private: |
418 // These members are owned by ProfileIOData, which owns this ProtocolHandler. | 431 // These members are owned by ProfileIOData, which owns this ProtocolHandler. |
419 ChromeURLDataManagerBackend* const backend_; | 432 ChromeURLDataManagerBackend* const backend_; |
420 | 433 |
| 434 // True when generated from an incognito profile. |
| 435 const bool is_incognito_; |
| 436 |
421 DISALLOW_COPY_AND_ASSIGN(ChromeProtocolHandler); | 437 DISALLOW_COPY_AND_ASSIGN(ChromeProtocolHandler); |
422 }; | 438 }; |
423 | 439 |
424 ChromeProtocolHandler::ChromeProtocolHandler( | 440 ChromeProtocolHandler::ChromeProtocolHandler( |
425 ChromeURLDataManagerBackend* backend) | 441 ChromeURLDataManagerBackend* backend, bool is_incognito) |
426 : backend_(backend) {} | 442 : backend_(backend), is_incognito_(is_incognito) {} |
427 | 443 |
428 ChromeProtocolHandler::~ChromeProtocolHandler() {} | 444 ChromeProtocolHandler::~ChromeProtocolHandler() {} |
429 | 445 |
430 net::URLRequestJob* ChromeProtocolHandler::MaybeCreateJob( | 446 net::URLRequestJob* ChromeProtocolHandler::MaybeCreateJob( |
431 net::URLRequest* request, net::NetworkDelegate* network_delegate) const { | 447 net::URLRequest* request, net::NetworkDelegate* network_delegate) const { |
432 DCHECK(request); | 448 DCHECK(request); |
433 | 449 |
434 // Fall back to using a custom handler | 450 // Fall back to using a custom handler |
435 return new URLRequestChromeJob(request, network_delegate, backend_); | 451 return new URLRequestChromeJob(request, network_delegate, backend_, |
| 452 is_incognito_); |
436 } | 453 } |
437 | 454 |
438 } // namespace | 455 } // namespace |
439 | 456 |
440 ChromeURLDataManagerBackend::ChromeURLDataManagerBackend() | 457 ChromeURLDataManagerBackend::ChromeURLDataManagerBackend() |
441 : next_request_id_(0) { | 458 : next_request_id_(0) { |
442 content::URLDataSource* shared_source = new SharedResourcesDataSource(); | 459 content::URLDataSource* shared_source = new SharedResourcesDataSource(); |
443 URLDataSourceImpl* source_impl = | 460 URLDataSourceImpl* source_impl = |
444 new URLDataSourceImpl(shared_source->GetSource(), shared_source); | 461 new URLDataSourceImpl(shared_source->GetSource(), shared_source); |
445 AddDataSource(source_impl); | 462 AddDataSource(source_impl); |
446 } | 463 } |
447 | 464 |
448 ChromeURLDataManagerBackend::~ChromeURLDataManagerBackend() { | 465 ChromeURLDataManagerBackend::~ChromeURLDataManagerBackend() { |
449 for (DataSourceMap::iterator i = data_sources_.begin(); | 466 for (DataSourceMap::iterator i = data_sources_.begin(); |
450 i != data_sources_.end(); ++i) { | 467 i != data_sources_.end(); ++i) { |
451 i->second->backend_ = NULL; | 468 i->second->backend_ = NULL; |
452 } | 469 } |
453 data_sources_.clear(); | 470 data_sources_.clear(); |
454 } | 471 } |
455 | 472 |
456 // static | 473 // static |
457 net::URLRequestJobFactory::ProtocolHandler* | 474 net::URLRequestJobFactory::ProtocolHandler* |
458 ChromeURLDataManagerBackend::CreateProtocolHandler( | 475 ChromeURLDataManagerBackend::CreateProtocolHandler( |
459 ChromeURLDataManagerBackend* backend) { | 476 ChromeURLDataManagerBackend* backend, bool is_incognito) { |
460 DCHECK(backend); | 477 DCHECK(backend); |
461 return new ChromeProtocolHandler(backend); | 478 return new ChromeProtocolHandler(backend, is_incognito); |
462 } | 479 } |
463 | 480 |
464 void ChromeURLDataManagerBackend::AddDataSource( | 481 void ChromeURLDataManagerBackend::AddDataSource( |
465 URLDataSourceImpl* source) { | 482 URLDataSourceImpl* source) { |
466 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 483 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
467 DataSourceMap::iterator i = data_sources_.find(source->source_name()); | 484 DataSourceMap::iterator i = data_sources_.find(source->source_name()); |
468 if (i != data_sources_.end()) { | 485 if (i != data_sources_.end()) { |
469 if (!source->source()->ShouldReplaceExistingSource()) | 486 if (!source->source()->ShouldReplaceExistingSource()) |
470 return; | 487 return; |
471 i->second->backend_ = NULL; | 488 i->second->backend_ = NULL; |
(...skipping 25 matching lines...) Expand all Loading... |
497 return false; | 514 return false; |
498 | 515 |
499 URLDataSourceImpl* source = i->second; | 516 URLDataSourceImpl* source = i->second; |
500 | 517 |
501 // Save this request so we know where to send the data. | 518 // Save this request so we know where to send the data. |
502 RequestID request_id = next_request_id_++; | 519 RequestID request_id = next_request_id_++; |
503 pending_requests_.insert(std::make_pair(request_id, job)); | 520 pending_requests_.insert(std::make_pair(request_id, job)); |
504 | 521 |
505 job->set_allow_caching(source->source()->AllowCaching()); | 522 job->set_allow_caching(source->source()->AllowCaching()); |
506 | 523 |
507 const ChromeURLRequestContext* context = | |
508 static_cast<const ChromeURLRequestContext*>(job->request()->context()); | |
509 | |
510 // Forward along the request to the data source. | 524 // Forward along the request to the data source. |
511 MessageLoop* target_message_loop = | 525 MessageLoop* target_message_loop = |
512 source->source()->MessageLoopForRequestPath(path); | 526 source->source()->MessageLoopForRequestPath(path); |
513 if (!target_message_loop) { | 527 if (!target_message_loop) { |
514 job->MimeTypeAvailable(source->source()->GetMimeType(path)); | 528 job->MimeTypeAvailable(source->source()->GetMimeType(path)); |
515 | 529 |
516 // The DataSource is agnostic to which thread StartDataRequest is called | 530 // The DataSource is agnostic to which thread StartDataRequest is called |
517 // on for this path. Call directly into it from this thread, the IO | 531 // on for this path. Call directly into it from this thread, the IO |
518 // thread. | 532 // thread. |
519 source->source()->StartDataRequest( | 533 source->source()->StartDataRequest( |
520 path, context->is_incognito(), | 534 path, job->is_incognito(), |
521 base::Bind(&URLDataSourceImpl::SendResponse, source, request_id)); | 535 base::Bind(&URLDataSourceImpl::SendResponse, source, request_id)); |
522 } else { | 536 } else { |
523 // URLRequestChromeJob should receive mime type before data. This | 537 // URLRequestChromeJob should receive mime type before data. This |
524 // is guaranteed because request for mime type is placed in the | 538 // is guaranteed because request for mime type is placed in the |
525 // message loop before request for data. And correspondingly their | 539 // message loop before request for data. And correspondingly their |
526 // replies are put on the IO thread in the same order. | 540 // replies are put on the IO thread in the same order. |
527 target_message_loop->PostTask( | 541 target_message_loop->PostTask( |
528 FROM_HERE, | 542 FROM_HERE, |
529 base::Bind(&GetMimeTypeOnUI, | 543 base::Bind(&GetMimeTypeOnUI, |
530 scoped_refptr<URLDataSourceImpl>(source), | 544 scoped_refptr<URLDataSourceImpl>(source), |
531 path, job->AsWeakPtr())); | 545 path, job->AsWeakPtr())); |
532 | 546 |
533 // The DataSource wants StartDataRequest to be called on a specific thread, | 547 // The DataSource wants StartDataRequest to be called on a specific thread, |
534 // usually the UI thread, for this path. | 548 // usually the UI thread, for this path. |
535 target_message_loop->PostTask( | 549 target_message_loop->PostTask( |
536 FROM_HERE, | 550 FROM_HERE, |
537 base::Bind(&ChromeURLDataManagerBackend::CallStartRequest, | 551 base::Bind(&ChromeURLDataManagerBackend::CallStartRequest, |
538 make_scoped_refptr(source), path, context->is_incognito(), | 552 make_scoped_refptr(source), path, job->is_incognito(), |
539 request_id)); | 553 request_id)); |
540 } | 554 } |
541 return true; | 555 return true; |
542 } | 556 } |
543 | 557 |
544 void ChromeURLDataManagerBackend::CallStartRequest( | 558 void ChromeURLDataManagerBackend::CallStartRequest( |
545 scoped_refptr<URLDataSourceImpl> source, | 559 scoped_refptr<URLDataSourceImpl> source, |
546 const std::string& path, | 560 const std::string& path, |
547 bool is_incognito, | 561 bool is_incognito, |
548 int request_id) { | 562 int request_id) { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 return false; | 631 return false; |
618 | 632 |
619 *path = inspector_dir.AppendASCII(relative_path); | 633 *path = inspector_dir.AppendASCII(relative_path); |
620 return true; | 634 return true; |
621 } | 635 } |
622 #endif // defined(DEBUG_DEVTOOLS) | 636 #endif // defined(DEBUG_DEVTOOLS) |
623 | 637 |
624 class DevToolsJobFactory | 638 class DevToolsJobFactory |
625 : public net::URLRequestJobFactory::ProtocolHandler { | 639 : public net::URLRequestJobFactory::ProtocolHandler { |
626 public: | 640 public: |
| 641 // |is_incognito| should be set for incognito profiles. |
627 DevToolsJobFactory(ChromeURLDataManagerBackend* backend, | 642 DevToolsJobFactory(ChromeURLDataManagerBackend* backend, |
628 net::NetworkDelegate* network_delegate); | 643 net::NetworkDelegate* network_delegate, |
| 644 bool is_incognito); |
629 virtual ~DevToolsJobFactory(); | 645 virtual ~DevToolsJobFactory(); |
630 | 646 |
631 virtual net::URLRequestJob* MaybeCreateJob( | 647 virtual net::URLRequestJob* MaybeCreateJob( |
632 net::URLRequest* request, | 648 net::URLRequest* request, |
633 net::NetworkDelegate* network_delegate) const OVERRIDE; | 649 net::NetworkDelegate* network_delegate) const OVERRIDE; |
634 | 650 |
635 private: | 651 private: |
636 // |backend_| and |network_delegate_| are owned by ProfileIOData, which owns | 652 // |backend_| and |network_delegate_| are owned by ProfileIOData, which owns |
637 // this ProtocolHandler. | 653 // this ProtocolHandler. |
638 ChromeURLDataManagerBackend* const backend_; | 654 ChromeURLDataManagerBackend* const backend_; |
639 net::NetworkDelegate* network_delegate_; | 655 net::NetworkDelegate* network_delegate_; |
640 | 656 |
| 657 // True when generated from an incognito profile. |
| 658 const bool is_incognito_; |
| 659 |
641 DISALLOW_COPY_AND_ASSIGN(DevToolsJobFactory); | 660 DISALLOW_COPY_AND_ASSIGN(DevToolsJobFactory); |
642 }; | 661 }; |
643 | 662 |
644 DevToolsJobFactory::DevToolsJobFactory(ChromeURLDataManagerBackend* backend, | 663 DevToolsJobFactory::DevToolsJobFactory(ChromeURLDataManagerBackend* backend, |
645 net::NetworkDelegate* network_delegate) | 664 net::NetworkDelegate* network_delegate, |
| 665 bool is_incognito) |
646 : backend_(backend), | 666 : backend_(backend), |
647 network_delegate_(network_delegate) { | 667 network_delegate_(network_delegate), |
| 668 is_incognito_(is_incognito) { |
648 DCHECK(backend_); | 669 DCHECK(backend_); |
649 } | 670 } |
650 | 671 |
651 DevToolsJobFactory::~DevToolsJobFactory() {} | 672 DevToolsJobFactory::~DevToolsJobFactory() {} |
652 | 673 |
653 net::URLRequestJob* | 674 net::URLRequestJob* |
654 DevToolsJobFactory::MaybeCreateJob( | 675 DevToolsJobFactory::MaybeCreateJob( |
655 net::URLRequest* request, net::NetworkDelegate* network_delegate) const { | 676 net::URLRequest* request, net::NetworkDelegate* network_delegate) const { |
656 #if defined(DEBUG_DEVTOOLS) | 677 #if defined(DEBUG_DEVTOOLS) |
657 FilePath path; | 678 FilePath path; |
658 if (IsSupportedDevToolsURL(request->url(), &path)) | 679 if (IsSupportedDevToolsURL(request->url(), &path)) |
659 return new net::URLRequestFileJob(request, network_delegate, path); | 680 return new net::URLRequestFileJob(request, network_delegate, path); |
660 #endif | 681 #endif |
661 return new URLRequestChromeJob(request, network_delegate, backend_); | 682 return new URLRequestChromeJob(request, network_delegate, backend_, |
| 683 is_incognito_); |
662 } | 684 } |
663 | 685 |
664 } // namespace | 686 } // namespace |
665 | 687 |
666 net::URLRequestJobFactory::ProtocolHandler* | 688 net::URLRequestJobFactory::ProtocolHandler* |
667 CreateDevToolsProtocolHandler(ChromeURLDataManagerBackend* backend, | 689 CreateDevToolsProtocolHandler(ChromeURLDataManagerBackend* backend, |
668 net::NetworkDelegate* network_delegate) { | 690 net::NetworkDelegate* network_delegate, |
669 return new DevToolsJobFactory(backend, network_delegate); | 691 bool is_incognito) { |
| 692 return new DevToolsJobFactory(backend, network_delegate, is_incognito); |
670 } | 693 } |
OLD | NEW |