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

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

Issue 12225076: Delete most web intents code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 10 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
« no previous file with comments | « chrome/browser/ui/browser.h ('k') | chrome/browser/ui/browser_commands.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 #include "chrome/browser/download/download_shelf.h" 51 #include "chrome/browser/download/download_shelf.h"
52 #include "chrome/browser/extensions/browser_extension_window_controller.h" 52 #include "chrome/browser/extensions/browser_extension_window_controller.h"
53 #include "chrome/browser/extensions/extension_prefs.h" 53 #include "chrome/browser/extensions/extension_prefs.h"
54 #include "chrome/browser/extensions/extension_service.h" 54 #include "chrome/browser/extensions/extension_service.h"
55 #include "chrome/browser/extensions/extension_system.h" 55 #include "chrome/browser/extensions/extension_system.h"
56 #include "chrome/browser/extensions/tab_helper.h" 56 #include "chrome/browser/extensions/tab_helper.h"
57 #include "chrome/browser/favicon/favicon_tab_helper.h" 57 #include "chrome/browser/favicon/favicon_tab_helper.h"
58 #include "chrome/browser/file_select_helper.h" 58 #include "chrome/browser/file_select_helper.h"
59 #include "chrome/browser/first_run/first_run.h" 59 #include "chrome/browser/first_run/first_run.h"
60 #include "chrome/browser/google/google_url_tracker.h" 60 #include "chrome/browser/google/google_url_tracker.h"
61 #include "chrome/browser/intents/register_intent_handler_infobar_delegate.h"
62 #include "chrome/browser/intents/web_intents_reporting.h"
63 #include "chrome/browser/intents/web_intents_util.h"
64 #include "chrome/browser/lifetime/application_lifetime.h" 61 #include "chrome/browser/lifetime/application_lifetime.h"
65 #include "chrome/browser/net/url_fixer_upper.h" 62 #include "chrome/browser/net/url_fixer_upper.h"
66 #include "chrome/browser/notifications/notification_ui_manager.h" 63 #include "chrome/browser/notifications/notification_ui_manager.h"
67 #include "chrome/browser/pepper_broker_infobar_delegate.h" 64 #include "chrome/browser/pepper_broker_infobar_delegate.h"
68 #include "chrome/browser/prefs/incognito_mode_prefs.h" 65 #include "chrome/browser/prefs/incognito_mode_prefs.h"
69 #include "chrome/browser/prefs/pref_service.h" 66 #include "chrome/browser/prefs/pref_service.h"
70 #include "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h" 67 #include "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h"
71 #include "chrome/browser/profiles/profile.h" 68 #include "chrome/browser/profiles/profile.h"
72 #include "chrome/browser/profiles/profile_destroyer.h" 69 #include "chrome/browser/profiles/profile_destroyer.h"
73 #include "chrome/browser/profiles/profile_manager.h" 70 #include "chrome/browser/profiles/profile_manager.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 #include "chrome/browser/ui/chrome_pages.h" 106 #include "chrome/browser/ui/chrome_pages.h"
110 #include "chrome/browser/ui/chrome_select_file_policy.h" 107 #include "chrome/browser/ui/chrome_select_file_policy.h"
111 #include "chrome/browser/ui/extensions/shell_window.h" 108 #include "chrome/browser/ui/extensions/shell_window.h"
112 #include "chrome/browser/ui/find_bar/find_bar.h" 109 #include "chrome/browser/ui/find_bar/find_bar.h"
113 #include "chrome/browser/ui/find_bar/find_bar_controller.h" 110 #include "chrome/browser/ui/find_bar/find_bar_controller.h"
114 #include "chrome/browser/ui/find_bar/find_tab_helper.h" 111 #include "chrome/browser/ui/find_bar/find_tab_helper.h"
115 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" 112 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h"
116 #include "chrome/browser/ui/global_error/global_error.h" 113 #include "chrome/browser/ui/global_error/global_error.h"
117 #include "chrome/browser/ui/global_error/global_error_service.h" 114 #include "chrome/browser/ui/global_error/global_error_service.h"
118 #include "chrome/browser/ui/global_error/global_error_service_factory.h" 115 #include "chrome/browser/ui/global_error/global_error_service_factory.h"
119 #include "chrome/browser/ui/intents/web_intent_picker_controller.h"
120 #include "chrome/browser/ui/media_stream_infobar_delegate.h" 116 #include "chrome/browser/ui/media_stream_infobar_delegate.h"
121 #include "chrome/browser/ui/omnibox/location_bar.h" 117 #include "chrome/browser/ui/omnibox/location_bar.h"
122 #include "chrome/browser/ui/screen_capture_infobar_delegate.h" 118 #include "chrome/browser/ui/screen_capture_infobar_delegate.h"
123 #include "chrome/browser/ui/search/search.h" 119 #include "chrome/browser/ui/search/search.h"
124 #include "chrome/browser/ui/search/search_delegate.h" 120 #include "chrome/browser/ui/search/search_delegate.h"
125 #include "chrome/browser/ui/search/search_model.h" 121 #include "chrome/browser/ui/search/search_model.h"
126 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" 122 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h"
127 #include "chrome/browser/ui/singleton_tabs.h" 123 #include "chrome/browser/ui/singleton_tabs.h"
128 #include "chrome/browser/ui/status_bubble.h" 124 #include "chrome/browser/ui/status_bubble.h"
129 #include "chrome/browser/ui/sync/browser_synced_window_delegate.h" 125 #include "chrome/browser/ui/sync/browser_synced_window_delegate.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 #include "content/public/browser/navigation_entry.h" 160 #include "content/public/browser/navigation_entry.h"
165 #include "content/public/browser/notification_details.h" 161 #include "content/public/browser/notification_details.h"
166 #include "content/public/browser/notification_service.h" 162 #include "content/public/browser/notification_service.h"
167 #include "content/public/browser/plugin_service.h" 163 #include "content/public/browser/plugin_service.h"
168 #include "content/public/browser/render_process_host.h" 164 #include "content/public/browser/render_process_host.h"
169 #include "content/public/browser/render_view_host.h" 165 #include "content/public/browser/render_view_host.h"
170 #include "content/public/browser/site_instance.h" 166 #include "content/public/browser/site_instance.h"
171 #include "content/public/browser/user_metrics.h" 167 #include "content/public/browser/user_metrics.h"
172 #include "content/public/browser/web_contents.h" 168 #include "content/public/browser/web_contents.h"
173 #include "content/public/browser/web_contents_view.h" 169 #include "content/public/browser/web_contents_view.h"
174 #include "content/public/browser/web_intents_dispatcher.h"
175 #include "content/public/common/content_restriction.h" 170 #include "content/public/common/content_restriction.h"
176 #include "content/public/common/content_switches.h" 171 #include "content/public/common/content_switches.h"
177 #include "content/public/common/page_zoom.h" 172 #include "content/public/common/page_zoom.h"
178 #include "content/public/common/renderer_preferences.h" 173 #include "content/public/common/renderer_preferences.h"
179 #include "extensions/common/constants.h" 174 #include "extensions/common/constants.h"
180 #include "grit/chromium_strings.h" 175 #include "grit/chromium_strings.h"
181 #include "grit/generated_resources.h" 176 #include "grit/generated_resources.h"
182 #include "grit/locale_settings.h" 177 #include "grit/locale_settings.h"
183 #include "grit/theme_resources.h" 178 #include "grit/theme_resources.h"
184 #include "net/base/net_util.h" 179 #include "net/base/net_util.h"
185 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" 180 #include "net/base/registry_controlled_domains/registry_controlled_domain.h"
186 #include "net/cookies/cookie_monster.h" 181 #include "net/cookies/cookie_monster.h"
187 #include "net/url_request/url_request_context.h" 182 #include "net/url_request/url_request_context.h"
188 #include "ui/base/l10n/l10n_util.h" 183 #include "ui/base/l10n/l10n_util.h"
189 #include "ui/base/window_open_disposition.h" 184 #include "ui/base/window_open_disposition.h"
190 #include "ui/gfx/point.h" 185 #include "ui/gfx/point.h"
191 #include "ui/shell_dialogs/selected_file_info.h" 186 #include "ui/shell_dialogs/selected_file_info.h"
192 #include "webkit/glue/web_intent_data.h"
193 #include "webkit/glue/web_intent_service_data.h"
194 #include "webkit/glue/webkit_glue.h" 187 #include "webkit/glue/webkit_glue.h"
195 #include "webkit/plugins/webplugininfo.h" 188 #include "webkit/plugins/webplugininfo.h"
196 189
197 #if defined(OS_WIN) 190 #if defined(OS_WIN)
198 #include "base/win/metro.h" 191 #include "base/win/metro.h"
199 #include "chrome/browser/autofill/autofill_ie_toolbar_import_win.h" 192 #include "chrome/browser/autofill/autofill_ie_toolbar_import_win.h"
200 #include "chrome/browser/shell_integration.h" 193 #include "chrome/browser/shell_integration.h"
201 #include "chrome/browser/ssl/ssl_error_info.h" 194 #include "chrome/browser/ssl/ssl_error_info.h"
202 #include "chrome/browser/task_manager/task_manager.h" 195 #include "chrome/browser/task_manager/task_manager.h"
203 #include "chrome/browser/ui/view_ids.h" 196 #include "chrome/browser/ui/view_ids.h"
(...skipping 1385 matching lines...) Expand 10 before | Expand all | Expand 10 after
1589 1582
1590 void Browser::RegisterProtocolHandler(WebContents* web_contents, 1583 void Browser::RegisterProtocolHandler(WebContents* web_contents,
1591 const std::string& protocol, 1584 const std::string& protocol,
1592 const GURL& url, 1585 const GURL& url,
1593 const string16& title, 1586 const string16& title,
1594 bool user_gesture) { 1587 bool user_gesture) {
1595 RegisterProtocolHandlerHelper( 1588 RegisterProtocolHandlerHelper(
1596 web_contents, protocol, url, title, user_gesture, window()); 1589 web_contents, protocol, url, title, user_gesture, window());
1597 } 1590 }
1598 1591
1599 #if defined(ENABLE_WEB_INTENTS)
1600 void Browser::RegisterIntentHandler(
1601 WebContents* web_contents,
1602 const webkit_glue::WebIntentServiceData& data,
1603 bool user_gesture) {
1604 RegisterIntentHandlerInfoBarDelegate::Create(web_contents, data);
1605 }
1606
1607 void Browser::WebIntentDispatch(
1608 WebContents* web_contents,
1609 content::WebIntentsDispatcher* intents_dispatcher) {
1610 if (!web_intents::IsWebIntentsEnabledForProfile(profile_)) {
1611 web_intents::RecordIntentsDispatchDisabled();
1612 delete intents_dispatcher;
1613 return;
1614 }
1615
1616 // Make sure the requester is coming from an extension/app page.
1617 // Internal dispatches set |web_contents| to NULL.
1618 #if !defined(OS_CHROMEOS)
1619 if (web_contents &&
1620 !CommandLine::ForCurrentProcess()->HasSwitch(
1621 switches::kWebIntentsInvocationEnabled)) {
1622 ExtensionService* extensions_service =
1623 extensions::ExtensionSystem::Get(profile_)->extension_service();
1624 if (!extensions_service ||
1625 extensions_service->extensions()->GetExtensionOrAppByURL(
1626 ExtensionURLInfo(web_contents->GetURL())) == NULL) {
1627 web_intents::RecordIntentsDispatchDisabled();
1628 intents_dispatcher->SendReply(webkit_glue::WebIntentReply(
1629 webkit_glue::WEB_INTENT_REPLY_FAILURE,
1630 ASCIIToUTF16("Intents may only be invoked from extensions/apps.")));
1631 return;
1632 }
1633 }
1634 #else
1635 // ChromeOS currently uses a couple specific intent actions.
1636 // TODO(gbillock): delete this when we find good alternatives for those uses.
1637 if (intents_dispatcher->GetIntent().action !=
1638 ASCIIToUTF16(web_intents::kActionCrosEcho) &&
1639 intents_dispatcher->GetIntent().action !=
1640 ASCIIToUTF16(web_intents::kActionView)) {
1641 web_intents::RecordIntentsDispatchDisabled();
1642 intents_dispatcher->SendReply(webkit_glue::WebIntentReply(
1643 webkit_glue::WEB_INTENT_REPLY_FAILURE,
1644 ASCIIToUTF16("Intents may only be invoked from extensions/apps.")));
1645 return;
1646 }
1647 #endif
1648
1649 web_intents::RecordIntentDispatchRequested();
1650
1651 if (!web_contents) {
1652 // Intent is system-caused and the picker will show over the currently
1653 // active web contents.
1654 web_contents = tab_strip_model_->GetActiveWebContents();
1655 }
1656 WebIntentPickerController* web_intent_picker_controller =
1657 WebIntentPickerController::FromWebContents(web_contents);
1658 web_intent_picker_controller->SetIntentsDispatcher(intents_dispatcher);
1659 web_intent_picker_controller->ShowDialog(
1660 intents_dispatcher->GetIntent().action,
1661 intents_dispatcher->GetIntent().type);
1662 }
1663 #endif
1664
1665 void Browser::UpdatePreferredSize(WebContents* source, 1592 void Browser::UpdatePreferredSize(WebContents* source,
1666 const gfx::Size& pref_size) { 1593 const gfx::Size& pref_size) {
1667 window_->UpdatePreferredSize(source, pref_size); 1594 window_->UpdatePreferredSize(source, pref_size);
1668 } 1595 }
1669 1596
1670 void Browser::ResizeDueToAutoResize(WebContents* source, 1597 void Browser::ResizeDueToAutoResize(WebContents* source,
1671 const gfx::Size& new_size) { 1598 const gfx::Size& new_size) {
1672 window_->ResizeDueToAutoResize(source, new_size); 1599 window_->ResizeDueToAutoResize(source, new_size);
1673 } 1600 }
1674 1601
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
2344 if (contents && !allow_js_access) { 2271 if (contents && !allow_js_access) {
2345 contents->web_contents()->GetController().LoadURL( 2272 contents->web_contents()->GetController().LoadURL(
2346 target_url, 2273 target_url,
2347 content::Referrer(), 2274 content::Referrer(),
2348 content::PAGE_TRANSITION_LINK, 2275 content::PAGE_TRANSITION_LINK,
2349 std::string()); // No extra headers. 2276 std::string()); // No extra headers.
2350 } 2277 }
2351 2278
2352 return contents != NULL; 2279 return contents != NULL;
2353 } 2280 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser.h ('k') | chrome/browser/ui/browser_commands.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698