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

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

Issue 8984007: Revert 114929 - Standardize StringToInt{,64} interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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 | Annotate | Revision Log
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"
21 #include "base/string_util.h" 20 #include "base/string_util.h"
22 #include "base/utf_string_conversions.h" 21 #include "base/utf_string_conversions.h"
23 #include "base/values.h" 22 #include "base/values.h"
24 #include "base/version.h" 23 #include "base/version.h"
25 #include "crypto/sha2.h" 24 #include "crypto/sha2.h"
26 #include "chrome/common/chrome_constants.h" 25 #include "chrome/common/chrome_constants.h"
27 #include "chrome/common/chrome_switches.h" 26 #include "chrome/common/chrome_switches.h"
28 #include "chrome/common/chrome_version_info.h" 27 #include "chrome/common/chrome_version_info.h"
29 #include "chrome/common/extensions/csp_validator.h" 28 #include "chrome/common/extensions/csp_validator.h"
30 #include "chrome/common/extensions/extension_action.h" 29 #include "chrome/common/extensions/extension_action.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 const char kDefaultContentSecurityPolicy[] = 72 const char kDefaultContentSecurityPolicy[] =
74 "script-src 'self'; object-src 'self'"; 73 "script-src 'self'; object-src 'self'";
75 74
76 // Converts a normal hexadecimal string into the alphabet used by extensions. 75 // Converts a normal hexadecimal string into the alphabet used by extensions.
77 // We use the characters 'a'-'p' instead of '0'-'f' to avoid ever having a 76 // We use the characters 'a'-'p' instead of '0'-'f' to avoid ever having a
78 // completely numeric host, since some software interprets that as an IP 77 // completely numeric host, since some software interprets that as an IP
79 // address. 78 // address.
80 static void ConvertHexadecimalToIDAlphabet(std::string* id) { 79 static void ConvertHexadecimalToIDAlphabet(std::string* id) {
81 for (size_t i = 0; i < id->size(); ++i) { 80 for (size_t i = 0; i < id->size(); ++i) {
82 int val; 81 int val;
83 if (base::HexStringToInt(base::StringPiece(id->begin() + i, 82 if (base::HexStringToInt(id->begin() + i, id->begin() + i + 1, &val))
84 id->begin() + i + 1),
85 &val)) {
86 (*id)[i] = val + 'a'; 83 (*id)[i] = val + 'a';
87 } else { 84 else
88 (*id)[i] = 'a'; 85 (*id)[i] = 'a';
89 }
90 } 86 }
91 } 87 }
92 88
93 // A singleton object containing global data needed by the extension objects. 89 // A singleton object containing global data needed by the extension objects.
94 class ExtensionConfig { 90 class ExtensionConfig {
95 public: 91 public:
96 static ExtensionConfig* GetInstance() { 92 static ExtensionConfig* GetInstance() {
97 return Singleton<ExtensionConfig>::get(); 93 return Singleton<ExtensionConfig>::get();
98 } 94 }
99 95
(...skipping 2902 matching lines...) Expand 10 before | Expand all | Expand 10 after
3002 already_disabled(false), 2998 already_disabled(false),
3003 extension(extension) {} 2999 extension(extension) {}
3004 3000
3005 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( 3001 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo(
3006 const Extension* extension, 3002 const Extension* extension,
3007 const ExtensionPermissionSet* permissions, 3003 const ExtensionPermissionSet* permissions,
3008 Reason reason) 3004 Reason reason)
3009 : reason(reason), 3005 : reason(reason),
3010 extension(extension), 3006 extension(extension),
3011 permissions(permissions) {} 3007 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