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

Unified Diff: net/base/platform_mime_util_win.cc

Issue 992733002: Remove //net (except for Android test stuff) and sdch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 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 | « net/base/platform_mime_util_mac.mm ('k') | net/base/prioritized_dispatcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/platform_mime_util_win.cc
diff --git a/net/base/platform_mime_util_win.cc b/net/base/platform_mime_util_win.cc
deleted file mode 100644
index fcac48faab53e3c10e0b12555a2c42edf720e444..0000000000000000000000000000000000000000
--- a/net/base/platform_mime_util_win.cc
+++ /dev/null
@@ -1,55 +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 "net/base/platform_mime_util.h"
-
-#include <string>
-
-#include "base/strings/utf_string_conversions.h"
-#include "base/win/registry.h"
-
-namespace net {
-
-bool PlatformMimeUtil::GetPlatformMimeTypeFromExtension(
- const base::FilePath::StringType& ext, std::string* result) const {
- // check windows registry for file extension's mime type (registry key
- // names are not case-sensitive).
- std::wstring value, key = L"." + ext;
- base::win::RegKey(HKEY_CLASSES_ROOT, key.c_str(), KEY_READ).ReadValue(
- L"Content Type", &value);
- if (!value.empty()) {
- *result = base::WideToUTF8(value);
- return true;
- }
- return false;
-}
-
-bool PlatformMimeUtil::GetPreferredExtensionForMimeType(
- const std::string& mime_type, base::FilePath::StringType* ext) const {
- std::wstring key(
- L"MIME\\Database\\Content Type\\" + base::UTF8ToWide(mime_type));
- if (base::win::RegKey(HKEY_CLASSES_ROOT, key.c_str(), KEY_READ).ReadValue(
- L"Extension", ext) != ERROR_SUCCESS) {
- return false;
- }
- // Strip off the leading dot, this should always be the case.
- if (!ext->empty() && ext->at(0) == L'.')
- ext->erase(ext->begin());
-
- return true;
-}
-
-void PlatformMimeUtil::GetPlatformExtensionsForMimeType(
- const std::string& mime_type,
- base::hash_set<base::FilePath::StringType>* extensions) const {
- // Multiple extensions could have the given mime type specified as their types
- // in their 'HKCR\.<extension>\Content Type' keys. Iterating all the HKCR
- // entries, though, is wildly impractical. Cheat by returning just the
- // preferred extension.
- base::FilePath::StringType ext;
- if (GetPreferredExtensionForMimeType(mime_type, &ext))
- extensions->insert(ext);
-}
-
-} // namespace net
« no previous file with comments | « net/base/platform_mime_util_mac.mm ('k') | net/base/prioritized_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698