• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3 // found in the LICENSE file.
4 
5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_DEVTOOLS_EVENTS_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_DEVTOOLS_EVENTS_H_
7 #pragma once
8 
9 #include <string>
10 
11 #include "base/basictypes.h"
12 
13 // Static utility functions for dealing with extension devtools event names.
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
16 // by chrome/renderer/resources/extension_process_bindings.js
17 class ExtensionDevToolsEvents {
18  public:
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.
21   static bool IsDevToolsEventName(const std::string& event_name, int* tab_id);
22 
23   // Generates the event string for an onPageEvent for a given tab.
24   static std::string OnPageEventNameForTab(int tab_id);
25 
26   // Generates the event string for an onTabCloseEvent for a given tab.
27   static std::string OnTabCloseEventNameForTab(int tab_id);
28 
29  private:
30 
31   DISALLOW_IMPLICIT_CONSTRUCTORS(ExtensionDevToolsEvents);
32 };
33 
34 #endif  // CHROME_BROWSER_EXTENSIONS_EXTENSION_DEVTOOLS_EVENTS_H_
35 
36