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/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 // thread. | 667 // thread. |
668 source->source()->StartDataRequest( | 668 source->source()->StartDataRequest( |
669 path, render_process_id, render_frame_id, | 669 path, render_process_id, render_frame_id, |
670 base::Bind(&URLDataSourceImpl::SendResponse, source, request_id)); | 670 base::Bind(&URLDataSourceImpl::SendResponse, source, request_id)); |
671 } else { | 671 } else { |
672 // URLRequestChromeJob should receive mime type before data. This | 672 // URLRequestChromeJob should receive mime type before data. This |
673 // is guaranteed because request for mime type is placed in the | 673 // is guaranteed because request for mime type is placed in the |
674 // message loop before request for data. And correspondingly their | 674 // message loop before request for data. And correspondingly their |
675 // replies are put on the IO thread in the same order. | 675 // replies are put on the IO thread in the same order. |
676 target_message_loop->task_runner()->PostTask( | 676 target_message_loop->task_runner()->PostTask( |
677 FROM_HERE, | 677 FROM_HERE, base::Bind(&GetMimeTypeOnUI, base::RetainedRef(source), path, |
678 base::Bind(&GetMimeTypeOnUI, scoped_refptr<URLDataSourceImpl>(source), | 678 job->AsWeakPtr())); |
679 path, job->AsWeakPtr())); | |
680 | 679 |
681 // The DataSource wants StartDataRequest to be called on a specific thread, | 680 // The DataSource wants StartDataRequest to be called on a specific thread, |
682 // usually the UI thread, for this path. | 681 // usually the UI thread, for this path. |
683 target_message_loop->task_runner()->PostTask( | 682 target_message_loop->task_runner()->PostTask( |
684 FROM_HERE, base::Bind(&URLDataManagerBackend::CallStartRequest, | 683 FROM_HERE, base::Bind(&URLDataManagerBackend::CallStartRequest, |
685 make_scoped_refptr(source), path, | 684 base::RetainedRef(source), path, |
686 render_process_id, render_frame_id, request_id)); | 685 render_process_id, render_frame_id, request_id)); |
687 } | 686 } |
688 return true; | 687 return true; |
689 } | 688 } |
690 | 689 |
691 URLDataSourceImpl* URLDataManagerBackend::GetDataSourceFromURL( | 690 URLDataSourceImpl* URLDataManagerBackend::GetDataSourceFromURL( |
692 const GURL& url) { | 691 const GURL& url) { |
693 // The input usually looks like: chrome://source_name/extra_bits?foo | 692 // The input usually looks like: chrome://source_name/extra_bits?foo |
694 // so do a lookup using the host of the URL. | 693 // so do a lookup using the host of the URL. |
695 DataSourceMap::iterator i = data_sources_.find(url.host()); | 694 DataSourceMap::iterator i = data_sources_.find(url.host()); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
797 | 796 |
798 } // namespace | 797 } // namespace |
799 | 798 |
800 net::URLRequestJobFactory::ProtocolHandler* | 799 net::URLRequestJobFactory::ProtocolHandler* |
801 CreateDevToolsProtocolHandler(content::ResourceContext* resource_context, | 800 CreateDevToolsProtocolHandler(content::ResourceContext* resource_context, |
802 bool is_incognito) { | 801 bool is_incognito) { |
803 return new DevToolsJobFactory(resource_context, is_incognito); | 802 return new DevToolsJobFactory(resource_context, is_incognito); |
804 } | 803 } |
805 | 804 |
806 } // namespace content | 805 } // namespace content |
OLD | NEW |