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

Unified Diff: net/base/platform_mime_util_win.cc

Issue 3172009: Cleanup Registry API: part 3. (Closed) Base URL: git://git.chromium.org/chromium.git
Patch Set: chrome fixes Created 10 years, 4 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_frame/test/perf/chrome_frame_perftest.cc ('k') | webkit/glue/plugins/plugin_list_win.cc » ('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
index 26d924b54d5fd7cbde651b63b51b10fa3c55f80e..bffb81a3b3cbe983ef0d331e5e42934e32aa28a6 100644
--- a/net/base/platform_mime_util_win.cc
+++ b/net/base/platform_mime_util_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 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.
@@ -16,7 +16,8 @@ bool PlatformMimeUtil::GetPlatformMimeTypeFromExtension(
// check windows registry for file extension's mime type (registry key
// names are not case-sensitive).
std::wstring value, key = L"." + ext;
- RegKey(HKEY_CLASSES_ROOT, key.c_str()).ReadValue(L"Content Type", &value);
+ RegKey(HKEY_CLASSES_ROOT, key.c_str(), KEY_READ).ReadValue(L"Content Type",
+ &value);
if (!value.empty()) {
*result = WideToUTF8(value);
return true;
@@ -27,9 +28,10 @@ bool PlatformMimeUtil::GetPlatformMimeTypeFromExtension(
bool PlatformMimeUtil::GetPreferredExtensionForMimeType(
const std::string& mime_type, FilePath::StringType* ext) const {
std::wstring key(L"MIME\\Database\\Content Type\\" + UTF8ToWide(mime_type));
- if (!RegKey(HKEY_CLASSES_ROOT, key.c_str()).ReadValue(L"Extension", ext))
+ if (!RegKey(HKEY_CLASSES_ROOT, key.c_str(), KEY_READ).ReadValue(L"Extension",
+ ext)) {
return false;
-
+ }
// Strip off the leading dot, this should always be the case.
if (!ext->empty() && ext->at(0) == L'.')
ext->erase(ext->begin());
« no previous file with comments | « chrome_frame/test/perf/chrome_frame_perftest.cc ('k') | webkit/glue/plugins/plugin_list_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698