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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 "Invalid value for 'content_scripts[*].run_at'."; | 66 "Invalid value for 'content_scripts[*].run_at'."; |
67 const char* Extension::kInvalidVersionError = | 67 const char* Extension::kInvalidVersionError = |
68 "Required value 'version' is missing or invalid."; | 68 "Required value 'version' is missing or invalid."; |
69 const char* Extension::kInvalidZipHashError = | 69 const char* Extension::kInvalidZipHashError = |
70 "Required key 'zip_hash' is missing or invalid."; | 70 "Required key 'zip_hash' is missing or invalid."; |
71 const char* Extension::kInvalidPluginsDirError = | 71 const char* Extension::kInvalidPluginsDirError = |
72 "Invalid value for 'plugins_dir'."; | 72 "Invalid value for 'plugins_dir'."; |
73 | 73 |
74 const size_t Extension::kIdSize = 20; // SHA1 (160 bits) == 20 bytes | 74 const size_t Extension::kIdSize = 20; // SHA1 (160 bits) == 20 bytes |
75 | 75 |
76 Extension::Extension(const Extension& rhs) : | 76 Extension::Extension(const Extension& rhs) |
77 path_(rhs.path_), | 77 : path_(rhs.path_), |
78 extension_url_(rhs.extension_url_), | 78 extension_url_(rhs.extension_url_), |
79 id_(rhs.id_), | 79 id_(rhs.id_), |
80 version_(new Version(*rhs.version_)), | 80 version_(new Version(*rhs.version_)), |
81 name_(rhs.name_), | 81 name_(rhs.name_), |
82 description_(rhs.description_), | 82 description_(rhs.description_), |
83 content_scripts_(rhs.content_scripts_), | 83 content_scripts_(rhs.content_scripts_), |
84 plugins_dir_(rhs.plugins_dir_), | 84 plugins_dir_(rhs.plugins_dir_), |
85 zip_hash_(rhs.zip_hash_), | 85 zip_hash_(rhs.zip_hash_), |
86 theme_paths_(rhs.theme_paths_) { | 86 theme_paths_(rhs.theme_paths_) { |
87 } | 87 } |
88 | 88 |
89 const std::string Extension::VersionString() const { | 89 const std::string Extension::VersionString() const { |
90 return version_->GetString(); | 90 return version_->GetString(); |
91 } | 91 } |
92 | 92 |
93 // static | 93 // static |
94 GURL Extension::GetResourceURL(const GURL& extension_url, | 94 GURL Extension::GetResourceURL(const GURL& extension_url, |
95 const std::string& relative_path) { | 95 const std::string& relative_path) { |
96 DCHECK(extension_url.SchemeIs(chrome::kExtensionScheme)); | 96 DCHECK(extension_url.SchemeIs(chrome::kExtensionScheme)); |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 script.set_path(Extension::GetResourcePath(path(), file)); | 361 script.set_path(Extension::GetResourcePath(path(), file)); |
362 script.set_url(Extension::GetResourceURL(url(), file)); | 362 script.set_url(Extension::GetResourceURL(url(), file)); |
363 | 363 |
364 content_scripts_.push_back(script); | 364 content_scripts_.push_back(script); |
365 } | 365 } |
366 } | 366 } |
367 | 367 |
368 return true; | 368 return true; |
369 } | 369 } |
370 | 370 |
OLD | NEW |