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

Unified Diff: chrome/browser/ui/webui/shared_resources_data_source.cc

Issue 12049052: Move core url data manager classes to content. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: review comments Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/webui/shared_resources_data_source.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/shared_resources_data_source.cc
===================================================================
--- chrome/browser/ui/webui/shared_resources_data_source.cc (revision 178598)
+++ chrome/browser/ui/webui/shared_resources_data_source.cc (working copy)
@@ -1,62 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/ui/webui/shared_resources_data_source.h"
-
-#include "base/logging.h"
-#include "base/memory/ref_counted_memory.h"
-#include "base/threading/thread_restrictions.h"
-#include "content/public/common/content_client.h"
-#include "content/public/common/url_constants.h"
-#include "grit/webui_resources_map.h"
-#include "net/base/mime_util.h"
-
-namespace {
-
-int PathToIDR(const std::string& path) {
- int idr = -1;
- for (size_t i = 0; i < kWebuiResourcesSize; ++i) {
- if (kWebuiResources[i].name == path) {
- idr = kWebuiResources[i].value;
- break;
- }
- }
-
- return idr;
-}
-
-} // namespace
-
-SharedResourcesDataSource::SharedResourcesDataSource() {
-}
-
-SharedResourcesDataSource::~SharedResourcesDataSource() {
-}
-
-std::string SharedResourcesDataSource::GetSource() {
- return chrome::kChromeUIResourcesHost;
-}
-
-void SharedResourcesDataSource::StartDataRequest(
- const std::string& path,
- bool is_incognito,
- const content::URLDataSource::GotDataCallback& callback) {
- int idr = PathToIDR(path);
- DCHECK_NE(-1, idr) << " path: " << path;
- scoped_refptr<base::RefCountedStaticMemory> bytes(
- content::GetContentClient()->GetDataResourceBytes(idr));
-
- callback.Run(bytes);
-}
-
-std::string SharedResourcesDataSource::GetMimeType(
- const std::string& path) const {
- // Requests should not block on the disk! On POSIX this goes to disk.
- // http://code.google.com/p/chromium/issues/detail?id=59849
-
- base::ThreadRestrictions::ScopedAllowIO allow_io;
- std::string mime_type;
- net::GetMimeTypeFromFile(FilePath().AppendASCII(path), &mime_type);
- return mime_type;
-}
« no previous file with comments | « chrome/browser/ui/webui/shared_resources_data_source.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698