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

Side by Side Diff: content/browser/webui/shared_resources_data_source.cc

Issue 13513004: content: Move more constants into content namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 8 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) 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/shared_resources_data_source.h" 5 #include "content/browser/webui/shared_resources_data_source.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/ref_counted_memory.h" 8 #include "base/memory/ref_counted_memory.h"
9 #include "base/threading/thread_restrictions.h" 9 #include "base/threading/thread_restrictions.h"
10 #include "content/public/common/content_client.h" 10 #include "content/public/common/content_client.h"
(...skipping 17 matching lines...) Expand all
28 28
29 } // namespace 29 } // namespace
30 30
31 SharedResourcesDataSource::SharedResourcesDataSource() { 31 SharedResourcesDataSource::SharedResourcesDataSource() {
32 } 32 }
33 33
34 SharedResourcesDataSource::~SharedResourcesDataSource() { 34 SharedResourcesDataSource::~SharedResourcesDataSource() {
35 } 35 }
36 36
37 std::string SharedResourcesDataSource::GetSource() { 37 std::string SharedResourcesDataSource::GetSource() {
38 return chrome::kChromeUIResourcesHost; 38 return content::kChromeUIResourcesHost;
39 } 39 }
40 40
41 void SharedResourcesDataSource::StartDataRequest( 41 void SharedResourcesDataSource::StartDataRequest(
42 const std::string& path, 42 const std::string& path,
43 bool is_incognito, 43 bool is_incognito,
44 const content::URLDataSource::GotDataCallback& callback) { 44 const content::URLDataSource::GotDataCallback& callback) {
45 int idr = PathToIDR(path); 45 int idr = PathToIDR(path);
46 DCHECK_NE(-1, idr) << " path: " << path; 46 DCHECK_NE(-1, idr) << " path: " << path;
47 scoped_refptr<base::RefCountedStaticMemory> bytes( 47 scoped_refptr<base::RefCountedStaticMemory> bytes(
48 content::GetContentClient()->GetDataResourceBytes(idr)); 48 content::GetContentClient()->GetDataResourceBytes(idr));
49 49
50 callback.Run(bytes); 50 callback.Run(bytes);
51 } 51 }
52 52
53 std::string SharedResourcesDataSource::GetMimeType( 53 std::string SharedResourcesDataSource::GetMimeType(
54 const std::string& path) const { 54 const std::string& path) const {
55 // Requests should not block on the disk! On POSIX this goes to disk. 55 // Requests should not block on the disk! On POSIX this goes to disk.
56 // http://code.google.com/p/chromium/issues/detail?id=59849 56 // http://code.google.com/p/chromium/issues/detail?id=59849
57 57
58 base::ThreadRestrictions::ScopedAllowIO allow_io; 58 base::ThreadRestrictions::ScopedAllowIO allow_io;
59 std::string mime_type; 59 std::string mime_type;
60 net::GetMimeTypeFromFile(base::FilePath().AppendASCII(path), &mime_type); 60 net::GetMimeTypeFromFile(base::FilePath().AppendASCII(path), &mime_type);
61 return mime_type; 61 return mime_type;
62 } 62 }
OLDNEW
« no previous file with comments | « content/browser/webui/content_web_ui_controller_factory.cc ('k') | content/browser/webui/url_data_manager_backend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698