diff options
Diffstat (limited to 'chrome_frame')
-rw-r--r-- | chrome_frame/chrome_frame_automation.cc | 9 | ||||
-rw-r--r-- | chrome_frame/test/net/fake_external_tab.cc | 15 | ||||
-rw-r--r-- | chrome_frame/test/net/fake_external_tab.h | 2 | ||||
-rw-r--r-- | chrome_frame/test/perf/chrome_frame_perftest.cc | 9 | ||||
-rw-r--r-- | chrome_frame/utils.cc | 27 | ||||
-rw-r--r-- | chrome_frame/utils.h | 3 |
6 files changed, 18 insertions, 47 deletions
diff --git a/chrome_frame/chrome_frame_automation.cc b/chrome_frame/chrome_frame_automation.cc index e02173d..5286f773 100644 --- a/chrome_frame/chrome_frame_automation.cc +++ b/chrome_frame/chrome_frame_automation.cc @@ -17,6 +17,7 @@ #include "chrome/app/client_util.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_paths.h" +#include "chrome/common/chrome_paths_internal.h" #include "chrome/common/chrome_switches.h" #include "chrome/test/automation/tab_proxy.h" #include "chrome_frame/chrome_launcher.h" @@ -251,11 +252,11 @@ void ProxyFactory::CreateProxy(ProxyFactory::ProxyCacheEntry* entry, // Place the profile directory in // "<chrome_exe_path>\..\User Data\<profile-name>" if (!entry->profile_name.empty()) { - std::wstring profile_path; - if (GetUserProfileBaseDirectory(&profile_path)) { - file_util::AppendToPath(&profile_path, entry->profile_name); + FilePath profile_path; + if (chrome::GetChromeFrameUserDataDirectory(&profile_path)) { + profile_path = profile_path.Append(entry->profile_name); command_line->AppendSwitchWithValue(switches::kUserDataDir, - profile_path); + profile_path.value()); } else { // Can't get the profile dir :-( We need one to work, so fail. // We have no code for launch failure. diff --git a/chrome_frame/test/net/fake_external_tab.cc b/chrome_frame/test/net/fake_external_tab.cc index ab3437b..78430fe 100644 --- a/chrome_frame/test/net/fake_external_tab.cc +++ b/chrome_frame/test/net/fake_external_tab.cc @@ -21,11 +21,12 @@ #include "chrome/browser/browser_prefs.h" #include "chrome/browser/process_singleton.h" #include "chrome/browser/profile_manager.h" +#include "chrome/browser/renderer_host/render_process_host.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_paths.h" +#include "chrome/common/chrome_paths_internal.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" -#include "chrome/browser/renderer_host/render_process_host.h" #include "chrome_frame/utils.h" #include "chrome_frame/test/chrome_frame_test_utils.h" @@ -68,7 +69,7 @@ bool PromptAfterSetup() { FakeExternalTab::FakeExternalTab() { PathService::Get(chrome::DIR_USER_DATA, &overridden_user_dir_); - user_data_dir_ = FilePath::FromWStringHack(GetProfilePath()); + GetProfilePath(&user_data_dir_); PathService::Override(chrome::DIR_USER_DATA, user_data_dir_); process_singleton_.reset(new ProcessSingleton(user_data_dir_)); } @@ -83,11 +84,11 @@ std::wstring FakeExternalTab::GetProfileName() { return L"iexplore"; } -std::wstring FakeExternalTab::GetProfilePath() { - std::wstring path; - GetUserProfileBaseDirectory(&path); - file_util::AppendToPath(&path, GetProfileName()); - return path; +bool FakeExternalTab::GetProfilePath(FilePath* path) { + if (!chrome::GetChromeFrameUserDataDirectory(path)) + return false; + *path = path->Append(GetProfileName()); + return true; } void FakeExternalTab::Initialize() { diff --git a/chrome_frame/test/net/fake_external_tab.h b/chrome_frame/test/net/fake_external_tab.h index 79e45cf..bd67a7f 100644 --- a/chrome_frame/test/net/fake_external_tab.h +++ b/chrome_frame/test/net/fake_external_tab.h @@ -28,7 +28,7 @@ class FakeExternalTab { virtual std::wstring GetProfileName(); - virtual std::wstring GetProfilePath(); + virtual bool GetProfilePath(FilePath* path); virtual void Initialize(); virtual void Shutdown(); diff --git a/chrome_frame/test/perf/chrome_frame_perftest.cc b/chrome_frame/test/perf/chrome_frame_perftest.cc index c896fa4..215f076 100644 --- a/chrome_frame/test/perf/chrome_frame_perftest.cc +++ b/chrome_frame/test/perf/chrome_frame_perftest.cc @@ -20,6 +20,7 @@ #include "base/time.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_paths.h" +#include "chrome/common/chrome_paths_internal.h" #include "chrome/test/chrome_process_util.h" #include "chrome/test/perf/mem_usage.h" #include "chrome/test/ui/ui_test.h" @@ -638,13 +639,11 @@ class ChromeFrameMemoryTest : public ChromeFramePerfTestBase { void InitiateNextNavigation() { if (browser_pid_ == 0) { - std::wstring profile_directory; - if (GetUserProfileBaseDirectory(&profile_directory)) { - file_util::AppendToPath(&profile_directory, - GetHostProcessName(false)); + FilePath profile_directory; + if (chrome::GetChromeFrameUserDataDirectory(&user_data_dir_)) { + user_data_dir_ = user_data_dir_.Append(GetHostProcessName(false)); } - user_data_dir_ = FilePath::FromWStringHack(profile_directory); browser_pid_ = ChromeBrowserProcessId(user_data_dir_); } diff --git a/chrome_frame/utils.cc b/chrome_frame/utils.cc index fdcb7c7..746a260 100644 --- a/chrome_frame/utils.cc +++ b/chrome_frame/utils.cc @@ -14,8 +14,6 @@ #include "base/registry.h" #include "base/scoped_comptr_win.h" #include "base/string_util.h" -#include "chrome/common/chrome_constants.h" -#include "chrome/installer/util/google_update_constants.h" #include "googleurl/src/gurl.h" #include "grit/chrome_frame_resources.h" #include "chrome_frame/resource.h" @@ -548,28 +546,3 @@ bool IsValidUrlScheme(const std::wstring& url, bool is_privileged) { return false; } - -// TODO(robertshield): Register and use Chrome's PathProviders. -// - Note that this function is used by unit tests as well to override -// PathService paths, so please test when addressing todo. -bool GetUserProfileBaseDirectory(std::wstring* path) { - DCHECK(path); - wchar_t path_buffer[MAX_PATH * 4]; - path_buffer[0] = 0; - // TODO(robertshield): Ideally we should use SHGetFolderLocation and then - // get a path via PIDL. - HRESULT hr = SHGetFolderPath(NULL, CSIDL_LOCAL_APPDATA, NULL, - SHGFP_TYPE_CURRENT, path_buffer); - - if (SUCCEEDED(hr)) { - *path = path_buffer; -#if defined(GOOGLE_CHROME_BUILD) - file_util::AppendToPath(path, FILE_PATH_LITERAL("Google")); -#endif - file_util::AppendToPath(path, chrome::kBrowserAppName); - file_util::AppendToPath(path, chrome::kUserDataDirname); - return true; - } - - return false; -} diff --git a/chrome_frame/utils.h b/chrome_frame/utils.h index 2f79013..fa6bec9 100644 --- a/chrome_frame/utils.h +++ b/chrome_frame/utils.h @@ -196,9 +196,6 @@ HRESULT GetUrlFromMoniker(IMoniker* moniker, IBindCtx* bind_context, // When is_privileged is true, chrome extension URLs will be considered valid. bool IsValidUrlScheme(const std::wstring& url, bool is_privileged); -// This returns the base directory in which to store user profiles. -bool GetUserProfileBaseDirectory(std::wstring* path); - // See COM_INTERFACE_BLIND_DELEGATE below for details. template <class T> STDMETHODIMP CheckOutgoingInterface(void* obj, REFIID iid, void** ret, |