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

Side by Side Diff: apps/app_shim/app_shim_host_mac.h

Issue 14579006: Start app shim when app launched. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comment 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
« no previous file with comments | « apps/app_shim/app_shim_handler_mac.h ('k') | apps/app_shim/app_shim_host_mac.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_WEB_APPLICATIONS_APP_SHIM_HOST_MAC_H_ 5 #ifndef CHROME_BROWSER_WEB_APPLICATIONS_APP_SHIM_HOST_MAC_H_
6 #define CHROME_BROWSER_WEB_APPLICATIONS_APP_SHIM_HOST_MAC_H_ 6 #define CHROME_BROWSER_WEB_APPLICATIONS_APP_SHIM_HOST_MAC_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "apps/app_shim/app_shim_handler_mac.h" 10 #include "apps/app_shim/app_shim_handler_mac.h"
11 #include "base/files/file_path.h"
11 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
12 #include "base/threading/non_thread_safe.h" 13 #include "base/threading/non_thread_safe.h"
13 #include "ipc/ipc_listener.h" 14 #include "ipc/ipc_listener.h"
14 #include "ipc/ipc_sender.h" 15 #include "ipc/ipc_sender.h"
15 16
16 class Profile; 17 class Profile;
17 18
18 namespace IPC { 19 namespace IPC {
19 struct ChannelHandle; 20 struct ChannelHandle;
20 class ChannelProxy; 21 class ChannelProxy;
(...skipping 13 matching lines...) Expand all
34 virtual ~AppShimHost(); 35 virtual ~AppShimHost();
35 36
36 // Creates a new server-side IPC channel at |handle|, which should contain a 37 // Creates a new server-side IPC channel at |handle|, which should contain a
37 // file descriptor of a channel created by an IPC::ChannelFactory, and begins 38 // file descriptor of a channel created by an IPC::ChannelFactory, and begins
38 // listening for messages on it. 39 // listening for messages on it.
39 void ServeChannel(const IPC::ChannelHandle& handle); 40 void ServeChannel(const IPC::ChannelHandle& handle);
40 41
41 protected: 42 protected:
42 43
43 // Used internally; virtual so they can be mocked for testing. 44 // Used internally; virtual so they can be mocked for testing.
44 virtual Profile* FetchProfileForDirectory(const std::string& profile_dir); 45 virtual Profile* FetchProfileForDirectory(const base::FilePath& profile_dir);
45 46
46 // IPC::Listener implementation. 47 // IPC::Listener implementation.
47 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 48 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
48 virtual void OnChannelError() OVERRIDE; 49 virtual void OnChannelError() OVERRIDE;
49 50
50 // IPC::Sender implementation. 51 // IPC::Sender implementation.
51 virtual bool Send(IPC::Message* message) OVERRIDE; 52 virtual bool Send(IPC::Message* message) OVERRIDE;
52 53
53 private: 54 private:
54 // The app shim process is requesting that an app be launched. Once it has 55 // The app shim process is requesting to be associated with the given profile
55 // done so the |profile| and |app_id| are stored, and all future messages 56 // and app_id. Once the profile and app_id are stored, and all future
56 // from the app shim relate to the app it launched. It is an error for the 57 // messages from the app shim relate to this app. The app is launched
57 // app shim to send multiple launch messages. 58 // immediately if |launch_now| is true.
58 void OnLaunchApp(std::string profile, std::string app_id); 59 void OnLaunchApp(base::FilePath profile_dir,
60 std::string app_id,
61 apps::AppShimLaunchType launch_type);
59 62
60 // Called when the app shim process notifies that the app should be brought 63 // Called when the app shim process notifies that the app should be brought
61 // to the front (i.e. the user has clicked on the app's icon in the dock or 64 // to the front (i.e. the user has clicked on the app's icon in the dock or
62 // Cmd+Tabbed to it.) 65 // Cmd+Tabbed to it.)
63 void OnFocus(); 66 void OnFocus();
64 67
65 // Called when the app shim process notifies that the app should quit. 68 // Called when the app shim process notifies that the app should quit.
66 void OnQuit(); 69 void OnQuit();
67 70
68 // apps::AppShimHandler::Host overrides: 71 // apps::AppShimHandler::Host overrides:
69 virtual void OnAppClosed() OVERRIDE; 72 virtual void OnAppClosed() OVERRIDE;
70 virtual Profile* GetProfile() const OVERRIDE; 73 virtual Profile* GetProfile() const OVERRIDE;
71 virtual std::string GetAppId() const OVERRIDE; 74 virtual std::string GetAppId() const OVERRIDE;
72 75
73 // Closes the channel and destroys the AppShimHost. 76 // Closes the channel and destroys the AppShimHost.
74 void Close(); 77 void Close();
75 78
76 scoped_ptr<IPC::ChannelProxy> channel_; 79 scoped_ptr<IPC::ChannelProxy> channel_;
77 std::string app_id_; 80 std::string app_id_;
78 Profile* profile_; 81 Profile* profile_;
79 }; 82 };
80 83
81 #endif // CHROME_BROWSER_WEB_APPLICATIONS_APP_SHIM_HOST_MAC_H_ 84 #endif // CHROME_BROWSER_WEB_APPLICATIONS_APP_SHIM_HOST_MAC_H_
OLDNEW
« no previous file with comments | « apps/app_shim/app_shim_handler_mac.h ('k') | apps/app_shim/app_shim_host_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698