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

Unified Diff: chrome/browser/chromeos/extensions/networking_private_api.cc

Issue 14581006: [cros mp] Load profiles from /home/chronos/u-[$hash], add GetUserIdHashFromProfile() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/extensions/networking_private_api.cc
diff --git a/chrome/browser/chromeos/extensions/networking_private_api.cc b/chrome/browser/chromeos/extensions/networking_private_api.cc
index 850fbddb3904b1aeacfb8f1de4d1c01eb71ea0f8..aa946cfb36ea73b763fb67f4fdd575ac60a9c4b5 100644
--- a/chrome/browser/chromeos/extensions/networking_private_api.cc
+++ b/chrome/browser/chromeos/extensions/networking_private_api.cc
@@ -7,8 +7,12 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/callback.h"
+#include "base/command_line.h"
+#include "chrome/browser/browser_process.h"
+#include "chrome/browser/browser_process_platform_part_chromeos.h"
+#include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "chrome/browser/extensions/extension_function_registry.h"
-#include "chrome/browser/profiles/profile.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/api/networking_private.h"
#include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/dbus/shill_manager_client.h"
@@ -101,14 +105,18 @@ bool NetworkingPrivateGetManagedPropertiesFunction::RunImpl() {
api::GetManagedProperties::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params);
- // The profile of the requesting browser.
- Profile* requesting_profile = profile();
- // TODO(pneubeck): Use ProfileHelper to obtain the userhash, once it provides
- // that functionality. crbug/238623.
- std::string userhash = requesting_profile->GetPath().BaseName().value();
+ // User ID hash presence is only enforced when multi-profiles are turned on.
+ std::string user_id_hash;
+ if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kMultiProfiles)) {
+ user_id_hash = g_browser_process->platform_part()->
+ profile_helper()->GetUserIdHashFromProfile(profile());
+ } else {
+ user_id_hash = g_browser_process->platform_part()->
+ profile_helper()->active_user_id_hash();
+ }
ManagedNetworkConfigurationHandler::Get()->GetManagedProperties(
- userhash,
+ user_id_hash,
params->network_guid, // service path
base::Bind(&NetworkingPrivateGetManagedPropertiesFunction::Success,
this),

Powered by Google App Engine
This is Rietveld 408576698