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

Side by Side Diff: chrome/browser/chrome_content_browser_client.cc

Issue 8312005: Ignore paths when matching patterns for extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix silly typo. Created 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/chrome_content_browser_client.h" 5 #include "chrome/browser/chrome_content_browser_client.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/app/breakpad_mac.h" 8 #include "chrome/app/breakpad_mac.h"
9 #include "chrome/browser/browser_about_handler.h" 9 #include "chrome/browser/browser_about_handler.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 Profile* profile = Profile::FromBrowserContext(process->browser_context()); 755 Profile* profile = Profile::FromBrowserContext(process->browser_context());
756 DesktopNotificationService* service = 756 DesktopNotificationService* service =
757 DesktopNotificationServiceFactory::GetForProfile(profile); 757 DesktopNotificationServiceFactory::GetForProfile(profile);
758 service->RequestPermission( 758 service->RequestPermission(
759 source_origin, render_process_id, render_view_id, callback_context, 759 source_origin, render_process_id, render_view_id, callback_context,
760 tab_util::GetTabContentsByID(render_process_id, render_view_id)); 760 tab_util::GetTabContentsByID(render_process_id, render_view_id));
761 } 761 }
762 762
763 WebKit::WebNotificationPresenter::Permission 763 WebKit::WebNotificationPresenter::Permission
764 ChromeContentBrowserClient::CheckDesktopNotificationPermission( 764 ChromeContentBrowserClient::CheckDesktopNotificationPermission(
765 const GURL& source_url, 765 const GURL& source_origin,
766 const content::ResourceContext& context) { 766 const content::ResourceContext& context,
767 int render_process_id) {
767 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 768 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
768 ProfileIOData* io_data = 769 ProfileIOData* io_data =
769 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL)); 770 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL));
770 771
771 const Extension* extension = 772 if (io_data->GetExtensionInfoMap()->SecurityOriginHasAPIPermission(
772 io_data->GetExtensionInfoMap()->extensions().GetByURL(source_url); 773 source_origin, render_process_id,
773 if (extension && 774 ExtensionAPIPermission::kNotification))
774 extension->HasAPIPermission(ExtensionAPIPermission::kNotification)) {
775 return WebKit::WebNotificationPresenter::PermissionAllowed; 775 return WebKit::WebNotificationPresenter::PermissionAllowed;
776 }
777 776
778 // Fall back to the regular notification preferences, which works on an 777 // Fall back to the regular notification preferences, which works on an
779 // origin basis. 778 // origin basis.
779 // TODO(dcheng): Change to just source_origin once WebKit side is cleaned up.
780 return io_data->GetNotificationService() ? 780 return io_data->GetNotificationService() ?
781 io_data->GetNotificationService()->HasPermission(source_url.GetOrigin()) : 781 io_data->GetNotificationService()->HasPermission(
782 source_origin.GetOrigin()) :
782 WebKit::WebNotificationPresenter::PermissionNotAllowed; 783 WebKit::WebNotificationPresenter::PermissionNotAllowed;
783 } 784 }
784 785
785 void ChromeContentBrowserClient::ShowDesktopNotification( 786 void ChromeContentBrowserClient::ShowDesktopNotification(
786 const DesktopNotificationHostMsg_Show_Params& params, 787 const DesktopNotificationHostMsg_Show_Params& params,
787 int render_process_id, 788 int render_process_id,
788 int render_view_id, 789 int render_view_id,
789 bool worker) { 790 bool worker) {
790 RenderViewHost* rvh = RenderViewHost::FromID( 791 RenderViewHost* rvh = RenderViewHost::FromID(
791 render_process_id, render_view_id); 792 render_process_id, render_view_id);
(...skipping 25 matching lines...) Expand all
817 818
818 RenderProcessHost* process = rvh->process(); 819 RenderProcessHost* process = rvh->process();
819 Profile* profile = Profile::FromBrowserContext(process->browser_context()); 820 Profile* profile = Profile::FromBrowserContext(process->browser_context());
820 DesktopNotificationService* service = 821 DesktopNotificationService* service =
821 DesktopNotificationServiceFactory::GetForProfile(profile); 822 DesktopNotificationServiceFactory::GetForProfile(profile);
822 service->CancelDesktopNotification( 823 service->CancelDesktopNotification(
823 render_process_id, render_view_id, notification_id); 824 render_process_id, render_view_id, notification_id);
824 } 825 }
825 826
826 bool ChromeContentBrowserClient::CanCreateWindow( 827 bool ChromeContentBrowserClient::CanCreateWindow(
827 const GURL& source_url, 828 const GURL& source_origin,
828 WindowContainerType container_type, 829 WindowContainerType container_type,
829 const content::ResourceContext& context) { 830 const content::ResourceContext& context,
831 int render_process_id) {
830 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 832 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
831 // If the opener is trying to create a background window but doesn't have 833 // If the opener is trying to create a background window but doesn't have
832 // the appropriate permission, fail the attempt. 834 // the appropriate permission, fail the attempt.
833 if (container_type == WINDOW_CONTAINER_TYPE_BACKGROUND) { 835 if (container_type == WINDOW_CONTAINER_TYPE_BACKGROUND) {
834 ProfileIOData* io_data = 836 ProfileIOData* io_data =
835 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL)); 837 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL));
836 const Extension* extension = 838 return io_data->GetExtensionInfoMap()->SecurityOriginHasAPIPermission(
837 io_data->GetExtensionInfoMap()->extensions().GetByURL(source_url); 839 source_origin, render_process_id, ExtensionAPIPermission::kBackground);
838 return (extension &&
839 extension->HasAPIPermission(ExtensionAPIPermission::kBackground));
840 } 840 }
841 return true; 841 return true;
842 } 842 }
843 843
844 std::string ChromeContentBrowserClient::GetWorkerProcessTitle( 844 std::string ChromeContentBrowserClient::GetWorkerProcessTitle(
845 const GURL& url, const content::ResourceContext& context) { 845 const GURL& url, const content::ResourceContext& context) {
846 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 846 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
847 // Check if it's an extension-created worker, in which case we want to use 847 // Check if it's an extension-created worker, in which case we want to use
848 // the name of the extension. 848 // the name of the extension.
849 ProfileIOData* io_data = 849 ProfileIOData* io_data =
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 #if defined(USE_NSS) 988 #if defined(USE_NSS)
989 crypto::CryptoModuleBlockingPasswordDelegate* 989 crypto::CryptoModuleBlockingPasswordDelegate*
990 ChromeContentBrowserClient::GetCryptoPasswordDelegate( 990 ChromeContentBrowserClient::GetCryptoPasswordDelegate(
991 const GURL& url) { 991 const GURL& url) {
992 return browser::NewCryptoModuleBlockingDialogDelegate( 992 return browser::NewCryptoModuleBlockingDialogDelegate(
993 browser::kCryptoModulePasswordKeygen, url.host()); 993 browser::kCryptoModulePasswordKeygen, url.host());
994 } 994 }
995 #endif 995 #endif
996 996
997 } // namespace chrome 997 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698