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

Side by Side Diff: chrome_frame/cfproxy.h

Issue 9838102: Remove ChromeProxy and friends. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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 | « no previous file | chrome_frame/cfproxy_factory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_FRAME_CFPROXY_H_
6 #define CHROME_FRAME_CFPROXY_H_
7 #pragma once
8
9 #include <windows.h>
10
11 #include <map> // for proxy factory
12 #include <vector>
13 #include <string>
14
15 #include "base/synchronization/lock.h"
16 #include "base/time.h" // for base::TimeDelta
17 #include "base/file_path.h"
18 #include "chrome/common/automation_constants.h"
19 #include "content/public/common/page_zoom.h"
20 #include "ipc/ipc_channel.h"
21
22 class ChromeProxyDelegate;
23 class ChromeProxyFactory;
24 class GURL;
25 struct ExternalTabSettings;
26 struct ProxyParams;
27
28 // Some callers of synchronous messages wants a context to be passed back
29 // in order to identify the call they made. Presumably one can make
30 // multiple sync calls of same type (as async) and want to identify what
31 // is what.
32 struct SyncMessageContext {
33 virtual ~SyncMessageContext() {}
34 };
35
36
37 /*
38 [activex] UIDelegate (UI_THREAD)
39 [activedoc] <---------------+
40 |
41 | ChromeProxy (UI_THREAD)
42 +----------------+ --------------> +-------+
43 URL_FETCHER <---------|ExternalTabProxy| |CFProxy|
44 +----------------+ +-------+
45 |
46 ^ |
47 | |
48 +-----------------------------+
49
50 ChromeProxyDelegate (IPC_THREAD)
51
52 */
53
54 // ChromeProxy is an abstract class. Is forwards the commands to an
55 // instance of the running Chromium browser.
56 // A pointer to ChromeProxy instance is obtained through a
57 // ChromeProxyFactory object.
58 class ChromeProxy {
59 public:
60 // General
61 virtual void RemoveBrowsingData(int remove_mask) = 0; // async
62 virtual void SetProxyConfig(const std::string& json_encoded_settings) = 0;
63
64 // Tab management.
65 virtual void CreateTab(ChromeProxyDelegate* delegate,
66 const ExternalTabSettings& settings) = 0;
67 virtual void ConnectTab(ChromeProxyDelegate* delegate, HWND hwnd,
68 uint64 cookie) = 0;
69 virtual void BlockTab(uint64 cookie) = 0;
70
71 // Tab related.
72 virtual void Tab_PostMessage(int tab, const std::string& message,
73 const std::string& origin,
74 const std::string& target) = 0;
75 virtual void Tab_Reload(int tab) = 0;
76 virtual void Tab_Stop(int tab) = 0;
77 virtual void Tab_SaveAs(int tab) = 0;
78 virtual void Tab_Print(int tab) = 0;
79 virtual void Tab_Cut(int tab) = 0;
80 virtual void Tab_Copy(int tab) = 0;
81 virtual void Tab_Paste(int tab) = 0;
82 virtual void Tab_SelectAll(int tab) = 0;
83 virtual void Tab_Find(int tab, const string16& search_string,
84 FindInPageDirection forward, FindInPageCase match_case,
85 bool find_next) = 0;
86 virtual void Tab_MenuCommand(int tab, int selected_command) = 0;
87
88 // UI
89 virtual void Tab_Zoom(int tab, content::PageZoom zoom_level) = 0;
90 virtual void Tab_FontSize(int tab, enum AutomationPageFontSize font_size) = 0;
91 virtual void Tab_SetInitialFocus(int tab,
92 bool reverse, bool restore_focus_to_view) = 0;
93 virtual void Tab_SetParentWindow(int tab) = 0;
94 virtual void Tab_Resize(int tab) = 0;
95 virtual void Tab_ProcessAccelerator(int tab, const MSG& msg) = 0;
96
97 // Misc.
98 virtual void Tab_OnHostMoved(int tab) = 0;
99 virtual void Tab_RunUnloadHandlers(int tab) = 0;
100 virtual void Tab_Navigate(int tab, const GURL& url, const GURL& referrer) = 0;
101 virtual void Tab_OverrideEncoding(int tab, const char* encoding) = 0;
102
103 protected:
104 // Accessible by ChromeProxyFactory
105 friend class ChromeProxyFactory;
106 virtual ~ChromeProxy() {}
107 virtual void Init(const ProxyParams& params) = 0;
108 virtual int AddDelegate(ChromeProxyDelegate* delegate) = 0;
109 virtual int RemoveDelegate(ChromeProxyDelegate* delegate) = 0;
110 };
111
112 // The object that uses ChromeProxy should implement ChromeProxyDelegate in
113 // order to get notified about important events/requests coming from the
114 // instance of Chromium.
115 // Allow only one delegate per tab, i.e. delegate can handle only a single tab.
116 // Note: all of the methods are invoked always in a background IPC thread.
117 class ChromeProxyDelegate : public IPC::Channel::Listener {
118 public:
119 enum DisconnectReason {
120 CHROME_EXE_LAUNCH_FAILED,
121 CHROME_EXE_LAUNCH_TIMEOUT,
122 CHANNEL_ERROR
123 };
124
125 virtual void Connected(ChromeProxy* proxy) = 0;
126 virtual void Disconnected() = 0;
127 virtual void PeerLost(ChromeProxy* proxy, DisconnectReason reason) = 0;
128 virtual int tab_handle() = 0; // to avoid reverse lookup :)
129
130 // Sync message responses.
131 virtual void Completed_CreateTab(bool success, HWND chrome_wnd,
132 HWND tab_window, int tab_handle, int session_id) = 0;
133 virtual void Completed_ConnectToTab(bool success, HWND chrome_window,
134 HWND tab_window, int tab_handle, int session_id) = 0;
135 virtual void Completed_Navigate(bool success,
136 enum AutomationMsg_NavigationResponseValues res) = 0;
137
138 protected:
139 ~ChromeProxyDelegate() {}
140 };
141
142 // a way to obtain a ChromeProxy implementation
143 struct ProxyParams {
144 std::string profile;
145 std::wstring extra_params;
146 FilePath profile_path;
147 base::TimeDelta timeout;
148 };
149
150 class ChromeProxyFactory {
151 public:
152 ChromeProxyFactory();
153 ~ChromeProxyFactory();
154 void GetProxy(ChromeProxyDelegate* delegate, const ProxyParams& params);
155 bool ReleaseProxy(ChromeProxyDelegate* delegate, const std::string& profile);
156 protected:
157 virtual ChromeProxy* CreateProxy();
158 typedef std::map<std::string, ChromeProxy*> ProxyMap;
159 ProxyMap proxies_;
160 base::Lock lock_;
161 };
162
163 #endif // CHROME_FRAME_CFPROXY_H_
OLDNEW
« no previous file with comments | « no previous file | chrome_frame/cfproxy_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698