diff options
author | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-20 03:20:17 +0000 |
---|---|---|
committer | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-20 03:20:17 +0000 |
commit | 91e76bb06b98e6c00233eecd0984cf56b3efdfeb (patch) | |
tree | dd84aa58a9a8fb3297814266fed5d1d5bbb08724 /chrome | |
parent | 97f973c80b84b13e9df161ed3fa1874217fb25a1 (diff) | |
download | chromium_src-91e76bb06b98e6c00233eecd0984cf56b3efdfeb.zip chromium_src-91e76bb06b98e6c00233eecd0984cf56b3efdfeb.tar.gz chromium_src-91e76bb06b98e6c00233eecd0984cf56b3efdfeb.tar.bz2 |
Make user_data_manager.cc compile on Posix.
Review URL: http://codereview.chromium.org/20525
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10074 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/browser.scons | 1 | ||||
-rw-r--r-- | chrome/browser/browser_main.cc | 2 | ||||
-rw-r--r-- | chrome/browser/user_data_manager.cc | 34 | ||||
-rw-r--r-- | chrome/browser/user_data_manager.h | 4 | ||||
-rw-r--r-- | chrome/chrome.xcodeproj/project.pbxproj | 4 | ||||
-rw-r--r-- | chrome/common/temp_scaffolding_stubs.cc | 15 | ||||
-rw-r--r-- | chrome/common/temp_scaffolding_stubs.h | 11 |
7 files changed, 24 insertions, 47 deletions
diff --git a/chrome/browser/browser.scons b/chrome/browser/browser.scons index f5cfd12..22ca12f 100644 --- a/chrome/browser/browser.scons +++ b/chrome/browser/browser.scons @@ -741,7 +741,6 @@ if not env.Bit('windows'): 'task_manager.cc', 'task_manager_resource_providers.cc', 'toolbar_model.cc', - 'user_data_manager.cc', 'views/download_tab_view.cc', 'window_sizer.cc', ) diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc index c68d4a6..2fc22bb 100644 --- a/chrome/browser/browser_main.cc +++ b/chrome/browser/browser_main.cc @@ -33,6 +33,7 @@ #include "chrome/browser/net/dns_global.h" #include "chrome/browser/profile_manager.h" #include "chrome/browser/shell_integration.h" +#include "chrome/browser/user_data_manager.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" @@ -78,7 +79,6 @@ #include "chrome/browser/profile.h" #include "chrome/browser/profile_manager.h" #include "chrome/browser/rlz/rlz.h" -#include "chrome/browser/user_data_manager.h" #include "chrome/browser/views/user_data_dir_dialog.h" #include "chrome/common/env_vars.h" #include "chrome/common/win_util.h" diff --git a/chrome/browser/user_data_manager.cc b/chrome/browser/user_data_manager.cc index bc078db..0914b5c 100644 --- a/chrome/browser/user_data_manager.cc +++ b/chrome/browser/user_data_manager.cc @@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "build/build_config.h" + #include "chrome/browser/user_data_manager.h" -#include <windows.h> #include <string> -#include "base/command_line.h" #include "base/file_util.h" #include "base/logging.h" #include "base/message_loop.h" @@ -20,7 +20,11 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/l10n_util.h" #include "chrome/installer/util/browser_distribution.h" + +#if defined(OS_WIN) +#include <windows.h> #include "chrome/installer/util/shell_util.h" +#endif #include "chromium_strings.h" @@ -57,12 +61,10 @@ class LaunchChromeForProfileIndexHelper : GetProfilesHelper::Delegate { LaunchChromeForProfileIndexHelper::LaunchChromeForProfileIndexHelper( const UserDataManager* manager, int index) - : manager_(manager), - index_(index), -// Don't complain about using "this" in initializer list. -MSVC_PUSH_DISABLE_WARNING(4355) - profiles_helper_(new GetProfilesHelper(this)) { -MSVC_POP_WARNING() + : index_(index), + manager_(manager), + ALLOW_THIS_IN_INITIALIZER_LIST( + profiles_helper_(new GetProfilesHelper(this))) { DCHECK(manager); } @@ -175,7 +177,7 @@ std::wstring UserDataManager::GetUserDataFolderForProfile( return folder_path; } -std::wstring UserDataManager::GetCommandForProfile( +void UserDataManager::LaunchChromeForProfile( const std::wstring& profile_name) const { std::wstring user_data_dir = GetUserDataFolderForProfile(profile_name); std::wstring command; @@ -187,13 +189,7 @@ std::wstring UserDataManager::GetCommandForProfile( PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); command_line.AppendSwitchWithValue(switches::kParentProfile, local_state_path); - return command_line.command_line_string(); -} - -void UserDataManager::LaunchChromeForProfile( - const std::wstring& profile_name) const { - std::wstring command = GetCommandForProfile(profile_name); - base::LaunchApp(command, false, false, NULL); + base::LaunchApp(command_line, false, false, NULL); } void UserDataManager::LaunchChromeForProfile(int index) const { @@ -221,6 +217,7 @@ void UserDataManager::GetProfiles(std::vector<std::wstring>* profiles) const { bool UserDataManager::CreateDesktopShortcutForProfile( const std::wstring& profile_name) const { +#if defined(OS_WIN) std::wstring exe_path; std::wstring shortcut_path; if (!PathService::Get(base::FILE_EXE, &exe_path) || @@ -253,6 +250,11 @@ bool UserDataManager::CreateDesktopShortcutForProfile( NULL, exe_path.c_str(), 0); +#else + // TODO(port): should probably use freedesktop.org standard for desktop files. + NOTIMPLEMENTED(); + return false; +#endif } GetProfilesHelper::GetProfilesHelper(Delegate* delegate) diff --git a/chrome/browser/user_data_manager.h b/chrome/browser/user_data_manager.h index f688448..733767e 100644 --- a/chrome/browser/user_data_manager.h +++ b/chrome/browser/user_data_manager.h @@ -14,6 +14,7 @@ #include "base/basictypes.h" #include "base/ref_counted.h" +class CommandLine; class MessageLoop; // Provides an abstraction of profiles on top of the user data directory @@ -80,9 +81,6 @@ class UserDataManager { std::wstring GetUserDataFolderForProfile( const std::wstring& profile_name) const; - // Returns the command to start the app in the given profile. - std::wstring GetCommandForProfile(const std::wstring& profile_name) const; - // Shared instance. static UserDataManager* instance_; diff --git a/chrome/chrome.xcodeproj/project.pbxproj b/chrome/chrome.xcodeproj/project.pbxproj index 706b762..899bc54 100644 --- a/chrome/chrome.xcodeproj/project.pbxproj +++ b/chrome/chrome.xcodeproj/project.pbxproj @@ -76,6 +76,7 @@ /* Begin PBXBuildFile section */ 0D71821EDDA2629232DE3AD9 /* safe_browsing_blocking_page.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D7BFADB0E9D49DE009A6919 /* safe_browsing_blocking_page.cc */; }; + 0ED14155E711F5BD0E6069ED /* user_data_manager.cc in Sources */ = {isa = PBXBuildFile; fileRef = 622534301BD3F4A908D426D0 /* user_data_manager.cc */; }; 0EE123B79B750A2FCEFB4569 /* history_backend_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D7BF9F00E9D48F7009A6919 /* history_backend_unittest.cc */; }; 0FF05474D5345CABC5C85B5F /* save_package_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D7BF9DC0E9D48CE009A6919 /* save_package_unittest.cc */; }; 1647A33CB5B4B14087BFF5C8 /* dns_global.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D7BFA680E9D4981009A6919 /* dns_global.cc */; }; @@ -2417,6 +2418,7 @@ 4F9429998AC2703984BAB828 /* resolve_proxy_msg_helper.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = resolve_proxy_msg_helper.cc; sourceTree = "<group>"; }; 534E66C30F311BEC0006B2B2 /* temp_scaffolding_stubs.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = temp_scaffolding_stubs.cc; sourceTree = "<group>"; }; 56E1D7DF17D327BFCB0B895D /* test_web_contents.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = test_web_contents.cc; path = tab_contents/test_web_contents.cc; sourceTree = "<group>"; }; + 622534301BD3F4A908D426D0 /* user_data_manager.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = user_data_manager.cc; sourceTree = "<group>"; }; 629BF493DEA096E2DD844F2B /* autofill_manager.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = autofill_manager.cc; sourceTree = "<group>"; }; 6447F24FADC63E58A44DB762 /* url_pattern.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = url_pattern.cc; path = extensions/url_pattern.cc; sourceTree = "<group>"; }; 699499C4FBA07FB2D7B298A2 /* user_script.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = user_script.cc; path = extensions/user_script.cc; sourceTree = "<group>"; }; @@ -3364,6 +3366,7 @@ 4D7BF9410E9D4839009A6919 /* task_manager_resource_providers.h */, 4D7BF94F0E9D4839009A6919 /* toolbar_model.cc */, 4D7BF9500E9D4839009A6919 /* toolbar_model.h */, + 622534301BD3F4A908D426D0 /* user_data_manager.cc */, 4D7BF95B0E9D4839009A6919 /* view_ids.h */, 4D7BF95F0E9D4839009A6919 /* visitedlink_master.cc */, 4D7BF9600E9D4839009A6919 /* visitedlink_master.h */, @@ -5532,6 +5535,7 @@ E48FB9790EC4EA410052B72B /* url_request_mock_http_job.cc in Sources */, E48FB97A0EC4EA4A0052B72B /* url_request_mock_net_error_job.cc in Sources */, E48FB97C0EC4EA540052B72B /* url_request_slow_download_job.cc in Sources */, + 0ED14155E711F5BD0E6069ED /* user_data_manager.cc in Sources */, B555B2250F21506B00F751B9 /* user_metrics.cc in Sources */, E46C42130F1D3DD200B393B8 /* user_script_master.cc in Sources */, 4D7BFA3E0E9D491B009A6919 /* visit_database.cc in Sources */, diff --git a/chrome/common/temp_scaffolding_stubs.cc b/chrome/common/temp_scaffolding_stubs.cc index bd4dfe2..6a1b9c3c 100644 --- a/chrome/common/temp_scaffolding_stubs.cc +++ b/chrome/common/temp_scaffolding_stubs.cc @@ -95,21 +95,6 @@ void AutocompleteMatch::ClassifyLocationInString( //-------------------------------------------------------------------------- -UserDataManager* UserDataManager::instance_ = NULL; - -UserDataManager* UserDataManager::Create() { - DCHECK(!instance_); - std::wstring user_data; - PathService::Get(chrome::DIR_USER_DATA, &user_data); - instance_ = new UserDataManager(user_data); - return instance_; -} - -UserDataManager* UserDataManager::Get() { - DCHECK(instance_); - return instance_; -} - bool ShellIntegration::SetAsDefaultBrowser() { NOTIMPLEMENTED(); return true; diff --git a/chrome/common/temp_scaffolding_stubs.h b/chrome/common/temp_scaffolding_stubs.h index 44a7f21..8913a27 100644 --- a/chrome/common/temp_scaffolding_stubs.h +++ b/chrome/common/temp_scaffolding_stubs.h @@ -169,17 +169,6 @@ class AutomationProviderList { } }; -class UserDataManager { - public: - static UserDataManager* Create(); - static UserDataManager* Get(); - - explicit UserDataManager(const std::wstring& user_data_root) { } - private: - // Shared instance. - static UserDataManager* instance_; -}; - namespace browser { void RegisterAllPrefs(PrefService*, PrefService*); } |