Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_permission_set.h" | 5 #include "chrome/common/extensions/extension_permission_set.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/command_line.h" | |
| 10 #include "base/memory/singleton.h" | 11 #include "base/memory/singleton.h" |
| 11 #include "base/values.h" | 12 #include "base/values.h" |
| 12 #include "base/string_number_conversions.h" | 13 #include "base/string_number_conversions.h" |
| 13 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
| 15 #include "chrome/common/chrome_switches.h" | |
| 14 #include "chrome/common/extensions/extension.h" | 16 #include "chrome/common/extensions/extension.h" |
| 15 #include "chrome/common/extensions/extension_constants.h" | 17 #include "chrome/common/extensions/extension_constants.h" |
| 16 #include "chrome/common/extensions/extension_l10n_util.h" | 18 #include "chrome/common/extensions/extension_l10n_util.h" |
| 17 #include "chrome/common/extensions/url_pattern.h" | 19 #include "chrome/common/extensions/url_pattern.h" |
| 18 #include "chrome/common/extensions/url_pattern_set.h" | 20 #include "chrome/common/extensions/url_pattern_set.h" |
| 19 #include "content/public/common/url_constants.h" | 21 #include "content/public/common/url_constants.h" |
| 20 #include "grit/generated_resources.h" | 22 #include "grit/generated_resources.h" |
| 21 #include "net/base/registry_controlled_domain.h" | 23 #include "net/base/registry_controlled_domain.h" |
| 22 #include "ui/base/l10n/l10n_util.h" | 24 #include "ui/base/l10n/l10n_util.h" |
| 23 | 25 |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 189 kGeolocation, "geolocation", IDS_EXTENSION_PROMPT_WARNING_GEOLOCATION, | 191 kGeolocation, "geolocation", IDS_EXTENSION_PROMPT_WARNING_GEOLOCATION, |
| 190 ExtensionPermissionMessage::kGeolocation, | 192 ExtensionPermissionMessage::kGeolocation, |
| 191 kFlagCannotBeOptional, kTypeAll); | 193 kFlagCannotBeOptional, kTypeAll); |
| 192 info->RegisterPermission( | 194 info->RegisterPermission( |
| 193 kNotification, "notifications", 0, | 195 kNotification, "notifications", 0, |
| 194 ExtensionPermissionMessage::kNone, kFlagNone, kTypeAll); | 196 ExtensionPermissionMessage::kNone, kFlagNone, kTypeAll); |
| 195 info->RegisterPermission( | 197 info->RegisterPermission( |
| 196 kUnlimitedStorage, "unlimitedStorage", 0, | 198 kUnlimitedStorage, "unlimitedStorage", 0, |
| 197 ExtensionPermissionMessage::kNone, kFlagCannotBeOptional, kTypeAll); | 199 ExtensionPermissionMessage::kNone, kFlagCannotBeOptional, kTypeAll); |
| 198 | 200 |
| 199 // Register hosted app permissions that are also private. | |
| 200 info->RegisterPermission( | |
| 201 kChromePrivate, "chromePrivate", 0, | |
| 202 ExtensionPermissionMessage::kNone, kFlagCannotBeOptional, | |
| 203 kTypeAll - kTypePlatformApp); | |
| 204 info->RegisterPermission( | |
| 205 kChromeAuthPrivate, "chromeAuthPrivate", 0, | |
| 206 ExtensionPermissionMessage::kNone, | |
| 207 kFlagComponentOnly | kFlagCannotBeOptional, kTypeAll - kTypePlatformApp); | |
| 208 info->RegisterPermission( | |
| 209 kWebstorePrivate, "webstorePrivate", 0, | |
| 210 ExtensionPermissionMessage::kNone, | |
| 211 kFlagComponentOnly | kFlagCannotBeOptional, kTypeAll - kTypePlatformApp); | |
| 212 | 201 |
| 213 // Register hosted and packaged app permissions. | 202 // Register hosted and packaged app permissions. |
| 214 info->RegisterPermission( | 203 info->RegisterPermission( |
| 215 kAppNotifications, "appNotifications", 0, | 204 kAppNotifications, "appNotifications", 0, |
| 216 ExtensionPermissionMessage::kNone, kFlagNone, | 205 ExtensionPermissionMessage::kNone, kFlagNone, |
| 217 kTypeHostedApp | kTypePackagedApp); | 206 kTypeHostedApp | kTypePackagedApp); |
| 218 | 207 |
| 219 // Register extension permissions. | 208 // Register extension permissions. |
| 220 info->RegisterPermission( | 209 info->RegisterPermission( |
| 221 kBookmark, "bookmarks", IDS_EXTENSION_PROMPT_WARNING_BOOKMARKS, | 210 kBookmark, "bookmarks", IDS_EXTENSION_PROMPT_WARNING_BOOKMARKS, |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 238 kHistory, "history", IDS_EXTENSION_PROMPT_WARNING_BROWSING_HISTORY, | 227 kHistory, "history", IDS_EXTENSION_PROMPT_WARNING_BROWSING_HISTORY, |
| 239 ExtensionPermissionMessage::kBrowsingHistory, | 228 ExtensionPermissionMessage::kBrowsingHistory, |
| 240 kFlagNone, kTypeDefault); | 229 kFlagNone, kTypeDefault); |
| 241 info->RegisterPermission( | 230 info->RegisterPermission( |
| 242 kIdle, "idle", 0, ExtensionPermissionMessage::kNone, | 231 kIdle, "idle", 0, ExtensionPermissionMessage::kNone, |
| 243 kFlagNone, kTypeDefault); | 232 kFlagNone, kTypeDefault); |
| 244 info->RegisterPermission( | 233 info->RegisterPermission( |
| 245 kInput, "input", 0, ExtensionPermissionMessage::kNone, | 234 kInput, "input", 0, ExtensionPermissionMessage::kNone, |
| 246 kFlagImpliesFullURLAccess, kTypeDefault); | 235 kFlagImpliesFullURLAccess, kTypeDefault); |
| 247 info->RegisterPermission( | 236 info->RegisterPermission( |
| 248 kInputMethodPrivate, "inputMethodPrivate", 0, | |
| 249 ExtensionPermissionMessage::kNone, kFlagCannotBeOptional, kTypeDefault); | |
| 250 info->RegisterPermission( | |
| 251 kManagement, "management", IDS_EXTENSION_PROMPT_WARNING_MANAGEMENT, | 237 kManagement, "management", IDS_EXTENSION_PROMPT_WARNING_MANAGEMENT, |
| 252 ExtensionPermissionMessage::kManagement, kFlagNone, kTypeDefault); | 238 ExtensionPermissionMessage::kManagement, kFlagNone, kTypeDefault); |
| 253 info->RegisterPermission( | 239 info->RegisterPermission( |
| 254 kPageCapture, "pageCapture", | 240 kPageCapture, "pageCapture", |
| 255 IDS_EXTENSION_PROMPT_WARNING_ALL_PAGES_CONTENT, | 241 IDS_EXTENSION_PROMPT_WARNING_ALL_PAGES_CONTENT, |
| 256 ExtensionPermissionMessage::kAllPageContent, kFlagNone, kTypeDefault); | 242 ExtensionPermissionMessage::kAllPageContent, kFlagNone, kTypeDefault); |
| 257 info->RegisterPermission( | 243 info->RegisterPermission( |
| 258 kPrivacy, "privacy", IDS_EXTENSION_PROMPT_WARNING_PRIVACY, | 244 kPrivacy, "privacy", IDS_EXTENSION_PROMPT_WARNING_PRIVACY, |
| 259 ExtensionPermissionMessage::kPrivacy, kFlagNone, kTypeDefault); | 245 ExtensionPermissionMessage::kPrivacy, kFlagNone, kTypeDefault); |
| 260 info->RegisterPermission( | 246 info->RegisterPermission( |
| 261 kStorage, "storage", 0, | 247 kStorage, "storage", 0, |
| 262 ExtensionPermissionMessage::kNone, kFlagNone, kTypeDefault); | 248 ExtensionPermissionMessage::kNone, kFlagNone, kTypeDefault); |
| 263 info->RegisterPermission( | 249 info->RegisterPermission( |
| 264 kTab, "tabs", IDS_EXTENSION_PROMPT_WARNING_TABS, | 250 kTab, "tabs", IDS_EXTENSION_PROMPT_WARNING_TABS, |
| 265 ExtensionPermissionMessage::kTabs, kFlagNone, | 251 ExtensionPermissionMessage::kTabs, kFlagNone, |
| 266 kTypeDefault - kTypePlatformApp); | 252 kTypeDefault - kTypePlatformApp); |
| 267 info->RegisterPermission( | 253 info->RegisterPermission( |
| 268 kTerminalPrivate, "terminalPrivate", 0, | |
| 269 ExtensionPermissionMessage::kNone, kFlagCannotBeOptional, kTypeDefault); | |
| 270 info->RegisterPermission( | |
| 271 kTts, "tts", 0, | 254 kTts, "tts", 0, |
| 272 ExtensionPermissionMessage::kNone, kFlagCannotBeOptional, kTypeDefault); | 255 ExtensionPermissionMessage::kNone, kFlagCannotBeOptional, kTypeDefault); |
| 273 info->RegisterPermission( | 256 info->RegisterPermission( |
| 274 kTtsEngine, "ttsEngine", IDS_EXTENSION_PROMPT_WARNING_TTS_ENGINE, | 257 kTtsEngine, "ttsEngine", IDS_EXTENSION_PROMPT_WARNING_TTS_ENGINE, |
| 275 ExtensionPermissionMessage::kTtsEngine, | 258 ExtensionPermissionMessage::kTtsEngine, |
| 276 kFlagCannotBeOptional, kTypeDefault); | 259 kFlagCannotBeOptional, kTypeDefault); |
| 277 info->RegisterPermission( | 260 info->RegisterPermission( |
| 278 kWebNavigation, "webNavigation", | 261 kWebNavigation, "webNavigation", |
| 279 IDS_EXTENSION_PROMPT_WARNING_TABS, ExtensionPermissionMessage::kTabs, | 262 IDS_EXTENSION_PROMPT_WARNING_TABS, ExtensionPermissionMessage::kTabs, |
| 280 kFlagNone, kTypeDefault - kTypePlatformApp); | 263 kFlagNone, kTypeDefault - kTypePlatformApp); |
| 281 info->RegisterPermission( | 264 info->RegisterPermission( |
| 282 kWebRequest, "webRequest", 0, ExtensionPermissionMessage::kNone, | 265 kWebRequest, "webRequest", 0, ExtensionPermissionMessage::kNone, |
| 283 kFlagNone, kTypeDefault - kTypePlatformApp); | 266 kFlagNone, kTypeDefault - kTypePlatformApp); |
| 284 info->RegisterPermission( | 267 info->RegisterPermission( |
| 285 kWebRequestBlocking, "webRequestBlocking", 0, | 268 kWebRequestBlocking, "webRequestBlocking", 0, |
| 286 ExtensionPermissionMessage::kNone, kFlagNone, | 269 ExtensionPermissionMessage::kNone, kFlagNone, |
| 287 kTypeDefault - kTypePlatformApp); | 270 kTypeDefault - kTypePlatformApp); |
| 288 info->RegisterPermission( | |
| 289 kWebSocketProxyPrivate, "webSocketProxyPrivate", 0, | |
| 290 ExtensionPermissionMessage::kNone, kFlagCannotBeOptional, | |
| 291 kTypeDefault - kTypePlatformApp); | |
| 292 | 271 |
| 293 // Register private permissions. | 272 // Register private permissions. |
| 294 info->RegisterPermission( | 273 info->RegisterPermission( |
| 295 kChromeosInfoPrivate, "chromeosInfoPrivate", 0, | 274 kChromeosInfoPrivate, "chromeosInfoPrivate", 0, |
| 296 ExtensionPermissionMessage::kNone, | 275 ExtensionPermissionMessage::kNone, |
| 297 kFlagComponentOnly | kFlagCannotBeOptional, kTypeDefault); | 276 kFlagComponentOnly_Deprecated | kFlagCannotBeOptional, kTypeDefault); |
| 298 info->RegisterPermission( | 277 info->RegisterPermission( |
| 299 kFileBrowserPrivate, "fileBrowserPrivate", 0, | 278 kFileBrowserPrivate, "fileBrowserPrivate", 0, |
| 300 ExtensionPermissionMessage::kNone, | 279 ExtensionPermissionMessage::kNone, |
| 301 kFlagComponentOnly | kFlagCannotBeOptional, kTypeDefault); | 280 kFlagComponentOnly_Deprecated | kFlagCannotBeOptional, kTypeDefault); |
| 302 info->RegisterPermission( | 281 info->RegisterPermission( |
| 303 kMediaPlayerPrivate, "mediaPlayerPrivate", 0, | 282 kMediaPlayerPrivate, "mediaPlayerPrivate", 0, |
| 304 ExtensionPermissionMessage::kNone, | 283 ExtensionPermissionMessage::kNone, |
| 305 kFlagComponentOnly | kFlagCannotBeOptional, kTypeDefault); | 284 kFlagComponentOnly_Deprecated | kFlagCannotBeOptional, kTypeDefault); |
| 306 info->RegisterPermission( | 285 info->RegisterPermission( |
| 307 kMetricsPrivate, "metricsPrivate", 0, | 286 kMetricsPrivate, "metricsPrivate", 0, |
| 308 ExtensionPermissionMessage::kNone, | 287 ExtensionPermissionMessage::kNone, |
| 309 kFlagComponentOnly | kFlagCannotBeOptional, kTypeDefault); | 288 kFlagComponentOnly_Deprecated | kFlagCannotBeOptional, kTypeDefault); |
| 310 info->RegisterPermission( | 289 info->RegisterPermission( |
| 311 kSystemPrivate, "systemPrivate", 0, | 290 kSystemPrivate, "systemPrivate", 0, |
| 312 ExtensionPermissionMessage::kNone, | 291 ExtensionPermissionMessage::kNone, |
| 313 kFlagComponentOnly | kFlagCannotBeOptional, kTypeDefault); | 292 kFlagComponentOnly_Deprecated | kFlagCannotBeOptional, kTypeDefault); |
| 293 | |
| 294 ExtensionAPIPermission* chromeAuthPrivate = info->RegisterPermission( | |
| 295 kChromeAuthPrivate, "chromeAuthPrivate", 0, | |
| 296 ExtensionPermissionMessage::kNone, | |
| 297 kFlagCannotBeOptional, kTypeAll - kTypePlatformApp); | |
| 298 chromeAuthPrivate->AddToWhitelist(extension_misc::kCloudPrintAppId); | |
| 299 | |
| 300 ExtensionAPIPermission* chromePrivate = info->RegisterPermission( | |
| 301 kChromePrivate, "chromePrivate", 0, ExtensionPermissionMessage::kNone, | |
| 302 kFlagCannotBeOptional, kTypeAll - kTypePlatformApp); | |
| 303 chromePrivate->AddToWhitelist(extension_misc::kCitrixReceiverAppId); | |
| 304 chromePrivate->AddToWhitelist("gnedhmakppccajfpfiihfcdlnpgomkcf"); | |
| 305 chromePrivate->AddToWhitelist("fjcibdnjlbfnbfdjneajpipnlcppleek"); | |
| 306 | |
| 307 ExtensionAPIPermission* inputMethodPrivate = info->RegisterPermission( | |
| 308 kInputMethodPrivate, "inputMethodPrivate", 0, | |
| 309 ExtensionPermissionMessage::kNone, kFlagCannotBeOptional, kTypeDefault); | |
| 310 inputMethodPrivate->AddToWhitelist(extension_misc::kCitrixReceiverAppId); | |
| 311 inputMethodPrivate->AddToWhitelist("gnedhmakppccajfpfiihfcdlnpgomkcf"); | |
| 312 inputMethodPrivate->AddToWhitelist("fjcibdnjlbfnbfdjneajpipnlcppleek"); | |
| 313 inputMethodPrivate->AddToWhitelist(extension_misc::kHTermAppId); | |
| 314 inputMethodPrivate->AddToWhitelist(extension_misc::kHTermDevAppId); | |
| 315 | |
| 316 ExtensionAPIPermission* terminalPrivate = info->RegisterPermission( | |
| 317 kTerminalPrivate, "terminalPrivate", 0, ExtensionPermissionMessage::kNone, | |
| 318 kFlagCannotBeOptional, kTypeDefault); | |
| 319 terminalPrivate->AddToWhitelist(extension_misc::kHTermAppId); | |
| 320 terminalPrivate->AddToWhitelist(extension_misc::kHTermDevAppId); | |
| 321 | |
| 322 ExtensionAPIPermission* webSocketProxyPrivate = info->RegisterPermission( | |
| 323 kWebSocketProxyPrivate, "webSocketProxyPrivate", 0, | |
| 324 ExtensionPermissionMessage::kNone, | |
| 325 kFlagCannotBeOptional, kTypeDefault - kTypePlatformApp); | |
| 326 webSocketProxyPrivate->AddToWhitelist(extension_misc::kCitrixReceiverAppId); | |
| 327 webSocketProxyPrivate->AddToWhitelist("gnedhmakppccajfpfiihfcdlnpgomkcf"); | |
|
jstritar
2012/02/08 16:16:07
do you know what extension this is?
| |
| 328 webSocketProxyPrivate->AddToWhitelist("fjcibdnjlbfnbfdjneajpipnlcppleek"); | |
|
jstritar
2012/02/08 16:16:07
ditto^
Dmitry Polukhin
2012/02/08 17:40:29
All these 3 IDs are Citrix Receiver (stable, beta
| |
| 329 webSocketProxyPrivate->AddToWhitelist(extension_misc::kHTermAppId); | |
| 330 webSocketProxyPrivate->AddToWhitelist(extension_misc::kHTermDevAppId); | |
| 331 | |
| 332 ExtensionAPIPermission* webstorePrivate = info->RegisterPermission( | |
| 333 kWebstorePrivate, "webstorePrivate", 0, | |
| 334 ExtensionPermissionMessage::kNone, | |
| 335 kFlagCannotBeOptional, kTypeAll - kTypePlatformApp); | |
| 336 webstorePrivate->AddToWhitelist(extension_misc::kEnterpriseWebStoreAppId); | |
| 337 webstorePrivate->AddToWhitelist(extension_misc::kWebStoreAppId); | |
| 314 | 338 |
| 315 // Full url access permissions. | 339 // Full url access permissions. |
| 316 info->RegisterPermission( | 340 info->RegisterPermission( |
| 317 kProxy, "proxy", 0, ExtensionPermissionMessage::kNone, | 341 kProxy, "proxy", 0, ExtensionPermissionMessage::kNone, |
| 318 kFlagImpliesFullURLAccess | kFlagCannotBeOptional, kTypeDefault); | 342 kFlagImpliesFullURLAccess | kFlagCannotBeOptional, kTypeDefault); |
| 319 | 343 |
| 320 info->RegisterPermission( | 344 info->RegisterPermission( |
| 321 kDebugger, "debugger", IDS_EXTENSION_PROMPT_WARNING_DEBUGGER, | 345 kDebugger, "debugger", IDS_EXTENSION_PROMPT_WARNING_DEBUGGER, |
| 322 ExtensionPermissionMessage::kDebugger, | 346 ExtensionPermissionMessage::kDebugger, |
| 323 kFlagImpliesFullURLAccess | kFlagCannotBeOptional, kTypeDefault); | 347 kFlagImpliesFullURLAccess | kFlagCannotBeOptional, kTypeDefault); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 334 // Platform-app permissions. | 358 // Platform-app permissions. |
| 335 info->RegisterPermission( | 359 info->RegisterPermission( |
| 336 kSocket, "socket", 0, ExtensionPermissionMessage::kNone, | 360 kSocket, "socket", 0, ExtensionPermissionMessage::kNone, |
| 337 kFlagCannotBeOptional, kTypePlatformApp); | 361 kFlagCannotBeOptional, kTypePlatformApp); |
| 338 | 362 |
| 339 // Register aliases. | 363 // Register aliases. |
| 340 info->RegisterAlias("unlimitedStorage", kOldUnlimitedStoragePermission); | 364 info->RegisterAlias("unlimitedStorage", kOldUnlimitedStoragePermission); |
| 341 info->RegisterAlias("tabs", kWindowsPermission); | 365 info->RegisterAlias("tabs", kWindowsPermission); |
| 342 } | 366 } |
| 343 | 367 |
| 368 bool ExtensionAPIPermission::HasWhitelist() const { | |
| 369 return !whitelist_.empty(); | |
| 370 } | |
| 371 | |
| 372 bool ExtensionAPIPermission::IsWhitelisted( | |
| 373 const std::string& extension_id) const { | |
| 374 CommandLine* command_line = CommandLine::ForCurrentProcess(); | |
| 375 if (command_line->HasSwitch(switches::kWhitelistedExtensionID)) { | |
| 376 if (extension_id == command_line->GetSwitchValueASCII( | |
| 377 switches::kWhitelistedExtensionID)) | |
| 378 return true; | |
| 379 } | |
| 380 return whitelist_.find(extension_id) != whitelist_.end(); | |
| 381 } | |
| 382 | |
| 383 void ExtensionAPIPermission::AddToWhitelist(const std::string& extension_id) { | |
| 384 whitelist_.insert(extension_id); | |
| 385 } | |
| 386 | |
| 344 // | 387 // |
| 345 // ExtensionPermissionsInfo | 388 // ExtensionPermissionsInfo |
| 346 // | 389 // |
| 347 | 390 |
| 348 // static | 391 // static |
| 349 ExtensionPermissionsInfo* ExtensionPermissionsInfo::GetInstance() { | 392 ExtensionPermissionsInfo* ExtensionPermissionsInfo::GetInstance() { |
| 350 return Singleton<ExtensionPermissionsInfo>::get(); | 393 return Singleton<ExtensionPermissionsInfo>::get(); |
| 351 } | 394 } |
| 352 | 395 |
| 353 ExtensionAPIPermission* ExtensionPermissionsInfo::GetByID( | 396 ExtensionAPIPermission* ExtensionPermissionsInfo::GetByID( |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 391 ExtensionAPIPermission::RegisterAllPermissions(this); | 434 ExtensionAPIPermission::RegisterAllPermissions(this); |
| 392 } | 435 } |
| 393 | 436 |
| 394 void ExtensionPermissionsInfo::RegisterAlias( | 437 void ExtensionPermissionsInfo::RegisterAlias( |
| 395 const char* name, const char* alias) { | 438 const char* name, const char* alias) { |
| 396 DCHECK(name_map_.find(name) != name_map_.end()); | 439 DCHECK(name_map_.find(name) != name_map_.end()); |
| 397 DCHECK(name_map_.find(alias) == name_map_.end()); | 440 DCHECK(name_map_.find(alias) == name_map_.end()); |
| 398 name_map_[alias] = name_map_[name]; | 441 name_map_[alias] = name_map_[name]; |
| 399 } | 442 } |
| 400 | 443 |
| 401 void ExtensionPermissionsInfo::RegisterPermission( | 444 ExtensionAPIPermission* ExtensionPermissionsInfo::RegisterPermission( |
| 402 ExtensionAPIPermission::ID id, | 445 ExtensionAPIPermission::ID id, |
| 403 const char* name, | 446 const char* name, |
| 404 int l10n_message_id, | 447 int l10n_message_id, |
| 405 ExtensionPermissionMessage::ID message_id, | 448 ExtensionPermissionMessage::ID message_id, |
| 406 int flags, | 449 int flags, |
| 407 int type_restrictions) { | 450 int type_restrictions) { |
| 408 DCHECK(id_map_.find(id) == id_map_.end()); | 451 DCHECK(id_map_.find(id) == id_map_.end()); |
| 409 DCHECK(name_map_.find(name) == name_map_.end()); | 452 DCHECK(name_map_.find(name) == name_map_.end()); |
| 410 | 453 |
| 411 ExtensionAPIPermission* permission = new ExtensionAPIPermission( | 454 ExtensionAPIPermission* permission = new ExtensionAPIPermission( |
| 412 id, name, l10n_message_id, message_id, flags, type_restrictions); | 455 id, name, l10n_message_id, message_id, flags, type_restrictions); |
| 413 | 456 |
| 414 id_map_[id] = permission; | 457 id_map_[id] = permission; |
| 415 name_map_[name] = permission; | 458 name_map_[name] = permission; |
| 416 | 459 |
| 417 permission_count_++; | 460 permission_count_++; |
| 461 | |
| 462 return permission; | |
| 418 } | 463 } |
| 419 | 464 |
| 420 // | 465 // |
| 421 // ExtensionPermissionSet | 466 // ExtensionPermissionSet |
| 422 // | 467 // |
| 423 | 468 |
| 424 ExtensionPermissionSet::ExtensionPermissionSet() { | 469 ExtensionPermissionSet::ExtensionPermissionSet() { |
| 425 } | 470 } |
| 426 | 471 |
| 427 ExtensionPermissionSet::ExtensionPermissionSet( | 472 ExtensionPermissionSet::ExtensionPermissionSet( |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 870 std::set<std::string> new_hosts_set(GetDistinctHosts(new_list, false, false)); | 915 std::set<std::string> new_hosts_set(GetDistinctHosts(new_list, false, false)); |
| 871 std::set<std::string> old_hosts_set(GetDistinctHosts(old_list, false, false)); | 916 std::set<std::string> old_hosts_set(GetDistinctHosts(old_list, false, false)); |
| 872 std::set<std::string> new_hosts_only; | 917 std::set<std::string> new_hosts_only; |
| 873 | 918 |
| 874 std::set_difference(new_hosts_set.begin(), new_hosts_set.end(), | 919 std::set_difference(new_hosts_set.begin(), new_hosts_set.end(), |
| 875 old_hosts_set.begin(), old_hosts_set.end(), | 920 old_hosts_set.begin(), old_hosts_set.end(), |
| 876 std::inserter(new_hosts_only, new_hosts_only.begin())); | 921 std::inserter(new_hosts_only, new_hosts_only.begin())); |
| 877 | 922 |
| 878 return !new_hosts_only.empty(); | 923 return !new_hosts_only.empty(); |
| 879 } | 924 } |
| OLD | NEW |