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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_DEVTOOLS_DEVTOOLS_EMBEDDER_MESSAGE_DISPATCHER_H_
6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_EMBEDDER_MESSAGE_DISPATCHER_H_
11 #include "base/callback.h"
12 #include "ui/gfx/geometry/insets.h"
13 #include "ui/gfx/geometry/rect.h"
14 #include "ui/gfx/geometry/size.h"
21 * Dispatcher for messages sent from the DevTools frontend running in an
22 * isolated renderer (on chrome-devtools://) to the embedder in the browser.
24 * The messages are sent via InspectorFrontendHost.sendMessageToEmbedder method.
26 class DevToolsEmbedderMessageDispatcher
{
30 virtual ~Delegate() {}
32 virtual void ActivateWindow(int request_id
) = 0;
33 virtual void CloseWindow(int request_id
) = 0;
34 virtual void LoadCompleted(int request_id
) = 0;
35 virtual void SetInspectedPageBounds(int request_id
,
36 const gfx::Rect
& rect
) = 0;
37 virtual void InspectElementCompleted(int request_id
) = 0;
38 virtual void InspectedURLChanged(int request_id
,
39 const std::string
& url
) = 0;
40 virtual void SetIsDocked(int request_id
, bool is_docked
) = 0;
41 virtual void OpenInNewTab(int request_id
, const std::string
& url
) = 0;
42 virtual void SaveToFile(int request_id
,
43 const std::string
& url
,
44 const std::string
& content
,
46 virtual void AppendToFile(int request_id
,
47 const std::string
& url
,
48 const std::string
& content
) = 0;
49 virtual void RequestFileSystems(int request_id
) = 0;
50 virtual void AddFileSystem(int request_id
) = 0;
51 virtual void RemoveFileSystem(int request_id
,
52 const std::string
& file_system_path
) = 0;
53 virtual void UpgradeDraggedFileSystemPermissions(
55 const std::string
& file_system_url
) = 0;
56 virtual void IndexPath(int request_id
,
58 const std::string
& file_system_path
) = 0;
59 virtual void StopIndexing(int request_id
, int index_request_id
) = 0;
60 virtual void LoadNetworkResource(int request_id
,
61 const std::string
& url
,
62 const std::string
& headers
,
64 virtual void SearchInPath(int request_id
,
65 int search_request_id
,
66 const std::string
& file_system_path
,
67 const std::string
& query
) = 0;
68 virtual void SetWhitelistedShortcuts(int request_id
,
69 const std::string
& message
) = 0;
70 virtual void ZoomIn(int request_id
) = 0;
71 virtual void ZoomOut(int request_id
) = 0;
72 virtual void ResetZoom(int request_id
) = 0;
73 virtual void OpenUrlOnRemoteDeviceAndInspect(int request_id
,
74 const std::string
& browser_id
,
75 const std::string
& url
) = 0;
76 virtual void SetDeviceCountUpdatesEnabled(int request_id
, bool enabled
) = 0;
77 virtual void SetDevicesUpdatesEnabled(int request_id
, bool enabled
) = 0;
78 virtual void SendMessageToBrowser(int request_id
,
79 const std::string
& message
) = 0;
80 virtual void RecordActionUMA(int request_id
,
81 const std::string
& name
,
85 virtual ~DevToolsEmbedderMessageDispatcher() {}
86 virtual bool Dispatch(int request_id
,
87 const std::string
& method
,
88 const base::ListValue
* params
) = 0;
90 static DevToolsEmbedderMessageDispatcher
* CreateForDevToolsFrontend(
94 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_EMBEDDER_MESSAGE_DISPATCHER_H_