| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef CHROME_BROWSER_APPS_APP_SHIM_APP_SHIM_HOST_MAC_H_ | 5 #ifndef CHROME_BROWSER_APPS_APP_SHIM_APP_SHIM_HOST_MAC_H_ |
| 6 #define CHROME_BROWSER_APPS_APP_SHIM_APP_SHIM_HOST_MAC_H_ | 6 #define CHROME_BROWSER_APPS_APP_SHIM_APP_SHIM_HOST_MAC_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "base/threading/non_thread_safe.h" | 13 #include "base/threading/thread_checker.h" |
| 14 #include "chrome/browser/apps/app_shim/app_shim_handler_mac.h" | 14 #include "chrome/browser/apps/app_shim/app_shim_handler_mac.h" |
| 15 #include "ipc/ipc_listener.h" | 15 #include "ipc/ipc_listener.h" |
| 16 #include "ipc/ipc_sender.h" | 16 #include "ipc/ipc_sender.h" |
| 17 #include "mojo/edk/embedder/peer_connection.h" | 17 #include "mojo/edk/embedder/peer_connection.h" |
| 18 #include "mojo/edk/embedder/scoped_platform_handle.h" | 18 #include "mojo/edk/embedder/scoped_platform_handle.h" |
| 19 | 19 |
| 20 namespace IPC { | 20 namespace IPC { |
| 21 class ChannelProxy; | 21 class ChannelProxy; |
| 22 class Message; | 22 class Message; |
| 23 } // namespace IPC | 23 } // namespace IPC |
| 24 | 24 |
| 25 // This is the counterpart to AppShimController in | 25 // This is the counterpart to AppShimController in |
| 26 // chrome/app/chrome_main_app_mode_mac.mm. The AppShimHost owns itself, and is | 26 // chrome/app/chrome_main_app_mode_mac.mm. The AppShimHost owns itself, and is |
| 27 // destroyed when the app it corresponds to is closed or when the channel | 27 // destroyed when the app it corresponds to is closed or when the channel |
| 28 // connected to the app shim is closed. | 28 // connected to the app shim is closed. |
| 29 class AppShimHost : public IPC::Listener, | 29 class AppShimHost : public IPC::Listener, |
| 30 public IPC::Sender, | 30 public IPC::Sender, |
| 31 public apps::AppShimHandler::Host, | 31 public apps::AppShimHandler::Host { |
| 32 public base::NonThreadSafe { | |
| 33 public: | 32 public: |
| 34 AppShimHost(); | 33 AppShimHost(); |
| 35 ~AppShimHost() override; | 34 ~AppShimHost() override; |
| 36 | 35 |
| 37 // Creates a new server-side IPC channel at |handle|, which should contain a | 36 // Creates a new server-side IPC channel at |handle|, which should contain a |
| 38 // file descriptor of a channel created by an UnixDomainSocketAcceptor, | 37 // file descriptor of a channel created by an UnixDomainSocketAcceptor, |
| 39 // and begins listening for messages on it. | 38 // and begins listening for messages on it. |
| 40 void ServeChannel(mojo::edk::ScopedPlatformHandle handle); | 39 void ServeChannel(mojo::edk::ScopedPlatformHandle handle); |
| 41 | 40 |
| 42 protected: | 41 protected: |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 std::string GetAppId() const override; | 75 std::string GetAppId() const override; |
| 77 | 76 |
| 78 // Closes the channel and destroys the AppShimHost. | 77 // Closes the channel and destroys the AppShimHost. |
| 79 void Close(); | 78 void Close(); |
| 80 | 79 |
| 81 mojo::edk::PeerConnection peer_connection_; | 80 mojo::edk::PeerConnection peer_connection_; |
| 82 std::unique_ptr<IPC::ChannelProxy> channel_; | 81 std::unique_ptr<IPC::ChannelProxy> channel_; |
| 83 std::string app_id_; | 82 std::string app_id_; |
| 84 base::FilePath profile_path_; | 83 base::FilePath profile_path_; |
| 85 bool initial_launch_finished_; | 84 bool initial_launch_finished_; |
| 85 |
| 86 THREAD_CHECKER(thread_checker_); |
| 86 }; | 87 }; |
| 87 | 88 |
| 88 #endif // CHROME_BROWSER_APPS_APP_SHIM_APP_SHIM_HOST_MAC_H_ | 89 #endif // CHROME_BROWSER_APPS_APP_SHIM_APP_SHIM_HOST_MAC_H_ |
| OLD | NEW |