OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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.h" | 5 #include "chrome/browser/extensions/extension.h" |
6 | 6 |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "net/base/net_util.h" | 10 #include "net/base/net_util.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 "Required value 'name' is missing or invalid."; | 62 "Required value 'name' is missing or invalid."; |
63 const char* Extension::kInvalidRunAtError = | 63 const char* Extension::kInvalidRunAtError = |
64 "Invalid value for 'content_scripts[*].run_at'."; | 64 "Invalid value for 'content_scripts[*].run_at'."; |
65 const char* Extension::kInvalidVersionError = | 65 const char* Extension::kInvalidVersionError = |
66 "Required value 'version' is missing or invalid."; | 66 "Required value 'version' is missing or invalid."; |
67 const char* Extension::kInvalidZipHashError = | 67 const char* Extension::kInvalidZipHashError = |
68 "Required key 'zip_hash' is missing or invalid."; | 68 "Required key 'zip_hash' is missing or invalid."; |
69 const char* Extension::kInvalidPluginsDirError = | 69 const char* Extension::kInvalidPluginsDirError = |
70 "Invalid value for 'plugins_dir'."; | 70 "Invalid value for 'plugins_dir'."; |
71 | 71 |
72 const int Extension::kIdSize = 20; // SHA1 (160 bits) == 20 bytes | 72 const size_t Extension::kIdSize = 20; // SHA1 (160 bits) == 20 bytes |
73 | 73 |
74 const std::string Extension::VersionString() const { | 74 const std::string Extension::VersionString() const { |
75 return version_->GetString(); | 75 return version_->GetString(); |
76 } | 76 } |
77 | 77 |
78 // static | 78 // static |
79 GURL Extension::GetResourceURL(const GURL& extension_url, | 79 GURL Extension::GetResourceURL(const GURL& extension_url, |
80 const std::string& relative_path) { | 80 const std::string& relative_path) { |
81 DCHECK(extension_url.SchemeIs(chrome::kExtensionScheme)); | 81 DCHECK(extension_url.SchemeIs(chrome::kExtensionScheme)); |
82 DCHECK(extension_url.path() == "/"); | 82 DCHECK(extension_url.path() == "/"); |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 script.set_path(Extension::GetResourcePath(path(), file)); | 318 script.set_path(Extension::GetResourcePath(path(), file)); |
319 script.set_url(Extension::GetResourceURL(url(), file)); | 319 script.set_url(Extension::GetResourceURL(url(), file)); |
320 | 320 |
321 content_scripts_.push_back(script); | 321 content_scripts_.push_back(script); |
322 } | 322 } |
323 } | 323 } |
324 | 324 |
325 return true; | 325 return true; |
326 } | 326 } |
327 | 327 |
OLD | NEW |