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

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

Issue 313001: Implement the Extension History API, v 0.1.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "app/resource_bundle.h" 7 #include "app/resource_bundle.h"
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/command_line.h"
9 #include "base/file_path.h" 10 #include "base/file_path.h"
10 #include "base/file_util.h" 11 #include "base/file_util.h"
11 #include "base/logging.h" 12 #include "base/logging.h"
12 #include "base/string_util.h" 13 #include "base/string_util.h"
13 #include "base/stl_util-inl.h" 14 #include "base/stl_util-inl.h"
14 #include "base/third_party/nss/blapi.h" 15 #include "base/third_party/nss/blapi.h"
15 #include "base/third_party/nss/sha256.h" 16 #include "base/third_party/nss/sha256.h"
16 #include "chrome/common/chrome_constants.h" 17 #include "chrome/common/chrome_constants.h"
18 #include "chrome/common/chrome_switches.h"
17 #include "chrome/common/extensions/extension_constants.h" 19 #include "chrome/common/extensions/extension_constants.h"
18 #include "chrome/common/extensions/extension_error_reporter.h" 20 #include "chrome/common/extensions/extension_error_reporter.h"
19 #include "chrome/common/extensions/extension_error_utils.h" 21 #include "chrome/common/extensions/extension_error_utils.h"
20 #include "chrome/common/extensions/extension_l10n_util.h" 22 #include "chrome/common/extensions/extension_l10n_util.h"
21 #include "chrome/common/extensions/user_script.h" 23 #include "chrome/common/extensions/user_script.h"
22 #include "chrome/common/notification_service.h" 24 #include "chrome/common/notification_service.h"
23 #include "chrome/common/url_constants.h" 25 #include "chrome/common/url_constants.h"
24 #include "net/base/base64.h" 26 #include "net/base/base64.h"
25 27
26 #if defined(OS_WIN) 28 #if defined(OS_WIN)
(...skipping 25 matching lines...) Expand all
52 (*id)[i] = HexStringToInt(id->substr(i, 1)) + 'a'; 54 (*id)[i] = HexStringToInt(id->substr(i, 1)) + 'a';
53 } 55 }
54 56
55 // Returns true if the given string is an API permission (see kPermissionNames). 57 // Returns true if the given string is an API permission (see kPermissionNames).
56 static bool IsAPIPermission(const std::string& str) { 58 static bool IsAPIPermission(const std::string& str) {
57 for (size_t i = 0; i < Extension::kNumPermissions; ++i) { 59 for (size_t i = 0; i < Extension::kNumPermissions; ++i) {
58 if (str == Extension::kPermissionNames[i]) 60 if (str == Extension::kPermissionNames[i])
59 return true; 61 return true;
60 } 62 }
61 63
64 if (CommandLine::ForCurrentProcess()->HasSwitch(
65 switches::kEnableExperimentalExtensionApis) &&
66 str == Extension::kExperimentalName)
67 return true;
68
62 return false; 69 return false;
63 } 70 }
64 71
65 } // namespace 72 } // namespace
66 73
67 const char Extension::kManifestFilename[] = "manifest.json"; 74 const char Extension::kManifestFilename[] = "manifest.json";
68 const char Extension::kLocaleFolder[] = "_locales"; 75 const char Extension::kLocaleFolder[] = "_locales";
69 const char Extension::kMessagesFilename[] = "messages.json"; 76 const char Extension::kMessagesFilename[] = "messages.json";
70 77
71 // A list of all the keys allowed by themes. 78 // A list of all the keys allowed by themes.
(...skipping 30 matching lines...) Expand all
102 const char* Extension::kTabPermission = "tabs"; 109 const char* Extension::kTabPermission = "tabs";
103 const char* Extension::kBookmarkPermission = "bookmarks"; 110 const char* Extension::kBookmarkPermission = "bookmarks";
104 111
105 const char* Extension::kPermissionNames[] = { 112 const char* Extension::kPermissionNames[] = {
106 Extension::kTabPermission, 113 Extension::kTabPermission,
107 Extension::kBookmarkPermission, 114 Extension::kBookmarkPermission,
108 }; 115 };
109 const size_t Extension::kNumPermissions = 116 const size_t Extension::kNumPermissions =
110 arraysize(Extension::kPermissionNames); 117 arraysize(Extension::kPermissionNames);
111 118
119 const char* Extension::kExperimentalName = "experimental";
120
112 Extension::~Extension() { 121 Extension::~Extension() {
113 } 122 }
114 123
115 const std::string Extension::VersionString() const { 124 const std::string Extension::VersionString() const {
116 return version_->GetString(); 125 return version_->GetString();
117 } 126 }
118 127
119 // static 128 // static
120 bool Extension::IsExtension(const FilePath& file_name) { 129 bool Extension::IsExtension(const FilePath& file_name) {
121 return file_name.MatchesExtension( 130 return file_name.MatchesExtension(
(...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after
1181 UserScript::PatternList::const_iterator pattern = 1190 UserScript::PatternList::const_iterator pattern =
1182 content_script->url_patterns().begin(); 1191 content_script->url_patterns().begin();
1183 for (; pattern != content_script->url_patterns().end(); ++pattern) { 1192 for (; pattern != content_script->url_patterns().end(); ++pattern) {
1184 if (pattern->match_subdomains() && pattern->host().empty()) 1193 if (pattern->match_subdomains() && pattern->host().empty())
1185 return true; 1194 return true;
1186 } 1195 }
1187 } 1196 }
1188 1197
1189 return false; 1198 return false;
1190 } 1199 }
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension.h ('k') | chrome/renderer/resources/extension_process_bindings.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698