| 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" |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 | 433 |
| 434 namespace { | 434 namespace { |
| 435 | 435 |
| 436 // Gets mime type for data that is available from |source| by |path|. | 436 // Gets mime type for data that is available from |source| by |path|. |
| 437 // After that, notifies |job| that mime type is available. This method | 437 // After that, notifies |job| that mime type is available. This method |
| 438 // should be called on the UI thread, but notification is performed on | 438 // should be called on the UI thread, but notification is performed on |
| 439 // the IO thread. | 439 // the IO thread. |
| 440 void GetMimeTypeOnUI(URLDataSourceImpl* source, | 440 void GetMimeTypeOnUI(URLDataSourceImpl* source, |
| 441 const std::string& path, | 441 const std::string& path, |
| 442 const base::WeakPtr<URLRequestChromeJob>& job) { | 442 const base::WeakPtr<URLRequestChromeJob>& job) { |
| 443 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 443 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 444 std::string mime_type = source->source()->GetMimeType(path); | 444 std::string mime_type = source->source()->GetMimeType(path); |
| 445 BrowserThread::PostTask( | 445 BrowserThread::PostTask( |
| 446 BrowserThread::IO, FROM_HERE, | 446 BrowserThread::IO, FROM_HERE, |
| 447 base::Bind(&URLRequestChromeJob::MimeTypeAvailable, job, mime_type)); | 447 base::Bind(&URLRequestChromeJob::MimeTypeAvailable, job, mime_type)); |
| 448 } | 448 } |
| 449 | 449 |
| 450 } // namespace | 450 } // namespace |
| 451 | 451 |
| 452 namespace { | 452 namespace { |
| 453 | 453 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 bool is_incognito, | 549 bool is_incognito, |
| 550 AppCacheServiceImpl* appcache_service, | 550 AppCacheServiceImpl* appcache_service, |
| 551 ChromeBlobStorageContext* blob_storage_context) { | 551 ChromeBlobStorageContext* blob_storage_context) { |
| 552 DCHECK(resource_context); | 552 DCHECK(resource_context); |
| 553 return new ChromeProtocolHandler( | 553 return new ChromeProtocolHandler( |
| 554 resource_context, is_incognito, appcache_service, blob_storage_context); | 554 resource_context, is_incognito, appcache_service, blob_storage_context); |
| 555 } | 555 } |
| 556 | 556 |
| 557 void URLDataManagerBackend::AddDataSource( | 557 void URLDataManagerBackend::AddDataSource( |
| 558 URLDataSourceImpl* source) { | 558 URLDataSourceImpl* source) { |
| 559 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 559 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 560 DataSourceMap::iterator i = data_sources_.find(source->source_name()); | 560 DataSourceMap::iterator i = data_sources_.find(source->source_name()); |
| 561 if (i != data_sources_.end()) { | 561 if (i != data_sources_.end()) { |
| 562 if (!source->source()->ShouldReplaceExistingSource()) | 562 if (!source->source()->ShouldReplaceExistingSource()) |
| 563 return; | 563 return; |
| 564 i->second->backend_ = NULL; | 564 i->second->backend_ = NULL; |
| 565 } | 565 } |
| 566 data_sources_[source->source_name()] = source; | 566 data_sources_[source->source_name()] = source; |
| 567 source->backend_ = this; | 567 source->backend_ = this; |
| 568 } | 568 } |
| 569 | 569 |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 770 | 770 |
| 771 } // namespace | 771 } // namespace |
| 772 | 772 |
| 773 net::URLRequestJobFactory::ProtocolHandler* | 773 net::URLRequestJobFactory::ProtocolHandler* |
| 774 CreateDevToolsProtocolHandler(content::ResourceContext* resource_context, | 774 CreateDevToolsProtocolHandler(content::ResourceContext* resource_context, |
| 775 bool is_incognito) { | 775 bool is_incognito) { |
| 776 return new DevToolsJobFactory(resource_context, is_incognito); | 776 return new DevToolsJobFactory(resource_context, is_incognito); |
| 777 } | 777 } |
| 778 | 778 |
| 779 } // namespace content | 779 } // namespace content |
| OLD | NEW |