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