| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/active_script_controller.h" | 5 #include "chrome/browser/extensions/active_script_controller.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 | 134 |
| 135 // Allow the extension if it's been explicitly granted permission. | 135 // Allow the extension if it's been explicitly granted permission. |
| 136 if (permitted_extensions_.count(extension->id()) > 0) | 136 if (permitted_extensions_.count(extension->id()) > 0) |
| 137 return PermissionsData::ACCESS_ALLOWED; | 137 return PermissionsData::ACCESS_ALLOWED; |
| 138 | 138 |
| 139 GURL url = web_contents()->GetVisibleURL(); | 139 GURL url = web_contents()->GetVisibleURL(); |
| 140 int tab_id = SessionTabHelper::IdForTab(web_contents()); | 140 int tab_id = SessionTabHelper::IdForTab(web_contents()); |
| 141 switch (type) { | 141 switch (type) { |
| 142 case UserScript::CONTENT_SCRIPT: | 142 case UserScript::CONTENT_SCRIPT: |
| 143 return extension->permissions_data()->GetContentScriptAccess( | 143 return extension->permissions_data()->GetContentScriptAccess( |
| 144 extension, url, url, tab_id, -1, NULL); | 144 extension, url, tab_id, -1, NULL); |
| 145 case UserScript::PROGRAMMATIC_SCRIPT: | 145 case UserScript::PROGRAMMATIC_SCRIPT: |
| 146 return extension->permissions_data()->GetPageAccess( | 146 return extension->permissions_data()->GetPageAccess( |
| 147 extension, url, url, tab_id, -1, NULL); | 147 extension, url, tab_id, -1, NULL); |
| 148 } | 148 } |
| 149 | 149 |
| 150 NOTREACHED(); | 150 NOTREACHED(); |
| 151 return PermissionsData::ACCESS_DENIED; | 151 return PermissionsData::ACCESS_DENIED; |
| 152 } | 152 } |
| 153 | 153 |
| 154 void ActiveScriptController::RequestScriptInjection( | 154 void ActiveScriptController::RequestScriptInjection( |
| 155 const Extension* extension, | 155 const Extension* extension, |
| 156 const base::Closure& callback) { | 156 const base::Closure& callback) { |
| 157 CHECK(extension); | 157 CHECK(extension); |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 UnloadedExtensionInfo::Reason reason) { | 330 UnloadedExtensionInfo::Reason reason) { |
| 331 PendingRequestMap::iterator iter = pending_requests_.find(extension->id()); | 331 PendingRequestMap::iterator iter = pending_requests_.find(extension->id()); |
| 332 if (iter != pending_requests_.end()) { | 332 if (iter != pending_requests_.end()) { |
| 333 pending_requests_.erase(iter); | 333 pending_requests_.erase(iter); |
| 334 ExtensionActionAPI::Get(browser_context_)-> | 334 ExtensionActionAPI::Get(browser_context_)-> |
| 335 NotifyPageActionsChanged(web_contents()); | 335 NotifyPageActionsChanged(web_contents()); |
| 336 } | 336 } |
| 337 } | 337 } |
| 338 | 338 |
| 339 } // namespace extensions | 339 } // namespace extensions |
| OLD | NEW |