| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/dom_ui/shared_resources_data_source.h" | 5 #include "chrome/browser/dom_ui/shared_resources_data_source.h" |
| 6 | 6 |
| 7 #include "app/resource_bundle.h" | 7 #include "app/resource_bundle.h" |
| 8 #include "base/singleton.h" | 8 #include "base/singleton.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/chrome_thread.h" | 10 #include "chrome/browser/chrome_thread.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 : DataSource(chrome::kChromeUIResourcesHost, NULL) { | 66 : DataSource(chrome::kChromeUIResourcesHost, NULL) { |
| 67 } | 67 } |
| 68 | 68 |
| 69 SharedResourcesDataSource::~SharedResourcesDataSource() { | 69 SharedResourcesDataSource::~SharedResourcesDataSource() { |
| 70 } | 70 } |
| 71 | 71 |
| 72 void SharedResourcesDataSource::StartDataRequest(const std::string& path, | 72 void SharedResourcesDataSource::StartDataRequest(const std::string& path, |
| 73 bool is_off_the_record, | 73 bool is_off_the_record, |
| 74 int request_id) { | 74 int request_id) { |
| 75 int idr = PathToIDR(path); | 75 int idr = PathToIDR(path); |
| 76 DCHECK_NE(-1, idr); | 76 DCHECK_NE(-1, idr) << "Couldn't find shared resource: " << path; |
| 77 const ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 77 const ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 78 scoped_refptr<RefCountedStaticMemory> bytes(rb.LoadDataResourceBytes(idr)); | 78 scoped_refptr<RefCountedStaticMemory> bytes(rb.LoadDataResourceBytes(idr)); |
| 79 SendResponse(request_id, bytes); | 79 SendResponse(request_id, bytes); |
| 80 } | 80 } |
| 81 | 81 |
| 82 std::string SharedResourcesDataSource::GetMimeType( | 82 std::string SharedResourcesDataSource::GetMimeType( |
| 83 const std::string& path) const { | 83 const std::string& path) const { |
| 84 std::string mime_type; | 84 std::string mime_type; |
| 85 net::GetMimeTypeFromFile(FilePath().AppendASCII(path), &mime_type); | 85 net::GetMimeTypeFromFile(FilePath().AppendASCII(path), &mime_type); |
| 86 return mime_type; | 86 return mime_type; |
| 87 } | 87 } |
| 88 | 88 |
| OLD | NEW |