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

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

Issue 10782038: Revert 147045 - Bring up a content settings icon for ungestured registerProtocolHandler call. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 months 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 // OS_WIN 10 #endif // OS_WIN
(...skipping 19 matching lines...) Expand all
30 #include "chrome/browser/autofill/personal_data_manager_factory.h" 30 #include "chrome/browser/autofill/personal_data_manager_factory.h"
31 #include "chrome/browser/background/background_contents_service.h" 31 #include "chrome/browser/background/background_contents_service.h"
32 #include "chrome/browser/background/background_contents_service_factory.h" 32 #include "chrome/browser/background/background_contents_service_factory.h"
33 #include "chrome/browser/bookmarks/bookmark_model.h" 33 #include "chrome/browser/bookmarks/bookmark_model.h"
34 #include "chrome/browser/bookmarks/bookmark_utils.h" 34 #include "chrome/browser/bookmarks/bookmark_utils.h"
35 #include "chrome/browser/browser_process.h" 35 #include "chrome/browser/browser_process.h"
36 #include "chrome/browser/browser_shutdown.h" 36 #include "chrome/browser/browser_shutdown.h"
37 #include "chrome/browser/character_encoding.h" 37 #include "chrome/browser/character_encoding.h"
38 #include "chrome/browser/chrome_page_zoom.h" 38 #include "chrome/browser/chrome_page_zoom.h"
39 #include "chrome/browser/content_settings/host_content_settings_map.h" 39 #include "chrome/browser/content_settings/host_content_settings_map.h"
40 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
41 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" 40 #include "chrome/browser/custom_handlers/protocol_handler_registry.h"
42 #include "chrome/browser/custom_handlers/register_protocol_handler_infobar_deleg ate.h" 41 #include "chrome/browser/custom_handlers/register_protocol_handler_infobar_deleg ate.h"
43 #include "chrome/browser/debugger/devtools_toggle_action.h" 42 #include "chrome/browser/debugger/devtools_toggle_action.h"
44 #include "chrome/browser/debugger/devtools_window.h" 43 #include "chrome/browser/debugger/devtools_window.h"
45 #include "chrome/browser/download/download_crx_util.h" 44 #include "chrome/browser/download/download_crx_util.h"
46 #include "chrome/browser/download/download_item_model.h" 45 #include "chrome/browser/download/download_item_model.h"
47 #include "chrome/browser/download/download_service.h" 46 #include "chrome/browser/download/download_service.h"
48 #include "chrome/browser/download/download_service_factory.h" 47 #include "chrome/browser/download/download_service_factory.h"
49 #include "chrome/browser/download/download_shelf.h" 48 #include "chrome/browser/download/download_shelf.h"
50 #include "chrome/browser/download/download_started_animation.h" 49 #include "chrome/browser/download/download_started_animation.h"
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 NULL, 845 NULL,
847 l10n_util::GetStringUTF16(IDS_JS_OUT_OF_MEMORY_PROMPT), 846 l10n_util::GetStringUTF16(IDS_JS_OUT_OF_MEMORY_PROMPT),
848 true)); 847 true));
849 } 848 }
850 849
851 // static 850 // static
852 void Browser::RegisterProtocolHandlerHelper(WebContents* web_contents, 851 void Browser::RegisterProtocolHandlerHelper(WebContents* web_contents,
853 const std::string& protocol, 852 const std::string& protocol,
854 const GURL& url, 853 const GURL& url,
855 const string16& title, 854 const string16& title,
856 bool user_gesture, 855 bool user_gesture) {
857 BrowserWindow* window) {
858 TabContents* tab_contents = TabContents::FromWebContents(web_contents); 856 TabContents* tab_contents = TabContents::FromWebContents(web_contents);
859 if (!tab_contents || tab_contents->profile()->IsOffTheRecord()) 857 if (!tab_contents || tab_contents->profile()->IsOffTheRecord())
860 return; 858 return;
861 859
862 ProtocolHandler handler = 860 ProtocolHandler handler =
863 ProtocolHandler::CreateProtocolHandler(protocol, url, title); 861 ProtocolHandler::CreateProtocolHandler(protocol, url, title);
864 862
865 ProtocolHandlerRegistry* registry = 863 ProtocolHandlerRegistry* registry =
866 tab_contents->profile()->GetProtocolHandlerRegistry(); 864 tab_contents->profile()->GetProtocolHandlerRegistry();
867 TabSpecificContentSettings* content_settings =
868 tab_contents->content_settings();
869 865
870 if (!user_gesture && window) { 866 // TODO(gbillock): Replace this policy with one that shows the content
871 content_settings->set_pending_protocol_handler(handler); 867 // settings icon.
872 content_settings->set_previous_protocol_handler( 868 if (!user_gesture)
873 registry->GetHandlerFor(handler.protocol()));
874 window->GetLocationBar()->UpdateContentSettingsIcons();
875 return; 869 return;
876 }
877
878 // Make sure content-setting icon is turned off in case the page does
879 // ungestured and gestured RPH calls.
880 if (window) {
881 content_settings->ClearPendingProtocolHandler();
882 window->GetLocationBar()->UpdateContentSettingsIcons();
883 }
884 870
885 if (!registry->SilentlyHandleRegisterHandlerRequest(handler)) { 871 if (!registry->SilentlyHandleRegisterHandlerRequest(handler)) {
886 content::RecordAction( 872 content::RecordAction(
887 UserMetricsAction("RegisterProtocolHandler.InfoBar_Shown")); 873 UserMetricsAction("RegisterProtocolHandler.InfoBar_Shown"));
888 InfoBarTabHelper* infobar_helper = tab_contents->infobar_tab_helper(); 874 InfoBarTabHelper* infobar_helper = tab_contents->infobar_tab_helper();
889 875
890 RegisterProtocolHandlerInfoBarDelegate* rph_delegate = 876 RegisterProtocolHandlerInfoBarDelegate* rph_delegate =
891 new RegisterProtocolHandlerInfoBarDelegate(infobar_helper, 877 new RegisterProtocolHandlerInfoBarDelegate(infobar_helper,
892 registry, 878 registry,
893 handler); 879 handler);
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after
1595 void Browser::JSOutOfMemory(WebContents* web_contents) { 1581 void Browser::JSOutOfMemory(WebContents* web_contents) {
1596 JSOutOfMemoryHelper(web_contents); 1582 JSOutOfMemoryHelper(web_contents);
1597 } 1583 }
1598 1584
1599 void Browser::RegisterProtocolHandler(WebContents* web_contents, 1585 void Browser::RegisterProtocolHandler(WebContents* web_contents,
1600 const std::string& protocol, 1586 const std::string& protocol,
1601 const GURL& url, 1587 const GURL& url,
1602 const string16& title, 1588 const string16& title,
1603 bool user_gesture) { 1589 bool user_gesture) {
1604 RegisterProtocolHandlerHelper( 1590 RegisterProtocolHandlerHelper(
1605 web_contents, protocol, url, title, user_gesture, window()); 1591 web_contents, protocol, url, title, user_gesture);
1606 } 1592 }
1607 1593
1608 void Browser::RegisterIntentHandler( 1594 void Browser::RegisterIntentHandler(
1609 WebContents* web_contents, 1595 WebContents* web_contents,
1610 const webkit_glue::WebIntentServiceData& data, 1596 const webkit_glue::WebIntentServiceData& data,
1611 bool user_gesture) { 1597 bool user_gesture) {
1612 RegisterIntentHandlerHelper(web_contents, data, user_gesture); 1598 RegisterIntentHandlerHelper(web_contents, data, user_gesture);
1613 } 1599 }
1614 1600
1615 void Browser::WebIntentDispatch( 1601 void Browser::WebIntentDispatch(
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
2275 if (contents && !allow_js_access) { 2261 if (contents && !allow_js_access) {
2276 contents->web_contents()->GetController().LoadURL( 2262 contents->web_contents()->GetController().LoadURL(
2277 target_url, 2263 target_url,
2278 content::Referrer(), 2264 content::Referrer(),
2279 content::PAGE_TRANSITION_LINK, 2265 content::PAGE_TRANSITION_LINK,
2280 std::string()); // No extra headers. 2266 std::string()); // No extra headers.
2281 } 2267 }
2282 2268
2283 return contents != NULL; 2269 return contents != NULL;
2284 } 2270 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser.h ('k') | chrome/browser/ui/browser_content_setting_bubble_model_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698