| OLD | NEW |
| 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_DEVTOOLS_DEVTOOLS_EMBEDDER_MESSAGE_DISPATCHER_H_ | 5 #ifndef CHROME_BROWSER_DEVTOOLS_DEVTOOLS_EMBEDDER_MESSAGE_DISPATCHER_H_ |
| 6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_EMBEDDER_MESSAGE_DISPATCHER_H_ | 6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_EMBEDDER_MESSAGE_DISPATCHER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "ui/gfx/insets.h" |
| 13 #include "ui/gfx/size.h" |
| 12 | 14 |
| 13 namespace base { | 15 namespace base { |
| 14 class ListValue; | 16 class ListValue; |
| 15 } | 17 } |
| 16 | 18 |
| 17 /** | 19 /** |
| 18 * Dispatcher for messages sent from the DevTools frontend running in an | 20 * Dispatcher for messages sent from the DevTools frontend running in an |
| 19 * isolated renderer (on chrome-devtools://) to the embedder in the browser. | 21 * isolated renderer (on chrome-devtools://) to the embedder in the browser. |
| 20 * | 22 * |
| 21 * The messages are sent via InspectorFrontendHost.sendMessageToEmbedder method. | 23 * The messages are sent via InspectorFrontendHost.sendMessageToEmbedder method. |
| 22 */ | 24 */ |
| 23 class DevToolsEmbedderMessageDispatcher { | 25 class DevToolsEmbedderMessageDispatcher { |
| 24 public: | 26 public: |
| 25 class Delegate { | 27 class Delegate { |
| 26 public: | 28 public: |
| 27 virtual ~Delegate() {} | 29 virtual ~Delegate() {} |
| 28 | 30 |
| 29 virtual void ActivateWindow() = 0; | 31 virtual void ActivateWindow() = 0; |
| 30 virtual void CloseWindow() = 0; | 32 virtual void CloseWindow() = 0; |
| 31 virtual void SetContentsInsets( | 33 virtual void SetContentsInsets( |
| 32 int top, int left, int bottom, int right) = 0; | 34 int top, int left, int bottom, int right) = 0; |
| 35 virtual void SetContentsResizingStrategy( |
| 36 const gfx::Insets& insets, const gfx::Size& min_size) = 0; |
| 33 virtual void InspectElementCompleted() = 0; | 37 virtual void InspectElementCompleted() = 0; |
| 34 virtual void MoveWindow(int x, int y) = 0; | 38 virtual void MoveWindow(int x, int y) = 0; |
| 35 virtual void SetIsDocked(bool is_docked) = 0; | 39 virtual void SetIsDocked(bool is_docked) = 0; |
| 36 virtual void OpenInNewTab(const std::string& url) = 0; | 40 virtual void OpenInNewTab(const std::string& url) = 0; |
| 37 virtual void SaveToFile(const std::string& url, | 41 virtual void SaveToFile(const std::string& url, |
| 38 const std::string& content, | 42 const std::string& content, |
| 39 bool save_as) = 0; | 43 bool save_as) = 0; |
| 40 virtual void AppendToFile(const std::string& url, | 44 virtual void AppendToFile(const std::string& url, |
| 41 const std::string& content) = 0; | 45 const std::string& content) = 0; |
| 42 virtual void RequestFileSystems() = 0; | 46 virtual void RequestFileSystems() = 0; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 60 | 64 |
| 61 private: | 65 private: |
| 62 typedef base::Callback<bool(const base::ListValue&)> Handler; | 66 typedef base::Callback<bool(const base::ListValue&)> Handler; |
| 63 void RegisterHandler(const std::string& method, const Handler& handler); | 67 void RegisterHandler(const std::string& method, const Handler& handler); |
| 64 | 68 |
| 65 typedef std::map<std::string, Handler> HandlerMap; | 69 typedef std::map<std::string, Handler> HandlerMap; |
| 66 HandlerMap handlers_; | 70 HandlerMap handlers_; |
| 67 }; | 71 }; |
| 68 | 72 |
| 69 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_EMBEDDER_MESSAGE_DISPATCHER_H_ | 73 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_EMBEDDER_MESSAGE_DISPATCHER_H_ |
| OLD | NEW |