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

Unified Diff: chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc

Issue 708713003: Don't crash when granting permissions to active tab. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change for with iterators to a foreach. Created 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc
diff --git a/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc b/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc
index c904398a68a0595ef23ba92301ccbf81bc677270..602aab799f76e13ada2be7169565b41c1ba1ba43 100644
--- a/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc
+++ b/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc
@@ -30,20 +30,16 @@
#include "content/public/renderer/render_view.h"
#include "extensions/common/extension.h"
#include "extensions/common/feature_switch.h"
-#include "extensions/common/permissions/api_permission_set.h"
#include "extensions/common/permissions/manifest_permission_set.h"
#include "extensions/common/permissions/permission_set.h"
#include "extensions/common/permissions/permissions_data.h"
#include "extensions/common/switches.h"
-#include "extensions/common/url_pattern_set.h"
#include "extensions/renderer/dispatcher.h"
#include "extensions/renderer/native_handler.h"
#include "extensions/renderer/resource_bundle_source_map.h"
#include "extensions/renderer/script_context.h"
#include "third_party/WebKit/public/platform/WebString.h"
-#include "third_party/WebKit/public/web/WebDocument.h"
#include "third_party/WebKit/public/web/WebSecurityPolicy.h"
-#include "third_party/WebKit/public/web/WebView.h"
#if defined(ENABLE_WEBRTC)
#include "chrome/renderer/extensions/cast_streaming_native_handler.h"
@@ -282,46 +278,3 @@ void ChromeExtensionsDispatcherDelegate::SetChannel(int channel) {
extensions::SetCurrentChannel(
static_cast<chrome::VersionInfo::Channel>(channel));
}
-
-void ChromeExtensionsDispatcherDelegate::ClearTabSpecificPermissions(
- const extensions::Dispatcher* dispatcher,
- int tab_id,
- const std::vector<std::string>& extension_ids) {
- for (std::vector<std::string>::const_iterator it = extension_ids.begin();
- it != extension_ids.end();
- ++it) {
- const extensions::Extension* extension =
- dispatcher->extensions()->GetByID(*it);
- if (extension)
- extension->permissions_data()->ClearTabSpecificPermissions(tab_id);
- }
-}
-
-void ChromeExtensionsDispatcherDelegate::UpdateTabSpecificPermissions(
- const extensions::Dispatcher* dispatcher,
- const GURL& url,
- int tab_id,
- const std::string& extension_id,
- const extensions::URLPatternSet& origin_set) {
- content::RenderView* view = extensions::TabFinder::Find(tab_id);
-
- // For now, the message should only be sent to the render view that contains
- // the target tab. This may change. Either way, if this is the target tab it
- // gives us the chance to check against the URL to avoid races.
- DCHECK(view);
- GURL active_url(view->GetWebView()->mainFrame()->document().url());
- if (active_url != url)
- return;
-
- const extensions::Extension* extension =
- dispatcher->extensions()->GetByID(extension_id);
- if (!extension)
- return;
-
- extension->permissions_data()->UpdateTabSpecificPermissions(
- tab_id,
- new extensions::PermissionSet(extensions::APIPermissionSet(),
- extensions::ManifestPermissionSet(),
- origin_set,
- extensions::URLPatternSet()));
-}
« no previous file with comments | « chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.h ('k') | extensions/common/extension_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698