OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/ui/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #endif // defined(OS_WIN) | 10 #endif // defined(OS_WIN) |
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
878 true)); | 878 true)); |
879 } | 879 } |
880 | 880 |
881 // static | 881 // static |
882 void Browser::RegisterProtocolHandlerHelper(WebContents* web_contents, | 882 void Browser::RegisterProtocolHandlerHelper(WebContents* web_contents, |
883 const std::string& protocol, | 883 const std::string& protocol, |
884 const GURL& url, | 884 const GURL& url, |
885 const string16& title, | 885 const string16& title, |
886 bool user_gesture, | 886 bool user_gesture, |
887 BrowserWindow* window) { | 887 BrowserWindow* window) { |
888 TabContents* tab_contents = TabContents::FromWebContents(web_contents); | 888 Profile* profile = |
889 if (!tab_contents || tab_contents->profile()->IsOffTheRecord()) | 889 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
| 890 if (profile->IsOffTheRecord()) |
890 return; | 891 return; |
891 | 892 |
892 ProtocolHandler handler = | 893 ProtocolHandler handler = |
893 ProtocolHandler::CreateProtocolHandler(protocol, url, title); | 894 ProtocolHandler::CreateProtocolHandler(protocol, url, title); |
894 | 895 |
895 ProtocolHandlerRegistry* registry = | 896 ProtocolHandlerRegistry* registry = profile->GetProtocolHandlerRegistry(); |
896 tab_contents->profile()->GetProtocolHandlerRegistry(); | |
897 TabSpecificContentSettings* tab_content_settings = | 897 TabSpecificContentSettings* tab_content_settings = |
898 TabSpecificContentSettings::FromWebContents(web_contents); | 898 TabSpecificContentSettings::FromWebContents(web_contents); |
899 | 899 |
900 if (registry->SilentlyHandleRegisterHandlerRequest(handler)) | 900 if (registry->SilentlyHandleRegisterHandlerRequest(handler)) |
901 return; | 901 return; |
902 | 902 |
903 if (!user_gesture && window) { | 903 if (!user_gesture && window) { |
904 tab_content_settings->set_pending_protocol_handler(handler); | 904 tab_content_settings->set_pending_protocol_handler(handler); |
905 tab_content_settings->set_previous_protocol_handler( | 905 tab_content_settings->set_previous_protocol_handler( |
906 registry->GetHandlerFor(handler.protocol())); | 906 registry->GetHandlerFor(handler.protocol())); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
956 selection_rect, | 956 selection_rect, |
957 active_match_ordinal, | 957 active_match_ordinal, |
958 final_update); | 958 final_update); |
959 } | 959 } |
960 | 960 |
961 // static | 961 // static |
962 void Browser::RequestMediaAccessPermissionHelper( | 962 void Browser::RequestMediaAccessPermissionHelper( |
963 content::WebContents* web_contents, | 963 content::WebContents* web_contents, |
964 const content::MediaStreamRequest* request, | 964 const content::MediaStreamRequest* request, |
965 const content::MediaResponseCallback& callback) { | 965 const content::MediaResponseCallback& callback) { |
966 TabContents* tab = TabContents::FromWebContents(web_contents); | 966 Profile* profile = |
| 967 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
967 | 968 |
968 scoped_ptr<MediaStreamDevicesController> | 969 scoped_ptr<MediaStreamDevicesController> |
969 controller(new MediaStreamDevicesController(tab->profile(), | 970 controller(new MediaStreamDevicesController(profile, |
970 request, | 971 request, |
971 callback)); | 972 callback)); |
972 if (!controller->DismissInfoBarAndTakeActionOnSettings()) { | 973 if (!controller->DismissInfoBarAndTakeActionOnSettings()) { |
973 InfoBarTabHelper* infobar_helper = | 974 InfoBarTabHelper* infobar_helper = |
974 InfoBarTabHelper::FromWebContents(web_contents); | 975 InfoBarTabHelper::FromWebContents(web_contents); |
975 InfoBarDelegate* old_infobar = NULL; | 976 InfoBarDelegate* old_infobar = NULL; |
976 for (size_t i = 0; i < infobar_helper->GetInfoBarCount(); ++i) { | 977 for (size_t i = 0; i < infobar_helper->GetInfoBarCount(); ++i) { |
977 old_infobar = infobar_helper->GetInfoBarDelegateAt(i)-> | 978 old_infobar = infobar_helper->GetInfoBarDelegateAt(i)-> |
978 AsMediaStreamInfoBarDelegate(); | 979 AsMediaStreamInfoBarDelegate(); |
979 if (old_infobar) | 980 if (old_infobar) |
(...skipping 1435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2415 if (contents && !allow_js_access) { | 2416 if (contents && !allow_js_access) { |
2416 contents->web_contents()->GetController().LoadURL( | 2417 contents->web_contents()->GetController().LoadURL( |
2417 target_url, | 2418 target_url, |
2418 content::Referrer(), | 2419 content::Referrer(), |
2419 content::PAGE_TRANSITION_LINK, | 2420 content::PAGE_TRANSITION_LINK, |
2420 std::string()); // No extra headers. | 2421 std::string()); // No extra headers. |
2421 } | 2422 } |
2422 | 2423 |
2423 return contents != NULL; | 2424 return contents != NULL; |
2424 } | 2425 } |
OLD | NEW |