summaryrefslogtreecommitdiffstats
path: root/chromeos/dbus
diff options
context:
space:
mode:
authorpastarmovj@chromium.org <pastarmovj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-17 23:35:51 +0000
committerpastarmovj@chromium.org <pastarmovj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-17 23:35:51 +0000
commit6d98abfebf4aace19996a876e2dd47b2559c38ab (patch)
treeedb00e52b840575b16dc90ea95ab7d0f2a1761db /chromeos/dbus
parentb8ae812b1bf122164de5f0f51c9ce4069b7fdfb9 (diff)
downloadchromium_src-6d98abfebf4aace19996a876e2dd47b2559c38ab.zip
chromium_src-6d98abfebf4aace19996a876e2dd47b2559c38ab.tar.gz
chromium_src-6d98abfebf4aace19996a876e2dd47b2559c38ab.tar.bz2
Restart Chrome if per session flags have been specified on ChromeOS.
After the profile is loaded we verify if the user has specfied any flags or if there were flags specified per policy that differ from the user specfied flags and in either case restart Chrome with the desired flags. This allows non-owners to use the about:flags page and prevents policy set flags from leaking inside user sessions. BUG=221352 TEST=unit_tests & Manually by specifying flags in non-owner session and observing them respected. Review URL: https://chromiumcodereview.appspot.com/16770002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@206832 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos/dbus')
-rw-r--r--chromeos/dbus/fake_session_manager_client.cc5
-rw-r--r--chromeos/dbus/fake_session_manager_client.h2
-rw-r--r--chromeos/dbus/mock_session_manager_client.h3
-rw-r--r--chromeos/dbus/session_manager_client.cc16
-rw-r--r--chromeos/dbus/session_manager_client.h7
5 files changed, 32 insertions, 1 deletions
diff --git a/chromeos/dbus/fake_session_manager_client.cc b/chromeos/dbus/fake_session_manager_client.cc
index 1450fbd..f20b719 100644
--- a/chromeos/dbus/fake_session_manager_client.cc
+++ b/chromeos/dbus/fake_session_manager_client.cc
@@ -126,6 +126,11 @@ void FakeSessionManagerClient::StoreDeviceLocalAccountPolicy(
base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind(callback, true));
}
+void FakeSessionManagerClient::SetFlagsForUser(
+ const std::string& username,
+ const std::vector<std::string>& flags) {
+}
+
const std::string& FakeSessionManagerClient::device_policy() const {
return device_policy_;
}
diff --git a/chromeos/dbus/fake_session_manager_client.h b/chromeos/dbus/fake_session_manager_client.h
index 044314f..1acd082 100644
--- a/chromeos/dbus/fake_session_manager_client.h
+++ b/chromeos/dbus/fake_session_manager_client.h
@@ -57,6 +57,8 @@ class FakeSessionManagerClient : public chromeos::SessionManagerClient {
const std::string& account_id,
const std::string& policy_blob,
const StorePolicyCallback& callback) OVERRIDE;
+ virtual void SetFlagsForUser(const std::string& username,
+ const std::vector<std::string>& flags) OVERRIDE;
const std::string& device_policy() const;
void set_device_policy(const std::string& policy_blob);
diff --git a/chromeos/dbus/mock_session_manager_client.h b/chromeos/dbus/mock_session_manager_client.h
index c57d5d1..1596951 100644
--- a/chromeos/dbus/mock_session_manager_client.h
+++ b/chromeos/dbus/mock_session_manager_client.h
@@ -51,6 +51,9 @@ class MockSessionManagerClient : public SessionManagerClient {
void(const std::string&,
const std::string&,
const StorePolicyCallback&));
+ MOCK_METHOD2(SetFlagsForUser,
+ void(const std::string&,
+ const std::vector<std::string>&));
};
} // namespace chromeos
diff --git a/chromeos/dbus/session_manager_client.cc b/chromeos/dbus/session_manager_client.cc
index d7700e7..f610275 100644
--- a/chromeos/dbus/session_manager_client.cc
+++ b/chromeos/dbus/session_manager_client.cc
@@ -271,6 +271,19 @@ class SessionManagerClientImpl : public SessionManagerClient {
callback);
}
+ virtual void SetFlagsForUser(const std::string& username,
+ const std::vector<std::string>& flags) OVERRIDE {
+ dbus::MethodCall method_call(login_manager::kSessionManagerInterface,
+ login_manager::kSessionManagerSetFlagsForUser);
+ dbus::MessageWriter writer(&method_call);
+ writer.AppendString(username);
+ writer.AppendArrayOfStrings(flags);
+ session_manager_proxy_->CallMethod(
+ &method_call,
+ dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
+ dbus::ObjectProxy::EmptyResponseCallback());
+ }
+
private:
// Makes a method call to the session manager with no arguments and no
// response.
@@ -597,6 +610,9 @@ class SessionManagerClientStubImpl : public SessionManagerClient {
user_policies_[account_name] = policy_blob;
callback.Run(true);
}
+ virtual void SetFlagsForUser(const std::string& username,
+ const std::vector<std::string>& flags) OVERRIDE {
+ }
static void StoreFileInBackground(const base::FilePath& path,
const std::string& data) {
diff --git a/chromeos/dbus/session_manager_client.h b/chromeos/dbus/session_manager_client.h
index 70ca3f4..ca10707 100644
--- a/chromeos/dbus/session_manager_client.h
+++ b/chromeos/dbus/session_manager_client.h
@@ -15,7 +15,7 @@
namespace dbus {
class Bus;
-} // namespace
+} // namespace dbus
namespace chromeos {
@@ -158,6 +158,11 @@ class CHROMEOS_EXPORT SessionManagerClient {
const std::string& policy_blob,
const StorePolicyCallback& callback) = 0;
+ // Sets the flags to be applied next time by the session manager when Chrome
+ // is restarted inside an already started session for a particular user.
+ virtual void SetFlagsForUser(const std::string& username,
+ const std::vector<std::string>& flags) = 0;
+
// Creates the instance.
static SessionManagerClient* Create(DBusClientImplementationType type,
dbus::Bus* bus);