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 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 15 matching lines...) Expand all Loading... | |
26 #include "base/threading/thread_task_runner_handle.h" | 26 #include "base/threading/thread_task_runner_handle.h" |
27 #include "base/threading/worker_pool.h" | 27 #include "base/threading/worker_pool.h" |
28 #include "base/trace_event/trace_event.h" | 28 #include "base/trace_event/trace_event.h" |
29 #include "content/browser/blob_storage/chrome_blob_storage_context.h" | 29 #include "content/browser/blob_storage/chrome_blob_storage_context.h" |
30 #include "content/browser/histogram_internals_request_job.h" | 30 #include "content/browser/histogram_internals_request_job.h" |
31 #include "content/browser/net/view_blob_internals_job_factory.h" | 31 #include "content/browser/net/view_blob_internals_job_factory.h" |
32 #include "content/browser/net/view_http_cache_job_factory.h" | 32 #include "content/browser/net/view_http_cache_job_factory.h" |
33 #include "content/browser/resource_context_impl.h" | 33 #include "content/browser/resource_context_impl.h" |
34 #include "content/browser/webui/shared_resources_data_source.h" | 34 #include "content/browser/webui/shared_resources_data_source.h" |
35 #include "content/browser/webui/url_data_source_impl.h" | 35 #include "content/browser/webui/url_data_source_impl.h" |
36 #include "content/browser/webui/web_ui_data_source_impl.h" | |
36 #include "content/public/browser/browser_context.h" | 37 #include "content/public/browser/browser_context.h" |
37 #include "content/public/browser/browser_thread.h" | 38 #include "content/public/browser/browser_thread.h" |
38 #include "content/public/browser/content_browser_client.h" | 39 #include "content/public/browser/content_browser_client.h" |
39 #include "content/public/browser/render_process_host.h" | 40 #include "content/public/browser/render_process_host.h" |
40 #include "content/public/browser/resource_request_info.h" | 41 #include "content/public/browser/resource_request_info.h" |
41 #include "content/public/common/url_constants.h" | 42 #include "content/public/common/url_constants.h" |
42 #include "net/base/io_buffer.h" | 43 #include "net/base/io_buffer.h" |
43 #include "net/base/net_errors.h" | 44 #include "net/base/net_errors.h" |
44 #include "net/filter/gzip_source_stream.h" | 45 #include "net/filter/gzip_source_stream.h" |
45 #include "net/filter/source_stream.h" | 46 #include "net/filter/source_stream.h" |
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
643 DataSourceMap::iterator i = data_sources_.find(source->source_name()); | 644 DataSourceMap::iterator i = data_sources_.find(source->source_name()); |
644 if (i != data_sources_.end()) { | 645 if (i != data_sources_.end()) { |
645 if (!source->source()->ShouldReplaceExistingSource()) | 646 if (!source->source()->ShouldReplaceExistingSource()) |
646 return; | 647 return; |
647 i->second->backend_ = nullptr; | 648 i->second->backend_ = nullptr; |
648 } | 649 } |
649 data_sources_[source->source_name()] = source; | 650 data_sources_[source->source_name()] = source; |
650 source->backend_ = this; | 651 source->backend_ = this; |
651 } | 652 } |
652 | 653 |
654 void URLDataManagerBackend::UpdateWebUIDataSource( | |
655 const std::string& source_name, | |
656 const base::DictionaryValue& update) { | |
657 DataSourceMap::iterator it = data_sources_.find(source_name); | |
658 if (it == data_sources_.end() || !it->second->IsWebUIDataSourceImpl()) { | |
calamity
2016/11/16 05:36:13
Why can't non WebUI data sources be updated?
Dan Beam
2016/11/16 06:02:03
we're only sending updates to the localized "strin
| |
659 NOTREACHED(); | |
660 return; | |
661 } | |
662 static_cast<WebUIDataSourceImpl*>(it->second.get()) | |
663 ->AddLocalizedStrings(update); | |
664 } | |
665 | |
653 bool URLDataManagerBackend::HasPendingJob( | 666 bool URLDataManagerBackend::HasPendingJob( |
654 URLRequestChromeJob* job) const { | 667 URLRequestChromeJob* job) const { |
655 for (PendingRequestMap::const_iterator i = pending_requests_.begin(); | 668 for (PendingRequestMap::const_iterator i = pending_requests_.begin(); |
656 i != pending_requests_.end(); ++i) { | 669 i != pending_requests_.end(); ++i) { |
657 if (i->second == job) | 670 if (i->second == job) |
658 return true; | 671 return true; |
659 } | 672 } |
660 return false; | 673 return false; |
661 } | 674 } |
662 | 675 |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
856 | 869 |
857 } // namespace | 870 } // namespace |
858 | 871 |
859 net::URLRequestJobFactory::ProtocolHandler* CreateDevToolsProtocolHandler( | 872 net::URLRequestJobFactory::ProtocolHandler* CreateDevToolsProtocolHandler( |
860 ResourceContext* resource_context, | 873 ResourceContext* resource_context, |
861 bool is_incognito) { | 874 bool is_incognito) { |
862 return new DevToolsJobFactory(resource_context, is_incognito); | 875 return new DevToolsJobFactory(resource_context, is_incognito); |
863 } | 876 } |
864 | 877 |
865 } // namespace content | 878 } // namespace content |
OLD | NEW |