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

Side by Side Diff: chrome/browser/devtools/devtools_ui_bindings.h

Issue 912863002: [DevTools] Remote JSON requests from javascript (Chromium side) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed test Created 5 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_DEVTOOLS_DEVTOOLS_UI_BINDINGS_H_ 5 #ifndef CHROME_BROWSER_DEVTOOLS_DEVTOOLS_UI_BINDINGS_H_
6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_UI_BINDINGS_H_ 6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_UI_BINDINGS_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "base/strings/string16.h" 14 #include "base/strings/string16.h"
15 #include "chrome/browser/devtools/device/devtools_android_bridge.h" 15 #include "chrome/browser/devtools/device/devtools_android_bridge.h"
16 #include "chrome/browser/devtools/devtools_embedder_message_dispatcher.h" 16 #include "chrome/browser/devtools/devtools_embedder_message_dispatcher.h"
17 #include "chrome/browser/devtools/devtools_file_helper.h" 17 #include "chrome/browser/devtools/devtools_file_helper.h"
18 #include "chrome/browser/devtools/devtools_file_system_indexer.h" 18 #include "chrome/browser/devtools/devtools_file_system_indexer.h"
19 #include "chrome/browser/devtools/devtools_targets_ui.h" 19 #include "chrome/browser/devtools/devtools_targets_ui.h"
20 #include "content/public/browser/devtools_agent_host.h" 20 #include "content/public/browser/devtools_agent_host.h"
21 #include "content/public/browser/devtools_frontend_host.h" 21 #include "content/public/browser/devtools_frontend_host.h"
22 #include "content/public/browser/notification_observer.h" 22 #include "content/public/browser/notification_observer.h"
23 #include "content/public/browser/notification_registrar.h" 23 #include "content/public/browser/notification_registrar.h"
24 #include "net/url_request/url_fetcher_delegate.h" 24 #include "net/url_request/url_fetcher_delegate.h"
25 #include "ui/gfx/geometry/size.h" 25 #include "ui/gfx/geometry/size.h"
26 26
27 class DevToolsAndroidBridge;
27 class InfoBarService; 28 class InfoBarService;
28 class Profile; 29 class Profile;
29 30
30 namespace content { 31 namespace content {
31 struct FileChooserParams; 32 struct FileChooserParams;
32 class WebContents; 33 class WebContents;
33 } 34 }
34 35
35 // Base implementation of DevTools bindings around front-end. 36 // Base implementation of DevTools bindings around front-end.
36 class DevToolsUIBindings : public content::NotificationObserver, 37 class DevToolsUIBindings : public content::NotificationObserver,
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 void SetWhitelistedShortcuts(const std::string& message) override; 129 void SetWhitelistedShortcuts(const std::string& message) override;
129 void ZoomIn() override; 130 void ZoomIn() override;
130 void ZoomOut() override; 131 void ZoomOut() override;
131 void ResetZoom() override; 132 void ResetZoom() override;
132 void OpenUrlOnRemoteDeviceAndInspect(const std::string& browser_id, 133 void OpenUrlOnRemoteDeviceAndInspect(const std::string& browser_id,
133 const std::string& url) override; 134 const std::string& url) override;
134 void SetDeviceCountUpdatesEnabled(bool enabled) override; 135 void SetDeviceCountUpdatesEnabled(bool enabled) override;
135 void SetDevicesUpdatesEnabled(bool enabled) override; 136 void SetDevicesUpdatesEnabled(bool enabled) override;
136 void SendMessageToBrowser(const std::string& message) override; 137 void SendMessageToBrowser(const std::string& message) override;
137 void RecordActionUMA(const std::string& name, int action) override; 138 void RecordActionUMA(const std::string& name, int action) override;
139 void SendJsonRequest(const DispatchCallback& callback,
140 const std::string& browser_id,
141 const std::string& url) override;
138 142
139 // net::URLFetcherDelegate overrides. 143 // net::URLFetcherDelegate overrides.
140 void OnURLFetchComplete(const net::URLFetcher* source) override; 144 void OnURLFetchComplete(const net::URLFetcher* source) override;
141 145
142 void EnableRemoteDeviceCounter(bool enable); 146 void EnableRemoteDeviceCounter(bool enable);
143 147
144 void SendMessageAck(int request_id, 148 void SendMessageAck(int request_id,
145 const base::Value* arg1); 149 const base::Value* arg1);
146 150
147 // DevToolsAndroidBridge::DeviceCountListener override: 151 // DevToolsAndroidBridge::DeviceCountListener override:
148 void DeviceCountChanged(int count) override; 152 void DeviceCountChanged(int count) override;
149 153
150 // Forwards discovered devices to frontend. 154 // Forwards discovered devices to frontend.
151 virtual void DevicesUpdated(const std::string& source, 155 virtual void DevicesUpdated(const std::string& source,
152 const base::ListValue& targets); 156 const base::ListValue& targets);
153 157
154 void DocumentOnLoadCompletedInMainFrame(); 158 void DocumentOnLoadCompletedInMainFrame();
155 void DidNavigateMainFrame(); 159 void DidNavigateMainFrame();
156 void FrontendLoaded(); 160 void FrontendLoaded();
157 161
162 void JsonReceived(const DispatchCallback& callback,
163 int result,
164 const std::string& message);
165
158 // DevToolsFileHelper callbacks. 166 // DevToolsFileHelper callbacks.
159 void FileSavedAs(const std::string& url); 167 void FileSavedAs(const std::string& url);
160 void CanceledFileSaveAs(const std::string& url); 168 void CanceledFileSaveAs(const std::string& url);
161 void AppendedTo(const std::string& url); 169 void AppendedTo(const std::string& url);
162 void FileSystemsLoaded( 170 void FileSystemsLoaded(
163 const std::vector<DevToolsFileHelper::FileSystem>& file_systems); 171 const std::vector<DevToolsFileHelper::FileSystem>& file_systems);
164 void FileSystemAdded(const DevToolsFileHelper::FileSystem& file_system); 172 void FileSystemAdded(const DevToolsFileHelper::FileSystem& file_system);
165 void IndexingTotalWorkCalculated(int request_id, 173 void IndexingTotalWorkCalculated(int request_id,
166 const std::string& file_system_path, 174 const std::string& file_system_path,
167 int total_work); 175 int total_work);
(...skipping 10 matching lines...) Expand all
178 186
179 // Theme and extensions support. 187 // Theme and extensions support.
180 void UpdateTheme(); 188 void UpdateTheme();
181 void AddDevToolsExtensionsToClient(); 189 void AddDevToolsExtensionsToClient();
182 190
183 class FrontendWebContentsObserver; 191 class FrontendWebContentsObserver;
184 friend class FrontendWebContentsObserver; 192 friend class FrontendWebContentsObserver;
185 scoped_ptr<FrontendWebContentsObserver> frontend_contents_observer_; 193 scoped_ptr<FrontendWebContentsObserver> frontend_contents_observer_;
186 194
187 Profile* profile_; 195 Profile* profile_;
196 DevToolsAndroidBridge* android_bridge_;
188 content::WebContents* web_contents_; 197 content::WebContents* web_contents_;
189 scoped_ptr<Delegate> delegate_; 198 scoped_ptr<Delegate> delegate_;
190 scoped_refptr<content::DevToolsAgentHost> agent_host_; 199 scoped_refptr<content::DevToolsAgentHost> agent_host_;
191 content::NotificationRegistrar registrar_; 200 content::NotificationRegistrar registrar_;
192 scoped_ptr<content::DevToolsFrontendHost> frontend_host_; 201 scoped_ptr<content::DevToolsFrontendHost> frontend_host_;
193 scoped_ptr<DevToolsFileHelper> file_helper_; 202 scoped_ptr<DevToolsFileHelper> file_helper_;
194 scoped_refptr<DevToolsFileSystemIndexer> file_system_indexer_; 203 scoped_refptr<DevToolsFileSystemIndexer> file_system_indexer_;
195 typedef std::map< 204 typedef std::map<
196 int, 205 int,
197 scoped_refptr<DevToolsFileSystemIndexer::FileSystemIndexingJob> > 206 scoped_refptr<DevToolsFileSystemIndexer::FileSystemIndexingJob> >
198 IndexingJobsMap; 207 IndexingJobsMap;
199 IndexingJobsMap indexing_jobs_; 208 IndexingJobsMap indexing_jobs_;
200 209
201 bool device_count_updates_enabled_; 210 bool device_count_updates_enabled_;
202 bool devices_updates_enabled_; 211 bool devices_updates_enabled_;
203 bool frontend_loaded_; 212 bool frontend_loaded_;
204 scoped_ptr<DevToolsTargetsUIHandler> remote_targets_handler_; 213 scoped_ptr<DevToolsTargetsUIHandler> remote_targets_handler_;
205 scoped_ptr<DevToolsEmbedderMessageDispatcher> embedder_message_dispatcher_; 214 scoped_ptr<DevToolsEmbedderMessageDispatcher> embedder_message_dispatcher_;
206 GURL url_; 215 GURL url_;
207 using PendingRequestsMap = std::map<const net::URLFetcher*, DispatchCallback>; 216 using PendingRequestsMap = std::map<const net::URLFetcher*, DispatchCallback>;
208 PendingRequestsMap pending_requests_; 217 PendingRequestsMap pending_requests_;
209 base::WeakPtrFactory<DevToolsUIBindings> weak_factory_; 218 base::WeakPtrFactory<DevToolsUIBindings> weak_factory_;
210 219
211 DISALLOW_COPY_AND_ASSIGN(DevToolsUIBindings); 220 DISALLOW_COPY_AND_ASSIGN(DevToolsUIBindings);
212 }; 221 };
213 222
214 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_UI_BINDINGS_H_ 223 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_UI_BINDINGS_H_
OLDNEW
« no previous file with comments | « chrome/browser/devtools/devtools_sanity_browsertest.cc ('k') | chrome/browser/devtools/devtools_ui_bindings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698