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

Unified Diff: remoting/host/setup/me2me_native_messaging_host.h

Issue 2149983003: Refactoring Elevated Host Communication Channel into its own class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@process_helper
Patch Set: Merging upstream changes. Created 4 years, 4 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
« no previous file with comments | « remoting/host/BUILD.gn ('k') | remoting/host/setup/me2me_native_messaging_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/setup/me2me_native_messaging_host.h
diff --git a/remoting/host/setup/me2me_native_messaging_host.h b/remoting/host/setup/me2me_native_messaging_host.h
index abc137f230dfe4875ea57bf5c1a136b4533bf698..181dae5a7c4e6e31a33bffe4ebaf29db06eed3f4 100644
--- a/remoting/host/setup/me2me_native_messaging_host.h
+++ b/remoting/host/setup/me2me_native_messaging_host.h
@@ -13,10 +13,8 @@
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/threading/thread_checker.h"
-#include "base/timer/timer.h"
#include "build/build_config.h"
#include "extensions/browser/api/messaging/native_message_host.h"
-#include "extensions/browser/api/messaging/native_messaging_channel.h"
#include "remoting/host/setup/daemon_controller.h"
#include "remoting/host/setup/oauth_client.h"
@@ -24,6 +22,7 @@ namespace base {
class DictionaryValue;
class ListValue;
class SingleThreadTaskRunner;
+class Value;
} // namespace base
namespace gaia {
@@ -37,6 +36,7 @@ class PairingRegistry;
} // namespace protocol
class ChromotingHostContext;
+class ElevatedNativeMessagingHost;
class LogMessageHandler;
// Implementation of the me2me native messaging host.
@@ -120,48 +120,15 @@ class Me2MeNativeMessagingHost : public extensions::NativeMessageHost {
void OnError(const std::string& error_message);
- // Returns true if the request was successfully delegated to the elevated
- // host and false otherwise.
+ // Returns whether the request was successfully sent to the elevated host.
bool DelegateToElevatedHost(std::unique_ptr<base::DictionaryValue> message);
-#if defined(OS_WIN)
- class ElevatedChannelEventHandler
- : public extensions::NativeMessagingChannel::EventHandler {
- public:
- ElevatedChannelEventHandler(extensions::NativeMessageHost::Client* client);
-
- // extensions::NativeMessagingChannel::EventHandler implementation.
- void OnMessage(std::unique_ptr<base::Value> message) override;
- void OnDisconnect() override;
-
- private:
- extensions::NativeMessageHost::Client* client_;
-
- base::ThreadChecker thread_checker_;
- };
-
- // Create and connect to an elevated host process if necessary.
- // |elevated_channel_| will contain the native messaging channel to the
- // elevated host if the function succeeds.
- void EnsureElevatedHostCreated();
-
- // Disconnect and shut down the elevated host.
- void DisconnectElevatedHost();
-
- // Native messaging channel used to communicate with the elevated host.
- std::unique_ptr<extensions::NativeMessagingChannel> elevated_channel_;
-
- // Native messaging event handler used to process responses from the elevated
- // host.
- std::unique_ptr<ElevatedChannelEventHandler> elevated_channel_event_handler_;
-
- // Timer to control the lifetime of the elevated host.
- base::OneShotTimer elevated_host_timer_;
-#endif // defined(OS_WIN)
-
bool needs_elevation_;
#if defined(OS_WIN)
+ // Controls the lifetime of the elevated native messaging host process.
+ std::unique_ptr<ElevatedNativeMessagingHost> elevated_host_;
+
// Handle of the parent window.
intptr_t parent_window_handle_;
#endif // defined(OS_WIN)
« no previous file with comments | « remoting/host/BUILD.gn ('k') | remoting/host/setup/me2me_native_messaging_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698