OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/extension_function_dispatcher.h" | 5 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/process_util.h" | 9 #include "base/process_util.h" |
10 #include "base/singleton.h" | 10 #include "base/singleton.h" |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 // Notify the ExtensionProcessManager that the view was created. | 384 // Notify the ExtensionProcessManager that the view was created. |
385 ExtensionProcessManager* epm = profile()->GetExtensionProcessManager(); | 385 ExtensionProcessManager* epm = profile()->GetExtensionProcessManager(); |
386 epm->RegisterExtensionProcess(extension_id(), | 386 epm->RegisterExtensionProcess(extension_id(), |
387 render_view_host->process()->id()); | 387 render_view_host->process()->id()); |
388 | 388 |
389 // If the extension has permission to load chrome://favicon/ resources we need | 389 // If the extension has permission to load chrome://favicon/ resources we need |
390 // to make sure that the WebUIFavIconSource is registered with the | 390 // to make sure that the WebUIFavIconSource is registered with the |
391 // ChromeURLDataManager. | 391 // ChromeURLDataManager. |
392 if (extension->HasHostPermission(GURL(chrome::kChromeUIFavIconURL))) { | 392 if (extension->HasHostPermission(GURL(chrome::kChromeUIFavIconURL))) { |
393 WebUIFavIconSource* favicon_source = new WebUIFavIconSource(profile_); | 393 WebUIFavIconSource* favicon_source = new WebUIFavIconSource(profile_); |
394 BrowserThread::PostTask( | 394 profile_->GetChromeURLDataManager()->AddDataSource(favicon_source); |
395 BrowserThread::IO, FROM_HERE, | |
396 NewRunnableMethod(ChromeURLDataManager::GetInstance(), | |
397 &ChromeURLDataManager::AddDataSource, | |
398 make_scoped_refptr(favicon_source))); | |
399 } | 395 } |
400 | 396 |
401 // Update the extension permissions. Doing this each time we create an EFD | 397 // Update the extension permissions. Doing this each time we create an EFD |
402 // ensures that new processes are informed of permissions for newly installed | 398 // ensures that new processes are informed of permissions for newly installed |
403 // extensions. | 399 // extensions. |
404 render_view_host->Send(new ViewMsg_Extension_SetAPIPermissions( | 400 render_view_host->Send(new ViewMsg_Extension_SetAPIPermissions( |
405 extension->id(), extension->api_permissions())); | 401 extension->id(), extension->api_permissions())); |
406 render_view_host->Send(new ViewMsg_Extension_SetHostPermissions( | 402 render_view_host->Send(new ViewMsg_Extension_SetHostPermissions( |
407 extension->url(), extension->host_permissions())); | 403 extension->url(), extension->host_permissions())); |
408 | 404 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 NOTREACHED(); | 497 NOTREACHED(); |
502 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_EFD")); | 498 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_EFD")); |
503 base::KillProcess(render_view_host_->process()->GetHandle(), | 499 base::KillProcess(render_view_host_->process()->GetHandle(), |
504 ResultCodes::KILLED_BAD_MESSAGE, false); | 500 ResultCodes::KILLED_BAD_MESSAGE, false); |
505 } | 501 } |
506 } | 502 } |
507 | 503 |
508 Profile* ExtensionFunctionDispatcher::profile() { | 504 Profile* ExtensionFunctionDispatcher::profile() { |
509 return profile_; | 505 return profile_; |
510 } | 506 } |
OLD | NEW |