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/renderer/extensions/chrome_extensions_dispatcher_delegate.h" | 5 #include "chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/sha1.h" | 8 #include "base/sha1.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
300 } | 300 } |
301 } | 301 } |
302 | 302 |
303 void ChromeExtensionsDispatcherDelegate::UpdateTabSpecificPermissions( | 303 void ChromeExtensionsDispatcherDelegate::UpdateTabSpecificPermissions( |
304 const extensions::Dispatcher* dispatcher, | 304 const extensions::Dispatcher* dispatcher, |
305 const GURL& url, | 305 const GURL& url, |
306 int tab_id, | 306 int tab_id, |
307 const std::string& extension_id, | 307 const std::string& extension_id, |
308 const extensions::URLPatternSet& origin_set) { | 308 const extensions::URLPatternSet& origin_set) { |
309 content::RenderView* view = extensions::TabFinder::Find(tab_id); | 309 content::RenderView* view = extensions::TabFinder::Find(tab_id); |
310 if (!view) | |
311 return; | |
310 | 312 |
311 // For now, the message should only be sent to the render view that contains | 313 // For now, the message should only be sent to the render view that contains |
not at google - send to devlin
2014/11/12 16:28:09
Was this actually crashing before? The comment ind
msimonides
2014/11/13 17:13:20
Unfortunately I'm unable to reproduce the crash, w
not at google - send to devlin
2014/11/13 18:17:37
Good question. I'm seeing crashes on line 312, GUR
| |
312 // the target tab. This may change. Either way, if this is the target tab it | 314 // the target tab. This may change. Either way, if this is the target tab it |
313 // gives us the chance to check against the URL to avoid races. | 315 // gives us the chance to check against the URL to avoid races. |
314 DCHECK(view); | |
315 GURL active_url(view->GetWebView()->mainFrame()->document().url()); | 316 GURL active_url(view->GetWebView()->mainFrame()->document().url()); |
316 if (active_url != url) | 317 if (active_url != url) |
317 return; | 318 return; |
318 | 319 |
319 const extensions::Extension* extension = | 320 const extensions::Extension* extension = |
320 dispatcher->extensions()->GetByID(extension_id); | 321 dispatcher->extensions()->GetByID(extension_id); |
321 if (!extension) | 322 if (!extension) |
322 return; | 323 return; |
323 | 324 |
324 extension->permissions_data()->UpdateTabSpecificPermissions( | 325 extension->permissions_data()->UpdateTabSpecificPermissions( |
325 tab_id, | 326 tab_id, |
326 new extensions::PermissionSet(extensions::APIPermissionSet(), | 327 new extensions::PermissionSet(extensions::APIPermissionSet(), |
327 extensions::ManifestPermissionSet(), | 328 extensions::ManifestPermissionSet(), |
328 origin_set, | 329 origin_set, |
329 extensions::URLPatternSet())); | 330 extensions::URLPatternSet())); |
330 } | 331 } |
OLD | NEW |