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 "content/browser/webui/url_data_manager_backend.h" | 5 #include "content/browser/webui/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/alias.h" | 13 #include "base/debug/alias.h" |
14 #include "base/lazy_instance.h" | 14 #include "base/lazy_instance.h" |
15 #include "base/location.h" | |
16 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
17 #include "base/memory/ref_counted_memory.h" | 16 #include "base/memory/ref_counted_memory.h" |
18 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
| 18 #include "base/message_loop/message_loop.h" |
19 #include "base/profiler/scoped_tracker.h" | 19 #include "base/profiler/scoped_tracker.h" |
20 #include "base/single_thread_task_runner.h" | |
21 #include "base/strings/string_util.h" | 20 #include "base/strings/string_util.h" |
22 #include "base/strings/stringprintf.h" | 21 #include "base/strings/stringprintf.h" |
23 #include "base/trace_event/trace_event.h" | 22 #include "base/trace_event/trace_event.h" |
24 #include "content/browser/appcache/view_appcache_internals_job.h" | 23 #include "content/browser/appcache/view_appcache_internals_job.h" |
25 #include "content/browser/fileapi/chrome_blob_storage_context.h" | 24 #include "content/browser/fileapi/chrome_blob_storage_context.h" |
26 #include "content/browser/histogram_internals_request_job.h" | 25 #include "content/browser/histogram_internals_request_job.h" |
27 #include "content/browser/net/view_blob_internals_job_factory.h" | 26 #include "content/browser/net/view_blob_internals_job_factory.h" |
28 #include "content/browser/net/view_http_cache_job_factory.h" | 27 #include "content/browser/net/view_http_cache_job_factory.h" |
29 #include "content/browser/resource_context_impl.h" | 28 #include "content/browser/resource_context_impl.h" |
30 #include "content/browser/tcmalloc_internals_request_job.h" | 29 #include "content/browser/tcmalloc_internals_request_job.h" |
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 // on for this path. Call directly into it from this thread, the IO | 632 // on for this path. Call directly into it from this thread, the IO |
634 // thread. | 633 // thread. |
635 source->source()->StartDataRequest( | 634 source->source()->StartDataRequest( |
636 path, render_process_id, render_frame_id, | 635 path, render_process_id, render_frame_id, |
637 base::Bind(&URLDataSourceImpl::SendResponse, source, request_id)); | 636 base::Bind(&URLDataSourceImpl::SendResponse, source, request_id)); |
638 } else { | 637 } else { |
639 // URLRequestChromeJob should receive mime type before data. This | 638 // URLRequestChromeJob should receive mime type before data. This |
640 // is guaranteed because request for mime type is placed in the | 639 // is guaranteed because request for mime type is placed in the |
641 // message loop before request for data. And correspondingly their | 640 // message loop before request for data. And correspondingly their |
642 // replies are put on the IO thread in the same order. | 641 // replies are put on the IO thread in the same order. |
643 target_message_loop->task_runner()->PostTask( | 642 target_message_loop->PostTask( |
644 FROM_HERE, | 643 FROM_HERE, |
645 base::Bind(&GetMimeTypeOnUI, scoped_refptr<URLDataSourceImpl>(source), | 644 base::Bind(&GetMimeTypeOnUI, |
| 645 scoped_refptr<URLDataSourceImpl>(source), |
646 path, job->AsWeakPtr())); | 646 path, job->AsWeakPtr())); |
647 | 647 |
648 // The DataSource wants StartDataRequest to be called on a specific thread, | 648 // The DataSource wants StartDataRequest to be called on a specific thread, |
649 // usually the UI thread, for this path. | 649 // usually the UI thread, for this path. |
650 target_message_loop->task_runner()->PostTask( | 650 target_message_loop->PostTask( |
651 FROM_HERE, base::Bind(&URLDataManagerBackend::CallStartRequest, | 651 FROM_HERE, |
652 make_scoped_refptr(source), path, | 652 base::Bind(&URLDataManagerBackend::CallStartRequest, |
653 render_process_id, render_frame_id, request_id)); | 653 make_scoped_refptr(source), path, render_process_id, |
| 654 render_frame_id, request_id)); |
654 } | 655 } |
655 return true; | 656 return true; |
656 } | 657 } |
657 | 658 |
658 URLDataSourceImpl* URLDataManagerBackend::GetDataSourceFromURL( | 659 URLDataSourceImpl* URLDataManagerBackend::GetDataSourceFromURL( |
659 const GURL& url) { | 660 const GURL& url) { |
660 // The input usually looks like: chrome://source_name/extra_bits?foo | 661 // The input usually looks like: chrome://source_name/extra_bits?foo |
661 // so do a lookup using the host of the URL. | 662 // so do a lookup using the host of the URL. |
662 DataSourceMap::iterator i = data_sources_.find(url.host()); | 663 DataSourceMap::iterator i = data_sources_.find(url.host()); |
663 if (i != data_sources_.end()) | 664 if (i != data_sources_.end()) |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
764 | 765 |
765 } // namespace | 766 } // namespace |
766 | 767 |
767 net::URLRequestJobFactory::ProtocolHandler* | 768 net::URLRequestJobFactory::ProtocolHandler* |
768 CreateDevToolsProtocolHandler(content::ResourceContext* resource_context, | 769 CreateDevToolsProtocolHandler(content::ResourceContext* resource_context, |
769 bool is_incognito) { | 770 bool is_incognito) { |
770 return new DevToolsJobFactory(resource_context, is_incognito); | 771 return new DevToolsJobFactory(resource_context, is_incognito); |
771 } | 772 } |
772 | 773 |
773 } // namespace content | 774 } // namespace content |
OLD | NEW |