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

Side by Side Diff: chrome/browser/rlz/rlz.cc

Issue 193047: Fix to use FilePath version of PathService::Get.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 3 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 // This code glues the RLZ library DLL with Chrome. It allows Chrome to work 5 // This code glues the RLZ library DLL with Chrome. It allows Chrome to work
6 // with or without the DLL being present. If the DLL is not present the 6 // with or without the DLL being present. If the DLL is not present the
7 // functions do nothing and just return false. 7 // functions do nothing and just return false.
8 8
9 #include "chrome/browser/rlz/rlz.h" 9 #include "chrome/browser/rlz/rlz.h"
10 10
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 ClearAllProductEventsFn clear_all_events = NULL; 73 ClearAllProductEventsFn clear_all_events = NULL;
74 SendFinancialPingFn send_ping = NULL; 74 SendFinancialPingFn send_ping = NULL;
75 75
76 template <typename FuncT> 76 template <typename FuncT>
77 FuncT WireExport(HMODULE module, const char* export_name) { 77 FuncT WireExport(HMODULE module, const char* export_name) {
78 void* entry_point = ::GetProcAddress(module, export_name); 78 void* entry_point = ::GetProcAddress(module, export_name);
79 return (module)? reinterpret_cast<FuncT>(entry_point) : NULL; 79 return (module)? reinterpret_cast<FuncT>(entry_point) : NULL;
80 } 80 }
81 81
82 HMODULE LoadRLZLibraryInternal(int directory_key) { 82 HMODULE LoadRLZLibraryInternal(int directory_key) {
83 std::wstring rlz_path; 83 FilePath rlz_path;
84 if (!PathService::Get(directory_key, &rlz_path)) 84 if (!PathService::Get(directory_key, &rlz_path))
85 return NULL; 85 return NULL;
86 file_util::AppendToPath(&rlz_path, L"rlz.dll"); 86 rlz_path = rlz_path.AppendASCII("rlz.dll");
87 return ::LoadLibraryW(rlz_path.c_str()); 87 return ::LoadLibraryW(rlz_path.value().c_str());
88 } 88 }
89 89
90 bool LoadRLZLibrary(int directory_key) { 90 bool LoadRLZLibrary(int directory_key) {
91 rlz_dll = LoadRLZLibraryInternal(directory_key); 91 rlz_dll = LoadRLZLibraryInternal(directory_key);
92 if (!rlz_dll) { 92 if (!rlz_dll) {
93 // As a last resort we can try the EXE directory. 93 // As a last resort we can try the EXE directory.
94 if (directory_key != base::DIR_EXE) 94 if (directory_key != base::DIR_EXE)
95 rlz_dll = LoadRLZLibraryInternal(base::DIR_EXE); 95 rlz_dll = LoadRLZLibraryInternal(base::DIR_EXE);
96 } 96 }
97 if (rlz_dll) { 97 if (rlz_dll) {
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 // Schedule the daily RLZ ping. 254 // Schedule the daily RLZ ping.
255 base::Thread* thread = g_browser_process->file_thread(); 255 base::Thread* thread = g_browser_process->file_thread();
256 if (thread) 256 if (thread)
257 thread->message_loop()->PostTask(FROM_HERE, new DailyPingTask()); 257 thread->message_loop()->PostTask(FROM_HERE, new DailyPingTask());
258 } 258 }
259 259
260 private: 260 private:
261 bool IsGoogleDefaultSearch() { 261 bool IsGoogleDefaultSearch() {
262 if (!g_browser_process) 262 if (!g_browser_process)
263 return false; 263 return false;
264 std::wstring user_data_dir; 264 FilePath user_data_dir;
265 if (!PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) 265 if (!PathService::Get(chrome::DIR_USER_DATA, &user_data_dir))
266 return false; 266 return false;
267 ProfileManager* profile_manager = g_browser_process->profile_manager(); 267 ProfileManager* profile_manager = g_browser_process->profile_manager();
268 Profile* profile = profile_manager-> 268 Profile* profile = profile_manager->GetDefaultProfile(user_data_dir);
269 GetDefaultProfile(FilePath::FromWStringHack(user_data_dir));
270 if (!profile) 269 if (!profile)
271 return false; 270 return false;
272 const TemplateURL* url_template = 271 const TemplateURL* url_template =
273 profile->GetTemplateURLModel()->GetDefaultSearchProvider(); 272 profile->GetTemplateURLModel()->GetDefaultSearchProvider();
274 if (!url_template) 273 if (!url_template)
275 return false; 274 return false;
276 return url_template->url()->HasGoogleBaseURLs(); 275 return url_template->url()->HasGoogleBaseURLs();
277 } 276 }
278 277
279 int directory_key_; 278 int directory_key_;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 cached_ommibox_rlz.assign(str_rlz); 335 cached_ommibox_rlz.assign(str_rlz);
337 } 336 }
338 *rlz = str_rlz; 337 *rlz = str_rlz;
339 return true; 338 return true;
340 } 339 }
341 340
342 // static 341 // static
343 void RLZTracker::CleanupRlz() { 342 void RLZTracker::CleanupRlz() {
344 OmniBoxUsageObserver::DeleteInstance(); 343 OmniBoxUsageObserver::DeleteInstance();
345 } 344 }
OLDNEW
« no previous file with comments | « chrome/browser/process_singleton_win.cc ('k') | chrome/browser/safe_browsing/safe_browsing_database_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698