| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/permissions/permissions_data.h" | 5 #include "chrome/common/extensions/permissions/permissions_data.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| 11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "chrome/common/extensions/extension.h" | 14 #include "chrome/common/extensions/extension.h" |
| 15 #include "chrome/common/extensions/extension_constants.h" | |
| 16 #include "content/public/common/url_constants.h" | 15 #include "content/public/common/url_constants.h" |
| 17 #include "extensions/common/constants.h" | 16 #include "extensions/common/constants.h" |
| 18 #include "extensions/common/error_utils.h" | 17 #include "extensions/common/error_utils.h" |
| 18 #include "extensions/common/extension_urls.h" |
| 19 #include "extensions/common/extensions_client.h" | 19 #include "extensions/common/extensions_client.h" |
| 20 #include "extensions/common/features/feature.h" | 20 #include "extensions/common/features/feature.h" |
| 21 #include "extensions/common/features/feature_provider.h" | 21 #include "extensions/common/features/feature_provider.h" |
| 22 #include "extensions/common/manifest.h" | 22 #include "extensions/common/manifest.h" |
| 23 #include "extensions/common/manifest_constants.h" | 23 #include "extensions/common/manifest_constants.h" |
| 24 #include "extensions/common/manifest_constants.h" | 24 #include "extensions/common/manifest_constants.h" |
| 25 #include "extensions/common/permissions/api_permission_set.h" | 25 #include "extensions/common/permissions/api_permission_set.h" |
| 26 #include "extensions/common/permissions/permission_message_provider.h" | 26 #include "extensions/common/permissions/permission_message_provider.h" |
| 27 #include "extensions/common/permissions/permission_set.h" | 27 #include "extensions/common/permissions/permission_set.h" |
| 28 #include "extensions/common/permissions/permissions_info.h" | 28 #include "extensions/common/permissions/permissions_info.h" |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 int tab_id, | 459 int tab_id, |
| 460 const UserScript* script, | 460 const UserScript* script, |
| 461 int process_id, | 461 int process_id, |
| 462 std::string* error) { | 462 std::string* error) { |
| 463 base::AutoLock auto_lock(extension->permissions_data()->runtime_lock_); | 463 base::AutoLock auto_lock(extension->permissions_data()->runtime_lock_); |
| 464 // The gallery is special-cased as a restricted URL for scripting to prevent | 464 // The gallery is special-cased as a restricted URL for scripting to prevent |
| 465 // access to special JS bindings we expose to the gallery (and avoid things | 465 // access to special JS bindings we expose to the gallery (and avoid things |
| 466 // like extensions removing the "report abuse" link). | 466 // like extensions removing the "report abuse" link). |
| 467 // TODO(erikkay): This seems like the wrong test. Shouldn't we we testing | 467 // TODO(erikkay): This seems like the wrong test. Shouldn't we we testing |
| 468 // against the store app extent? | 468 // against the store app extent? |
| 469 GURL store_url(extension_urls::GetWebstoreLaunchURL()); | 469 GURL store_url(GetWebstoreLaunchURL()); |
| 470 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 470 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 471 bool can_execute_everywhere = CanExecuteScriptEverywhere(extension); | 471 bool can_execute_everywhere = CanExecuteScriptEverywhere(extension); |
| 472 | 472 |
| 473 if (g_policy_delegate && | 473 if (g_policy_delegate && |
| 474 !g_policy_delegate->CanExecuteScriptOnPage( | 474 !g_policy_delegate->CanExecuteScriptOnPage( |
| 475 extension, document_url, top_frame_url, tab_id, | 475 extension, document_url, top_frame_url, tab_id, |
| 476 script, process_id, error)) | 476 script, process_id, error)) |
| 477 return false; | 477 return false; |
| 478 | 478 |
| 479 if ((document_url.host() == store_url.host()) && | 479 if ((document_url.host() == store_url.host()) && |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 optional_permission_set_ = new PermissionSet( | 618 optional_permission_set_ = new PermissionSet( |
| 619 initial_optional_permissions_->api_permissions, | 619 initial_optional_permissions_->api_permissions, |
| 620 initial_optional_permissions_->host_permissions, | 620 initial_optional_permissions_->host_permissions, |
| 621 URLPatternSet()); | 621 URLPatternSet()); |
| 622 | 622 |
| 623 initial_required_permissions_.reset(); | 623 initial_required_permissions_.reset(); |
| 624 initial_optional_permissions_.reset(); | 624 initial_optional_permissions_.reset(); |
| 625 } | 625 } |
| 626 | 626 |
| 627 } // namespace extensions | 627 } // namespace extensions |
| OLD | NEW |