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

Side by Side Diff: chrome/common/extensions/extension.cc

Issue 8921006: Standardize StringToInt{,64} interface. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix call syntax of StringToInt() in Chrome OS code. Created 9 years 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
OLDNEW
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 #include "chrome/common/extensions/extension.h" 5 #include "chrome/common/extensions/extension.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/file_path.h" 12 #include "base/file_path.h"
13 #include "base/file_util.h" 13 #include "base/file_util.h"
14 #include "base/i18n/rtl.h" 14 #include "base/i18n/rtl.h"
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/memory/singleton.h" 16 #include "base/memory/singleton.h"
17 #include "base/stl_util.h" 17 #include "base/stl_util.h"
18 #include "base/string16.h" 18 #include "base/string16.h"
19 #include "base/string_number_conversions.h" 19 #include "base/string_number_conversions.h"
20 #include "base/string_piece.h"
20 #include "base/string_util.h" 21 #include "base/string_util.h"
21 #include "base/utf_string_conversions.h" 22 #include "base/utf_string_conversions.h"
22 #include "base/values.h" 23 #include "base/values.h"
23 #include "base/version.h" 24 #include "base/version.h"
24 #include "crypto/sha2.h" 25 #include "crypto/sha2.h"
25 #include "chrome/common/chrome_constants.h" 26 #include "chrome/common/chrome_constants.h"
26 #include "chrome/common/chrome_switches.h" 27 #include "chrome/common/chrome_switches.h"
27 #include "chrome/common/chrome_version_info.h" 28 #include "chrome/common/chrome_version_info.h"
28 #include "chrome/common/extensions/csp_validator.h" 29 #include "chrome/common/extensions/csp_validator.h"
29 #include "chrome/common/extensions/extension_action.h" 30 #include "chrome/common/extensions/extension_action.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 const char kDefaultContentSecurityPolicy[] = 73 const char kDefaultContentSecurityPolicy[] =
73 "script-src 'self'; object-src 'self'"; 74 "script-src 'self'; object-src 'self'";
74 75
75 // Converts a normal hexadecimal string into the alphabet used by extensions. 76 // Converts a normal hexadecimal string into the alphabet used by extensions.
76 // We use the characters 'a'-'p' instead of '0'-'f' to avoid ever having a 77 // We use the characters 'a'-'p' instead of '0'-'f' to avoid ever having a
77 // completely numeric host, since some software interprets that as an IP 78 // completely numeric host, since some software interprets that as an IP
78 // address. 79 // address.
79 static void ConvertHexadecimalToIDAlphabet(std::string* id) { 80 static void ConvertHexadecimalToIDAlphabet(std::string* id) {
80 for (size_t i = 0; i < id->size(); ++i) { 81 for (size_t i = 0; i < id->size(); ++i) {
81 int val; 82 int val;
82 if (base::HexStringToInt(id->begin() + i, id->begin() + i + 1, &val)) 83 if (base::HexStringToInt(base::StringPiece(id->begin() + i,
84 id->begin() + i + 1),
85 &val)) {
83 (*id)[i] = val + 'a'; 86 (*id)[i] = val + 'a';
84 else 87 } else {
85 (*id)[i] = 'a'; 88 (*id)[i] = 'a';
89 }
86 } 90 }
87 } 91 }
88 92
89 // A singleton object containing global data needed by the extension objects. 93 // A singleton object containing global data needed by the extension objects.
90 class ExtensionConfig { 94 class ExtensionConfig {
91 public: 95 public:
92 static ExtensionConfig* GetInstance() { 96 static ExtensionConfig* GetInstance() {
93 return Singleton<ExtensionConfig>::get(); 97 return Singleton<ExtensionConfig>::get();
94 } 98 }
95 99
(...skipping 2902 matching lines...) Expand 10 before | Expand all | Expand 10 after
2998 already_disabled(false), 3002 already_disabled(false),
2999 extension(extension) {} 3003 extension(extension) {}
3000 3004
3001 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( 3005 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo(
3002 const Extension* extension, 3006 const Extension* extension,
3003 const ExtensionPermissionSet* permissions, 3007 const ExtensionPermissionSet* permissions,
3004 Reason reason) 3008 Reason reason)
3005 : reason(reason), 3009 : reason(reason),
3006 extension(extension), 3010 extension(extension),
3007 permissions(permissions) {} 3011 permissions(permissions) {}
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_blocking_page.cc ('k') | chrome/test/perf/page_cycler_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698