Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1300)

Side by Side Diff: chrome/browser/extensions/extension_devtools_events.cc

Issue 3750001: base: Move SplitString functions into the base namespace and update the callers. (Closed) Base URL: git://git.chromium.org/chromium.git
Patch Set: brett review, reverted changes in o3d due to it's using an old base revision Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/download/save_package.cc ('k') | chrome/browser/extensions/extension_updater.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
(...skipping 10 matching lines...) Expand all
21 bool ExtensionDevToolsEvents::IsDevToolsEventName( 21 bool ExtensionDevToolsEvents::IsDevToolsEventName(
22 const std::string& event_name, int* tab_id) { 22 const std::string& event_name, int* tab_id) {
23 // We only care about events of the form "devtools.34.*", where 34 is 23 // We only care about events of the form "devtools.34.*", where 34 is
24 // a tab id. 24 // a tab id.
25 if (IsStringASCII(event_name) && 25 if (IsStringASCII(event_name) &&
26 StartsWithASCII(event_name, 26 StartsWithASCII(event_name,
27 kDevToolsEventPrefix, 27 kDevToolsEventPrefix,
28 true /* case_sensitive */)) { 28 true /* case_sensitive */)) {
29 // At this point we want something like "4.onPageEvent" 29 // At this point we want something like "4.onPageEvent"
30 std::vector<std::string> parts; 30 std::vector<std::string> parts;
31 SplitString(event_name.substr(strlen(kDevToolsEventPrefix)), '.', &parts); 31 base::SplitString(
32 event_name.substr(strlen(kDevToolsEventPrefix)), '.', &parts);
32 if (parts.size() == 2 && base::StringToInt(parts[0], tab_id)) { 33 if (parts.size() == 2 && base::StringToInt(parts[0], tab_id)) {
33 return true; 34 return true;
34 } 35 }
35 } 36 }
36 return false; 37 return false;
37 } 38 }
38 39
39 // static 40 // static
40 std::string ExtensionDevToolsEvents::OnPageEventNameForTab(int tab_id) { 41 std::string ExtensionDevToolsEvents::OnPageEventNameForTab(int tab_id) {
41 return base::StringPrintf("%s%d.%s", 42 return base::StringPrintf("%s%d.%s",
42 kDevToolsEventPrefix, 43 kDevToolsEventPrefix,
43 tab_id, 44 tab_id,
44 kOnPageEventName); 45 kOnPageEventName);
45 } 46 }
46 47
47 // static 48 // static
48 std::string ExtensionDevToolsEvents::OnTabCloseEventNameForTab(int tab_id) { 49 std::string ExtensionDevToolsEvents::OnTabCloseEventNameForTab(int tab_id) {
49 return base::StringPrintf("%s%d.%s", 50 return base::StringPrintf("%s%d.%s",
50 kDevToolsEventPrefix, 51 kDevToolsEventPrefix,
51 tab_id, 52 tab_id,
52 kOnTabCloseEventName); 53 kOnTabCloseEventName);
53 } 54 }
54 55
OLDNEW
« no previous file with comments | « chrome/browser/download/save_package.cc ('k') | chrome/browser/extensions/extension_updater.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698