| 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 <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
| 10 #include "base/singleton.h" | 10 #include "base/singleton.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 int PathToIDR(const std::string& path) { | 25 int PathToIDR(const std::string& path) { |
| 26 int idr = -1; | 26 int idr = -1; |
| 27 if (path == "app/resources/folder_closed.png") { | 27 if (path == "app/resources/folder_closed.png") { |
| 28 idr = IDR_FOLDER_CLOSED; | 28 idr = IDR_FOLDER_CLOSED; |
| 29 } else if (path == "app/resources/folder_closed_rtl.png") { | 29 } else if (path == "app/resources/folder_closed_rtl.png") { |
| 30 idr = IDR_FOLDER_CLOSED_RTL; | 30 idr = IDR_FOLDER_CLOSED_RTL; |
| 31 } else if (path == "app/resources/folder_open.png") { | 31 } else if (path == "app/resources/folder_open.png") { |
| 32 idr = IDR_FOLDER_OPEN; | 32 idr = IDR_FOLDER_OPEN; |
| 33 } else if (path == "app/resources/folder_open_rtl.png") { | 33 } else if (path == "app/resources/folder_open_rtl.png") { |
| 34 idr = IDR_FOLDER_OPEN_RTL; | 34 idr = IDR_FOLDER_OPEN_RTL; |
| 35 } else if (path == "app/resources/throbber.png") { |
| 36 idr = IDR_THROBBER; |
| 35 } else { | 37 } else { |
| 36 // The name of the files in the grd list are prefixed with the following | 38 // The name of the files in the grd list are prefixed with the following |
| 37 // directory: | 39 // directory: |
| 38 std::string key("shared/"); | 40 std::string key("shared/"); |
| 39 key += path; | 41 key += path; |
| 40 | 42 |
| 41 for (size_t i = 0; i < kSharedResourcesSize; ++i) { | 43 for (size_t i = 0; i < kSharedResourcesSize; ++i) { |
| 42 if (kSharedResources[i].name == key) { | 44 if (kSharedResources[i].name == key) { |
| 43 idr = kSharedResources[i].value; | 45 idr = kSharedResources[i].value; |
| 44 break; | 46 break; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 const std::string& path) const { | 85 const std::string& path) const { |
| 84 // Requests should not block on the disk! On Windows this goes to the | 86 // Requests should not block on the disk! On Windows this goes to the |
| 85 // registry. | 87 // registry. |
| 86 // http://code.google.com/p/chromium/issues/detail?id=59849 | 88 // http://code.google.com/p/chromium/issues/detail?id=59849 |
| 87 base::ThreadRestrictions::ScopedAllowIO allow_io; | 89 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 88 | 90 |
| 89 std::string mime_type; | 91 std::string mime_type; |
| 90 net::GetMimeTypeFromFile(FilePath().AppendASCII(path), &mime_type); | 92 net::GetMimeTypeFromFile(FilePath().AppendASCII(path), &mime_type); |
| 91 return mime_type; | 93 return mime_type; |
| 92 } | 94 } |
| OLD | NEW |