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

Side by Side Diff: chromeos/dbus/session_manager_client.cc

Issue 16770002: Restart Chrome if per session flags have been specified on ChromeOS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased to ToT and addressed Nico's comments. Created 7 years, 6 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "chromeos/dbus/session_manager_client.h" 5 #include "chromeos/dbus/session_manager_client.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 const std::string& account_name, 264 const std::string& account_name,
265 const std::string& policy_blob, 265 const std::string& policy_blob,
266 const StorePolicyCallback& callback) OVERRIDE { 266 const StorePolicyCallback& callback) OVERRIDE {
267 CallStorePolicyByUsername( 267 CallStorePolicyByUsername(
268 login_manager::kSessionManagerStoreDeviceLocalAccountPolicy, 268 login_manager::kSessionManagerStoreDeviceLocalAccountPolicy,
269 account_name, 269 account_name,
270 policy_blob, 270 policy_blob,
271 callback); 271 callback);
272 } 272 }
273 273
274 virtual void SetFlagsForUser(const std::string& username,
275 const std::vector<std::string>& flags) OVERRIDE {
276 dbus::MethodCall method_call(login_manager::kSessionManagerInterface,
277 login_manager::kSessionManagerSetFlagsForUser);
278 dbus::MessageWriter writer(&method_call);
279 writer.AppendString(username);
280 writer.AppendArrayOfStrings(flags);
281 session_manager_proxy_->CallMethod(
282 &method_call,
283 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
284 dbus::ObjectProxy::EmptyResponseCallback());
285 }
286
274 private: 287 private:
275 // Makes a method call to the session manager with no arguments and no 288 // Makes a method call to the session manager with no arguments and no
276 // response. 289 // response.
277 void SimpleMethodCallToSessionManager(const std::string& method_name) { 290 void SimpleMethodCallToSessionManager(const std::string& method_name) {
278 dbus::MethodCall method_call(login_manager::kSessionManagerInterface, 291 dbus::MethodCall method_call(login_manager::kSessionManagerInterface,
279 method_name); 292 method_name);
280 session_manager_proxy_->CallMethod( 293 session_manager_proxy_->CallMethod(
281 &method_call, 294 &method_call,
282 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 295 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
283 dbus::ObjectProxy::EmptyResponseCallback()); 296 dbus::ObjectProxy::EmptyResponseCallback());
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 base::Bind(callback, true), 603 base::Bind(callback, true),
591 false); 604 false);
592 } 605 }
593 virtual void StoreDeviceLocalAccountPolicy( 606 virtual void StoreDeviceLocalAccountPolicy(
594 const std::string& account_name, 607 const std::string& account_name,
595 const std::string& policy_blob, 608 const std::string& policy_blob,
596 const StorePolicyCallback& callback) OVERRIDE { 609 const StorePolicyCallback& callback) OVERRIDE {
597 user_policies_[account_name] = policy_blob; 610 user_policies_[account_name] = policy_blob;
598 callback.Run(true); 611 callback.Run(true);
599 } 612 }
613 virtual void SetFlagsForUser(const std::string& username,
614 const std::vector<std::string>& flags) OVERRIDE {
615 }
600 616
601 static void StoreFileInBackground(const base::FilePath& path, 617 static void StoreFileInBackground(const base::FilePath& path,
602 const std::string& data) { 618 const std::string& data) {
603 const int size = static_cast<int>(data.size()); 619 const int size = static_cast<int>(data.size());
604 if (!file_util::CreateDirectory(path.DirName()) || 620 if (!file_util::CreateDirectory(path.DirName()) ||
605 file_util::WriteFile(path, data.data(), size) != size) { 621 file_util::WriteFile(path, data.data(), size) != size) {
606 LOG(WARNING) << "Failed to write policy key to " << path.value(); 622 LOG(WARNING) << "Failed to write policy key to " << path.value();
607 } 623 }
608 } 624 }
609 625
(...skipping 14 matching lines...) Expand all
624 SessionManagerClient* SessionManagerClient::Create( 640 SessionManagerClient* SessionManagerClient::Create(
625 DBusClientImplementationType type, 641 DBusClientImplementationType type,
626 dbus::Bus* bus) { 642 dbus::Bus* bus) {
627 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) 643 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION)
628 return new SessionManagerClientImpl(bus); 644 return new SessionManagerClientImpl(bus);
629 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); 645 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type);
630 return new SessionManagerClientStubImpl(); 646 return new SessionManagerClientStubImpl();
631 } 647 }
632 648
633 } // namespace chromeos 649 } // namespace chromeos
OLDNEW
« chrome/browser/chromeos/login/login_utils.cc ('K') | « chromeos/dbus/session_manager_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698