Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: chrome/browser/dom_ui/shared_resources_data_source.cc

Issue 6461024: Revert 74292 - Splits ChromeURLDataManager into 2 chunks:... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/singleton.h" 9 #include "base/singleton.h"
10 #include "base/threading/thread_restrictions.h" 10 #include "base/threading/thread_restrictions.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 break; 46 break;
47 } 47 }
48 } 48 }
49 } 49 }
50 50
51 return idr; 51 return idr;
52 } 52 }
53 53
54 } // namespace 54 } // namespace
55 55
56 // static
57 void SharedResourcesDataSource::Register() {
58 SharedResourcesDataSource* source = new SharedResourcesDataSource();
59 BrowserThread::PostTask(
60 BrowserThread::IO, FROM_HERE,
61 NewRunnableMethod(
62 ChromeURLDataManager::GetInstance(),
63 &ChromeURLDataManager::AddDataSource,
64 make_scoped_refptr(source)));
65 }
66
56 SharedResourcesDataSource::SharedResourcesDataSource() 67 SharedResourcesDataSource::SharedResourcesDataSource()
57 : DataSource(chrome::kChromeUIResourcesHost, NULL) { 68 : DataSource(chrome::kChromeUIResourcesHost, NULL) {
58 } 69 }
59 70
60 SharedResourcesDataSource::~SharedResourcesDataSource() { 71 SharedResourcesDataSource::~SharedResourcesDataSource() {
61 } 72 }
62 73
63 void SharedResourcesDataSource::StartDataRequest(const std::string& path, 74 void SharedResourcesDataSource::StartDataRequest(const std::string& path,
64 bool is_off_the_record, 75 bool is_off_the_record,
65 int request_id) { 76 int request_id) {
66 int idr = PathToIDR(path); 77 int idr = PathToIDR(path);
67 DCHECK_NE(-1, idr); 78 DCHECK_NE(-1, idr);
68 const ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 79 const ResourceBundle& rb = ResourceBundle::GetSharedInstance();
69 scoped_refptr<RefCountedStaticMemory> bytes(rb.LoadDataResourceBytes(idr)); 80 scoped_refptr<RefCountedStaticMemory> bytes(rb.LoadDataResourceBytes(idr));
70 SendResponse(request_id, bytes); 81 SendResponse(request_id, bytes);
71 } 82 }
72 83
73 std::string SharedResourcesDataSource::GetMimeType( 84 std::string SharedResourcesDataSource::GetMimeType(
74 const std::string& path) const { 85 const std::string& path) const {
75 // 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
76 // registry. 87 // registry.
77 // http://code.google.com/p/chromium/issues/detail?id=59849 88 // http://code.google.com/p/chromium/issues/detail?id=59849
78 base::ThreadRestrictions::ScopedAllowIO allow_io; 89 base::ThreadRestrictions::ScopedAllowIO allow_io;
79 90
80 std::string mime_type; 91 std::string mime_type;
81 net::GetMimeTypeFromFile(FilePath().AppendASCII(path), &mime_type); 92 net::GetMimeTypeFromFile(FilePath().AppendASCII(path), &mime_type);
82 return mime_type; 93 return mime_type;
83 } 94 }
OLDNEW
« no previous file with comments | « chrome/browser/dom_ui/shared_resources_data_source.h ('k') | chrome/browser/dom_ui/slideshow_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698