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

Side by Side Diff: chrome_frame/simple_resource_loader.cc

Issue 19052005: Move PathIsWritable, DirectoryExists, ContentsEqual, and TextContentsEqual to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 "chrome_frame/simple_resource_loader.h" 5 #include "chrome_frame/simple_resource_loader.h"
6 6
7 #include <atlbase.h> 7 #include <atlbase.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 base::FilePath* locales_path) { 141 base::FilePath* locales_path) {
142 DCHECK(locales_path); 142 DCHECK(locales_path);
143 143
144 base::FilePath module_path; 144 base::FilePath module_path;
145 PathService::Get(base::DIR_MODULE, &module_path); 145 PathService::Get(base::DIR_MODULE, &module_path);
146 *locales_path = module_path.Append(kLocalesDirName); 146 *locales_path = module_path.Append(kLocalesDirName);
147 147
148 // We may be residing in the "locales" directory's parent, or we might be 148 // We may be residing in the "locales" directory's parent, or we might be
149 // in a sibling directory. Move up one and look for Locales again in the 149 // in a sibling directory. Move up one and look for Locales again in the
150 // latter case. 150 // latter case.
151 if (!file_util::DirectoryExists(*locales_path)) { 151 if (!base::DirectoryExists(*locales_path)) {
152 *locales_path = module_path.DirName(); 152 *locales_path = module_path.DirName();
153 *locales_path = locales_path->Append(kLocalesDirName); 153 *locales_path = locales_path->Append(kLocalesDirName);
154 } 154 }
155 155
156 // Don't make a second check to see if the dir is in the parent. We'll notice 156 // Don't make a second check to see if the dir is in the parent. We'll notice
157 // and log that in LoadLocaleDll when we actually try loading DLLs. 157 // and log that in LoadLocaleDll when we actually try loading DLLs.
158 } 158 }
159 159
160 // static 160 // static
161 bool SimpleResourceLoader::IsValidLanguageTag( 161 bool SimpleResourceLoader::IsValidLanguageTag(
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 *dll_handle = locale_dll_handle; 218 *dll_handle = locale_dll_handle;
219 *language = dll_path.BaseName().RemoveExtension().value(); 219 *language = dll_path.BaseName().RemoveExtension().value();
220 *data_pack = cur_data_pack.release(); 220 *data_pack = cur_data_pack.release();
221 found_pack = true; 221 found_pack = true;
222 break; 222 break;
223 } else { 223 } else {
224 *data_pack = NULL; 224 *data_pack = NULL;
225 } 225 }
226 } 226 }
227 } 227 }
228 DCHECK(found_pack || file_util::DirectoryExists(locales_path)) 228 DCHECK(found_pack || base::DirectoryExists(locales_path))
229 << "Could not locate locales DLL directory."; 229 << "Could not locate locales DLL directory.";
230 return found_pack; 230 return found_pack;
231 } 231 }
232 232
233 std::wstring SimpleResourceLoader::GetLocalizedResource(int message_id) { 233 std::wstring SimpleResourceLoader::GetLocalizedResource(int message_id) {
234 if (!data_pack_) { 234 if (!data_pack_) {
235 DLOG(ERROR) << "locale resources are not loaded"; 235 DLOG(ERROR) << "locale resources are not loaded";
236 return std::wstring(); 236 return std::wstring();
237 } 237 }
238 238
(...skipping 23 matching lines...) Expand all
262 262
263 // static 263 // static
264 std::wstring SimpleResourceLoader::Get(int message_id) { 264 std::wstring SimpleResourceLoader::Get(int message_id) {
265 SimpleResourceLoader* loader = SimpleResourceLoader::GetInstance(); 265 SimpleResourceLoader* loader = SimpleResourceLoader::GetInstance();
266 return loader->GetLocalizedResource(message_id); 266 return loader->GetLocalizedResource(message_id);
267 } 267 }
268 268
269 HMODULE SimpleResourceLoader::GetResourceModuleHandle() { 269 HMODULE SimpleResourceLoader::GetResourceModuleHandle() {
270 return locale_dll_handle_; 270 return locale_dll_handle_;
271 } 271 }
OLDNEW
« no previous file with comments | « chrome/test/perf/frame_rate/frame_rate_tests.cc ('k') | chrome_frame/test/test_with_web_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698