| 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/command_line.h" |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 ExtensionPermissionMessage::kAllPageContent, kFlagNone, kTypeDefault); | 252 ExtensionPermissionMessage::kAllPageContent, kFlagNone, kTypeDefault); |
| 253 info->RegisterPermission( | 253 info->RegisterPermission( |
| 254 kPrivacy, "privacy", IDS_EXTENSION_PROMPT_WARNING_PRIVACY, | 254 kPrivacy, "privacy", IDS_EXTENSION_PROMPT_WARNING_PRIVACY, |
| 255 ExtensionPermissionMessage::kPrivacy, kFlagNone, kTypeDefault); | 255 ExtensionPermissionMessage::kPrivacy, kFlagNone, kTypeDefault); |
| 256 info->RegisterPermission( | 256 info->RegisterPermission( |
| 257 kStorage, "storage", 0, | 257 kStorage, "storage", 0, |
| 258 ExtensionPermissionMessage::kNone, kFlagNone, kTypeDefault); | 258 ExtensionPermissionMessage::kNone, kFlagNone, kTypeDefault); |
| 259 info->RegisterPermission( | 259 info->RegisterPermission( |
| 260 kTab, "tabs", IDS_EXTENSION_PROMPT_WARNING_TABS, | 260 kTab, "tabs", IDS_EXTENSION_PROMPT_WARNING_TABS, |
| 261 ExtensionPermissionMessage::kTabs, kFlagNone, | 261 ExtensionPermissionMessage::kTabs, kFlagNone, |
| 262 kTypeDefault - kTypePlatformApp); | 262 kTypeDefault); |
| 263 info->RegisterPermission( | 263 info->RegisterPermission( |
| 264 kTts, "tts", 0, | 264 kTts, "tts", 0, |
| 265 ExtensionPermissionMessage::kNone, kFlagCannotBeOptional, kTypeDefault); | 265 ExtensionPermissionMessage::kNone, kFlagCannotBeOptional, kTypeDefault); |
| 266 info->RegisterPermission( | 266 info->RegisterPermission( |
| 267 kTtsEngine, "ttsEngine", IDS_EXTENSION_PROMPT_WARNING_TTS_ENGINE, | 267 kTtsEngine, "ttsEngine", IDS_EXTENSION_PROMPT_WARNING_TTS_ENGINE, |
| 268 ExtensionPermissionMessage::kTtsEngine, | 268 ExtensionPermissionMessage::kTtsEngine, |
| 269 kFlagCannotBeOptional, kTypeDefault); | 269 kFlagCannotBeOptional, kTypeDefault); |
| 270 info->RegisterPermission( | 270 info->RegisterPermission( |
| 271 kWebNavigation, "webNavigation", | 271 kWebNavigation, "webNavigation", |
| 272 IDS_EXTENSION_PROMPT_WARNING_TABS, ExtensionPermissionMessage::kTabs, | 272 IDS_EXTENSION_PROMPT_WARNING_TABS, ExtensionPermissionMessage::kTabs, |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 ExtensionPermissionMessage::kFullAccess, kFlagImpliesFullURLAccess | | 365 ExtensionPermissionMessage::kFullAccess, kFlagImpliesFullURLAccess | |
| 366 kFlagImpliesFullAccess | kFlagCannotBeOptional, kTypeDefault); | 366 kFlagImpliesFullAccess | kFlagCannotBeOptional, kTypeDefault); |
| 367 | 367 |
| 368 // Platform-app permissions. | 368 // Platform-app permissions. |
| 369 info->RegisterPermission( | 369 info->RegisterPermission( |
| 370 kSocket, "socket", 0, ExtensionPermissionMessage::kNone, | 370 kSocket, "socket", 0, ExtensionPermissionMessage::kNone, |
| 371 kFlagCannotBeOptional, kTypePlatformApp); | 371 kFlagCannotBeOptional, kTypePlatformApp); |
| 372 | 372 |
| 373 // Register aliases. | 373 // Register aliases. |
| 374 info->RegisterAlias("unlimitedStorage", kOldUnlimitedStoragePermission); | 374 info->RegisterAlias("unlimitedStorage", kOldUnlimitedStoragePermission); |
| 375 // TODO(mihaip): Remove this alias for platform apps, and only give them |
| 376 // access to the chrome.windows.* APIs, but not the chrome.tabs.* ones. |
| 375 info->RegisterAlias("tabs", kWindowsPermission); | 377 info->RegisterAlias("tabs", kWindowsPermission); |
| 376 } | 378 } |
| 377 | 379 |
| 378 bool ExtensionAPIPermission::HasWhitelist() const { | 380 bool ExtensionAPIPermission::HasWhitelist() const { |
| 379 return !whitelist_.empty(); | 381 return !whitelist_.empty(); |
| 380 } | 382 } |
| 381 | 383 |
| 382 bool ExtensionAPIPermission::IsWhitelisted( | 384 bool ExtensionAPIPermission::IsWhitelisted( |
| 383 const std::string& extension_id) const { | 385 const std::string& extension_id) const { |
| 384 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 386 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 925 std::set<std::string> new_hosts_set(GetDistinctHosts(new_list, false, false)); | 927 std::set<std::string> new_hosts_set(GetDistinctHosts(new_list, false, false)); |
| 926 std::set<std::string> old_hosts_set(GetDistinctHosts(old_list, false, false)); | 928 std::set<std::string> old_hosts_set(GetDistinctHosts(old_list, false, false)); |
| 927 std::set<std::string> new_hosts_only; | 929 std::set<std::string> new_hosts_only; |
| 928 | 930 |
| 929 std::set_difference(new_hosts_set.begin(), new_hosts_set.end(), | 931 std::set_difference(new_hosts_set.begin(), new_hosts_set.end(), |
| 930 old_hosts_set.begin(), old_hosts_set.end(), | 932 old_hosts_set.begin(), old_hosts_set.end(), |
| 931 std::inserter(new_hosts_only, new_hosts_only.begin())); | 933 std::inserter(new_hosts_only, new_hosts_only.begin())); |
| 932 | 934 |
| 933 return !new_hosts_only.empty(); | 935 return !new_hosts_only.empty(); |
| 934 } | 936 } |
| OLD | NEW |