OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "chrome/browser/extensions/extension_devtools_events.h" | 5 #include "chrome/browser/extensions/extension_devtools_events.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
10 #include "base/string_split.h" | 10 #include "base/string_split.h" |
11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
12 #include "base/stringprintf.h" | 12 #include "base/stringprintf.h" |
13 | 13 |
14 // These string constants and the formats used in this file must stay | 14 // These string constants and the formats used in this file must stay |
15 // in sync with chrome/renderer/resources/extension_process_bindings.js | 15 // in sync with chrome/renderer/resources/extensions/ |
| 16 // schema_generated_bindings.js. |
16 static const char kDevToolsEventPrefix[] = "devtools."; | 17 static const char kDevToolsEventPrefix[] = "devtools."; |
17 static const char kOnPageEventName[] = "onPageEvent"; | 18 static const char kOnPageEventName[] = "onPageEvent"; |
18 static const char kOnTabCloseEventName[] = "onTabClose"; | 19 static const char kOnTabCloseEventName[] = "onTabClose"; |
19 | 20 |
20 // static | 21 // static |
21 bool ExtensionDevToolsEvents::IsDevToolsEventName( | 22 bool ExtensionDevToolsEvents::IsDevToolsEventName( |
22 const std::string& event_name, int* tab_id) { | 23 const std::string& event_name, int* tab_id) { |
23 // We only care about events of the form "devtools.34.*", where 34 is | 24 // We only care about events of the form "devtools.34.*", where 34 is |
24 // a tab id. | 25 // a tab id. |
25 if (IsStringASCII(event_name) && | 26 if (IsStringASCII(event_name) && |
(...skipping 19 matching lines...) Expand all Loading... |
45 kOnPageEventName); | 46 kOnPageEventName); |
46 } | 47 } |
47 | 48 |
48 // static | 49 // static |
49 std::string ExtensionDevToolsEvents::OnTabCloseEventNameForTab(int tab_id) { | 50 std::string ExtensionDevToolsEvents::OnTabCloseEventNameForTab(int tab_id) { |
50 return base::StringPrintf("%s%d.%s", | 51 return base::StringPrintf("%s%d.%s", |
51 kDevToolsEventPrefix, | 52 kDevToolsEventPrefix, |
52 tab_id, | 53 tab_id, |
53 kOnTabCloseEventName); | 54 kOnTabCloseEventName); |
54 } | 55 } |
55 | |
OLD | NEW |