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

Unified Diff: remoting/host/it2me/it2me_native_messaging_host.cc

Issue 2847853003: Remove policy watching from It2MeHost. (Closed)
Patch Set: Reviewer feedback. Created 3 years, 8 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: remoting/host/it2me/it2me_native_messaging_host.cc
diff --git a/remoting/host/it2me/it2me_native_messaging_host.cc b/remoting/host/it2me/it2me_native_messaging_host.cc
index 9580d3d555249d70943723bdbeb25d8f6098a31c..1fe7d649e311ce4d53681031d845560aa5f389ce 100644
--- a/remoting/host/it2me/it2me_native_messaging_host.cc
+++ b/remoting/host/it2me/it2me_native_messaging_host.cc
@@ -320,6 +320,7 @@ void It2MeNativeMessagingHost::ProcessConnect(
it2me_host_ = factory_->CreateIt2MeHost(
host_context_->Copy(), policy_service_, weak_ptr_,
std::move(signal_strategy), username, directory_bot_jid);
+ it2me_host_->OnPolicyUpdate(policy_watcher_->GetCurrentPolicies());
rkjnsn 2017/05/04 20:45:45 Looking at the code, I realized that It2MeNativeMe
Jamie 2017/05/04 22:11:51 Given that It2MeNativeMessagingHost is currently c
it2me_host_->Connect();
SendMessageToClient(std::move(response));
@@ -469,30 +470,33 @@ std::string It2MeNativeMessagingHost::HostStateToString(
void It2MeNativeMessagingHost::OnPolicyUpdate(
std::unique_ptr<base::DictionaryValue> policies) {
- if (policy_received_) {
- // Don't dynamically change how the host operates since we don't have a good
- // way to communicate changes to the user.
- return;
- }
-
- bool allow_elevated_host = false;
- if (!policies->GetBoolean(
- policy::key::kRemoteAccessHostAllowUiAccessForRemoteAssistance,
- &allow_elevated_host)) {
- LOG(WARNING) << "Failed to retrieve elevated host policy value.";
- }
+ // Don't dynamically change the elevation status since we don't have a good
+ // way to communicate changes to the user.
+ if (!policy_received_) {
+ bool allow_elevated_host = false;
+ if (!policies->GetBoolean(
+ policy::key::kRemoteAccessHostAllowUiAccessForRemoteAssistance,
+ &allow_elevated_host)) {
+ LOG(WARNING) << "Failed to retrieve elevated host policy value.";
+ }
#if defined(OS_WIN)
- LOG(INFO) << "Allow UiAccess for Remote Assistance: " << allow_elevated_host;
+ LOG(INFO) << "Allow UiAccess for Remote Assistance: "
+ << allow_elevated_host;
#endif // defined(OS_WIN)
- policy_received_ = true;
+ policy_received_ = true;
- // If |allow_elevated_host| is false, then we will fall back to using a host
- // running in the current context regardless of the elevation request. This
- // may not be ideal, but is still functional.
- needs_elevation_ = needs_elevation_ && allow_elevated_host;
- if (!pending_connect_.is_null()) {
- base::ResetAndReturn(&pending_connect_).Run();
+ // If |allow_elevated_host| is false, then we will fall back to using a host
+ // running in the current context regardless of the elevation request. This
+ // may not be ideal, but is still functional.
+ needs_elevation_ = needs_elevation_ && allow_elevated_host;
+ if (!pending_connect_.is_null()) {
+ base::ResetAndReturn(&pending_connect_).Run();
+ }
+ }
+
+ if (it2me_host_.get()) {
+ it2me_host_->OnPolicyUpdate(std::move(policies));
}
}
« no previous file with comments | « remoting/host/it2me/it2me_native_messaging_host.h ('k') | remoting/host/it2me/it2me_native_messaging_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698