diff options
author | stevenjb@chromium.org <stevenjb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-11 02:59:33 +0000 |
---|---|---|
committer | stevenjb@chromium.org <stevenjb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-11 02:59:33 +0000 |
commit | f73104ffcf1a682aa3214f4d983a3123bd569003 (patch) | |
tree | b2f23d0f33aad15dec82d36ffcaa93b7decc290b | |
parent | 51170c01e65a7fc493b907dc859c8f26f7d0d414 (diff) | |
download | chromium_src-f73104ffcf1a682aa3214f4d983a3123bd569003.zip chromium_src-f73104ffcf1a682aa3214f4d983a3123bd569003.tar.gz chromium_src-f73104ffcf1a682aa3214f4d983a3123bd569003.tar.bz2 |
Network related DefaultProfile changes
BUG=322682
Review URL: https://codereview.chromium.org/102423008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239981 0039d316-1c4b-4281-b951-d872f2087c98
7 files changed, 31 insertions, 27 deletions
diff --git a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc index 13279e8..17401ae 100644 --- a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc +++ b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc @@ -143,11 +143,11 @@ class StubLogin : public LoginStatusConsumer, StubLogin(std::string username, std::string password) : profile_prepared_(false) { authenticator_ = LoginUtils::Get()->CreateAuthenticator(this); + Profile* primary_profile = g_browser_process->profile_manager()-> + GetPrimaryUserProfileOrOffTheRecord(); authenticator_.get()->AuthenticateToLogin( - g_browser_process->profile_manager()->GetDefaultProfile(), - UserContext(username, - password, - std::string())); // auth_code + primary_profile, + UserContext(username, password, std::string() /* auth_code */)); } virtual ~StubLogin() { @@ -195,7 +195,7 @@ void RunAutoLaunchKioskApp() { ShowLoginWizard(chromeos::WizardController::kAppLaunchSplashScreenName); // Login screen is skipped but 'login-prompt-visible' signal is still needed. - LOG(INFO) << "Kiosk app auto launch >> login-prompt-visible"; + VLOG(1) << "Kiosk app auto launch >> login-prompt-visible"; DBusThreadManager::Get()->GetSessionManagerClient()-> EmitLoginPromptVisible(); } @@ -369,9 +369,9 @@ void ChromeBrowserMainPartsChromeos::PreEarlyInitialization() { singleton_command_line->AppendSwitchASCII(switches::kLoginProfile, chrome::kTestUserProfileDir); } - LOG(INFO) << "Running as stub user with profile dir: " - << singleton_command_line->GetSwitchValuePath( - switches::kLoginProfile).value(); + LOG(WARNING) << "Running as stub user with profile dir: " + << singleton_command_line->GetSwitchValuePath( + switches::kLoginProfile).value(); } #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/browser/chromeos/dbus/proxy_resolution_service_provider.cc b/chrome/browser/chromeos/dbus/proxy_resolution_service_provider.cc index d2eb77a..c8a5920 100644 --- a/chrome/browser/chromeos/dbus/proxy_resolution_service_provider.cc +++ b/chrome/browser/chromeos/dbus/proxy_resolution_service_provider.cc @@ -92,9 +92,9 @@ class ProxyResolverImpl : public ProxyResolverInterface { request); all_requests_.insert(request); - // GetDefaultProfile() and GetRequestContext() must be called on UI + // GetPrimaryUserProfile() and GetRequestContext() must be called on UI // thread. - Profile* profile = ProfileManager::GetDefaultProfile(); + Profile* profile = ProfileManager::GetPrimaryUserProfileOrOffTheRecord(); scoped_refptr<net::URLRequestContextGetter> getter = profile->GetRequestContext(); diff --git a/chrome/browser/chromeos/enrollment_dialog_view.cc b/chrome/browser/chromeos/enrollment_dialog_view.cc index 9fb4714..3d69514 100644 --- a/chrome/browser/chromeos/enrollment_dialog_view.cc +++ b/chrome/browser/chromeos/enrollment_dialog_view.cc @@ -9,6 +9,7 @@ #include "chrome/browser/extensions/extension_host.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" +#include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/browser_navigator.h" #include "chromeos/network/network_event_log.h" #include "chromeos/network/network_state.h" @@ -284,9 +285,11 @@ bool CreateDialog(const std::string& service_path, NET_LOG_USER("Enrolling", service_path); + Browser* browser = chrome::FindBrowserWithWindow(owning_window); + Profile* profile = browser ? browser->profile() : + ProfileManager::GetPrimaryUserProfileOrOffTheRecord(); DialogEnrollmentDelegate* enrollment = - new DialogEnrollmentDelegate(owning_window, network->name(), - ProfileManager::GetDefaultProfile()); + new DialogEnrollmentDelegate(owning_window, network->name(), profile); return enrollment->Enroll(certificate_pattern.enrollment_uri_list(), base::Bind(&EnrollmentComplete, service_path)); } diff --git a/chrome/browser/chromeos/options/network_config_view.cc b/chrome/browser/chromeos/options/network_config_view.cc index bea4c5c..f12c2a4 100644 --- a/chrome/browser/chromeos/options/network_config_view.cc +++ b/chrome/browser/chromeos/options/network_config_view.cc @@ -41,12 +41,12 @@ using views::Widget; namespace { -gfx::NativeWindow GetDialogParent() { +gfx::NativeWindow GetParentForUnhostedDialog() { if (chromeos::LoginDisplayHostImpl::default_host()) { return chromeos::LoginDisplayHostImpl::default_host()->GetNativeWindow(); } else { Browser* browser = chrome::FindTabbedBrowser( - ProfileManager::GetDefaultProfileOrOffTheRecord(), + ProfileManager::GetPrimaryUserProfileOrOffTheRecord(), true, chrome::HOST_DESKTOP_TYPE_ASH); if (browser) @@ -268,7 +268,7 @@ void NetworkConfigView::ViewHierarchyChanged( void NetworkConfigView::ShowDialog(gfx::NativeWindow parent) { if (parent == NULL) - parent = GetDialogParent(); + parent = GetParentForUnhostedDialog(); // Failed connections may result in a pop-up with no natural parent window, // so provide a fallback context on the primary display. This is necessary // becase one of parent or context must be non NULL. diff --git a/chrome/browser/chromeos/status/data_promo_notification.cc b/chrome/browser/chromeos/status/data_promo_notification.cc index dd93698..7d7841d 100644 --- a/chrome/browser/chromeos/status/data_promo_notification.cc +++ b/chrome/browser/chromeos/status/data_promo_notification.cc @@ -43,7 +43,7 @@ namespace { const int kNotificationCountPrefDefault = -1; bool GetBooleanPref(const char* pref_name) { - Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord(); + Profile* profile = ProfileManager::GetPrimaryUserProfileOrOffTheRecord(); PrefService* prefs = profile->GetPrefs(); return prefs->GetBoolean(pref_name); } @@ -54,7 +54,7 @@ int GetIntegerLocalPref(const char* pref_name) { } void SetBooleanPref(const char* pref_name, bool value) { - Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord(); + Profile* profile = ProfileManager::GetPrimaryUserProfileOrOffTheRecord(); PrefService* prefs = profile->GetPrefs(); prefs->SetBoolean(pref_name, value); } @@ -125,7 +125,7 @@ void NotificationClicked(const std::string& service_path, ash::network_connect::ShowNetworkSettings(service_path); chrome::ScopedTabbedBrowserDisplayer displayer( - ProfileManager::GetDefaultProfileOrOffTheRecord(), + ProfileManager::GetPrimaryUserProfileOrOffTheRecord(), chrome::HOST_DESKTOP_TYPE_ASH); chrome::ShowSingletonTab(displayer.browser(), GURL(info_url)); } diff --git a/chrome/browser/chromeos/system_logs/chrome_internal_log_source.cc b/chrome/browser/chromeos/system_logs/chrome_internal_log_source.cc index bfe14505..6da056f 100644 --- a/chrome/browser/chromeos/system_logs/chrome_internal_log_source.cc +++ b/chrome/browser/chromeos/system_logs/chrome_internal_log_source.cc @@ -44,9 +44,10 @@ void ChromeInternalLogSource::Fetch(const SysLogsSourceCallback& callback) { } void ChromeInternalLogSource::PopulateSyncLogs(SystemLogsResponse* response) { - Profile* profile = ProfileManager::GetDefaultProfile(); - if (!ProfileSyncServiceFactory::GetInstance()->HasProfileSyncService( - profile)) + // We are only interested in sync logs for the primary user profile. + Profile* profile = ProfileManager::GetPrimaryUserProfile(); + if (!profile || + !ProfileSyncServiceFactory::GetInstance()->HasProfileSyncService(profile)) return; ProfileSyncService* service = @@ -88,13 +89,13 @@ void ChromeInternalLogSource::PopulateExtensionInfoLogs( if (!reporting_enabled) return; - Profile* default_profile = - g_browser_process->profile_manager()->GetDefaultProfile(); - if (!default_profile) + Profile* primary_profile = + g_browser_process->profile_manager()->GetPrimaryUserProfile(); + if (!primary_profile) return; ExtensionService* service = - extensions::ExtensionSystem::Get(default_profile)->extension_service(); + extensions::ExtensionSystem::Get(primary_profile)->extension_service(); if (!service) return; diff --git a/chromeos/network/network_connection_handler.cc b/chromeos/network/network_connection_handler.cc index 9649f51..eb668b3 100644 --- a/chromeos/network/network_connection_handler.cc +++ b/chromeos/network/network_connection_handler.cc @@ -79,7 +79,7 @@ bool VPNRequiresCredentials(const std::string& service_path, return false; } -std::string GetDefaultProfilePath(const NetworkState* network) { +std::string GetDefaultUserProfilePath(const NetworkState* network) { if (!NetworkHandler::IsInitialized() || !LoginState::Get()->IsUserAuthenticated() || (network && network->type() == shill::kTypeWifi && @@ -256,7 +256,7 @@ void NetworkConnectionHandler::ConnectToNetwork( // indicate that it does not need to be set. std::string profile_path; if (!network || network->profile_path().empty()) - profile_path = GetDefaultProfilePath(network); + profile_path = GetDefaultUserProfilePath(network); // All synchronous checks passed, add |service_path| to connecting list. pending_requests_.insert(std::make_pair( |