OLD | NEW |
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 <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "content/public/browser/devtools_frontend_host.h" | 22 #include "content/public/browser/devtools_frontend_host.h" |
23 #include "net/url_request/url_fetcher_delegate.h" | 23 #include "net/url_request/url_fetcher_delegate.h" |
24 #include "ui/gfx/geometry/size.h" | 24 #include "ui/gfx/geometry/size.h" |
25 | 25 |
26 class DevToolsAndroidBridge; | 26 class DevToolsAndroidBridge; |
27 class InfoBarService; | 27 class InfoBarService; |
28 class Profile; | 28 class Profile; |
29 class PortForwardingStatusSerializer; | 29 class PortForwardingStatusSerializer; |
30 | 30 |
31 namespace content { | 31 namespace content { |
| 32 class NavigationHandle; |
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 DevToolsEmbedderMessageDispatcher::Delegate, | 37 class DevToolsUIBindings : public DevToolsEmbedderMessageDispatcher::Delegate, |
37 public DevToolsAndroidBridge::DeviceCountListener, | 38 public DevToolsAndroidBridge::DeviceCountListener, |
38 public content::DevToolsAgentHostClient, | 39 public content::DevToolsAgentHostClient, |
39 public net::URLFetcherDelegate, | 40 public net::URLFetcherDelegate, |
40 public DevToolsFileHelper::Delegate { | 41 public DevToolsFileHelper::Delegate { |
41 public: | 42 public: |
42 static DevToolsUIBindings* ForWebContents( | 43 static DevToolsUIBindings* ForWebContents( |
43 content::WebContents* web_contents); | 44 content::WebContents* web_contents); |
44 | 45 |
| 46 static GURL SanitizeFrontendURL(const GURL& url); |
| 47 static bool IsValidFrontendURL(const GURL& url); |
| 48 |
45 class Delegate { | 49 class Delegate { |
46 public: | 50 public: |
47 virtual ~Delegate() {} | 51 virtual ~Delegate() {} |
48 virtual void ActivateWindow() = 0; | 52 virtual void ActivateWindow() = 0; |
49 virtual void CloseWindow() = 0; | 53 virtual void CloseWindow() = 0; |
50 virtual void Inspect(scoped_refptr<content::DevToolsAgentHost> host) = 0; | 54 virtual void Inspect(scoped_refptr<content::DevToolsAgentHost> host) = 0; |
51 virtual void SetInspectedPageBounds(const gfx::Rect& rect) = 0; | 55 virtual void SetInspectedPageBounds(const gfx::Rect& rect) = 0; |
52 virtual void InspectElementCompleted() = 0; | 56 virtual void InspectElementCompleted() = 0; |
53 virtual void SetIsDocked(bool is_docked) = 0; | 57 virtual void SetIsDocked(bool is_docked) = 0; |
54 virtual void OpenInNewTab(const std::string& url) = 0; | 58 virtual void OpenInNewTab(const std::string& url) = 0; |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 void IndexingWorked(int request_id, | 195 void IndexingWorked(int request_id, |
192 const std::string& file_system_path, | 196 const std::string& file_system_path, |
193 int worked); | 197 int worked); |
194 void IndexingDone(int request_id, const std::string& file_system_path); | 198 void IndexingDone(int request_id, const std::string& file_system_path); |
195 void SearchCompleted(int request_id, | 199 void SearchCompleted(int request_id, |
196 const std::string& file_system_path, | 200 const std::string& file_system_path, |
197 const std::vector<std::string>& file_paths); | 201 const std::vector<std::string>& file_paths); |
198 typedef base::Callback<void(bool)> InfoBarCallback; | 202 typedef base::Callback<void(bool)> InfoBarCallback; |
199 void ShowDevToolsConfirmInfoBar(const base::string16& message, | 203 void ShowDevToolsConfirmInfoBar(const base::string16& message, |
200 const InfoBarCallback& callback); | 204 const InfoBarCallback& callback); |
| 205 void UpdateFrontendHost(content::NavigationHandle* navigation_handle); |
201 | 206 |
202 // Extensions support. | 207 // Extensions support. |
203 void AddDevToolsExtensionsToClient(); | 208 void AddDevToolsExtensionsToClient(); |
204 | 209 |
205 class FrontendWebContentsObserver; | 210 class FrontendWebContentsObserver; |
206 std::unique_ptr<FrontendWebContentsObserver> frontend_contents_observer_; | 211 std::unique_ptr<FrontendWebContentsObserver> frontend_contents_observer_; |
207 | 212 |
208 Profile* profile_; | 213 Profile* profile_; |
209 DevToolsAndroidBridge* android_bridge_; | 214 DevToolsAndroidBridge* android_bridge_; |
210 content::WebContents* web_contents_; | 215 content::WebContents* web_contents_; |
(...skipping 18 matching lines...) Expand all Loading... |
229 embedder_message_dispatcher_; | 234 embedder_message_dispatcher_; |
230 GURL url_; | 235 GURL url_; |
231 using PendingRequestsMap = std::map<const net::URLFetcher*, DispatchCallback>; | 236 using PendingRequestsMap = std::map<const net::URLFetcher*, DispatchCallback>; |
232 PendingRequestsMap pending_requests_; | 237 PendingRequestsMap pending_requests_; |
233 base::WeakPtrFactory<DevToolsUIBindings> weak_factory_; | 238 base::WeakPtrFactory<DevToolsUIBindings> weak_factory_; |
234 | 239 |
235 DISALLOW_COPY_AND_ASSIGN(DevToolsUIBindings); | 240 DISALLOW_COPY_AND_ASSIGN(DevToolsUIBindings); |
236 }; | 241 }; |
237 | 242 |
238 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_UI_BINDINGS_H_ | 243 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_UI_BINDINGS_H_ |
OLD | NEW |