OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_EXTENSIONS_EXTENSION_DEVTOOLS_EVENTS_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_DEVTOOLS_EVENTS_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_DEVTOOLS_EVENTS_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_DEVTOOLS_EVENTS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 | 12 |
13 // Static utility functions for dealing with extension devtools event names. | 13 // Static utility functions for dealing with extension devtools event names. |
14 // The format of the event names is <prefix>.<tab id>.<event name> | 14 // The format of the event names is <prefix>.<tab id>.<event name> |
15 // Equivalent name munging is done in the extension process in JavaScript | 15 // Equivalent name munging is done in the extension process in JavaScript |
16 // by chrome/renderer/resources/extension_process_bindings.js | 16 // by chrome/renderer/resources/extensions/schema_generated_bindings.js |
17 class ExtensionDevToolsEvents { | 17 class ExtensionDevToolsEvents { |
18 public: | 18 public: |
19 // Checks if an event name is a magic devtools event name. If so, | 19 // Checks if an event name is a magic devtools event name. If so, |
20 // the tab id of the event is put in *tab_id. | 20 // the tab id of the event is put in *tab_id. |
21 static bool IsDevToolsEventName(const std::string& event_name, int* tab_id); | 21 static bool IsDevToolsEventName(const std::string& event_name, int* tab_id); |
22 | 22 |
23 // Generates the event string for an onPageEvent for a given tab. | 23 // Generates the event string for an onPageEvent for a given tab. |
24 static std::string OnPageEventNameForTab(int tab_id); | 24 static std::string OnPageEventNameForTab(int tab_id); |
25 | 25 |
26 // Generates the event string for an onTabCloseEvent for a given tab. | 26 // Generates the event string for an onTabCloseEvent for a given tab. |
27 static std::string OnTabCloseEventNameForTab(int tab_id); | 27 static std::string OnTabCloseEventNameForTab(int tab_id); |
28 | 28 |
29 private: | 29 private: |
30 | 30 |
31 DISALLOW_IMPLICIT_CONSTRUCTORS(ExtensionDevToolsEvents); | 31 DISALLOW_IMPLICIT_CONSTRUCTORS(ExtensionDevToolsEvents); |
32 }; | 32 }; |
33 | 33 |
34 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_DEVTOOLS_EVENTS_H_ | 34 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_DEVTOOLS_EVENTS_H_ |
35 | |
OLD | NEW |