| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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/media/media_stream_devices_controller.h" | 62 #include "chrome/browser/media/media_stream_devices_controller.h" |
| 66 #include "chrome/browser/net/url_fixer_upper.h" | 63 #include "chrome/browser/net/url_fixer_upper.h" |
| 67 #include "chrome/browser/notifications/notification_ui_manager.h" | 64 #include "chrome/browser/notifications/notification_ui_manager.h" |
| 68 #include "chrome/browser/pepper_broker_infobar_delegate.h" | 65 #include "chrome/browser/pepper_broker_infobar_delegate.h" |
| 69 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 66 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| 70 #include "chrome/browser/prefs/pref_service.h" | 67 #include "chrome/browser/prefs/pref_service.h" |
| 71 #include "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h" | 68 #include "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h" |
| 72 #include "chrome/browser/profiles/profile.h" | 69 #include "chrome/browser/profiles/profile.h" |
| 73 #include "chrome/browser/profiles/profile_destroyer.h" | 70 #include "chrome/browser/profiles/profile_destroyer.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 #include "chrome/browser/ui/chrome_pages.h" | 107 #include "chrome/browser/ui/chrome_pages.h" |
| 111 #include "chrome/browser/ui/chrome_select_file_policy.h" | 108 #include "chrome/browser/ui/chrome_select_file_policy.h" |
| 112 #include "chrome/browser/ui/extensions/shell_window.h" | 109 #include "chrome/browser/ui/extensions/shell_window.h" |
| 113 #include "chrome/browser/ui/find_bar/find_bar.h" | 110 #include "chrome/browser/ui/find_bar/find_bar.h" |
| 114 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 111 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
| 115 #include "chrome/browser/ui/find_bar/find_tab_helper.h" | 112 #include "chrome/browser/ui/find_bar/find_tab_helper.h" |
| 116 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" | 113 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" |
| 117 #include "chrome/browser/ui/global_error/global_error.h" | 114 #include "chrome/browser/ui/global_error/global_error.h" |
| 118 #include "chrome/browser/ui/global_error/global_error_service.h" | 115 #include "chrome/browser/ui/global_error/global_error_service.h" |
| 119 #include "chrome/browser/ui/global_error/global_error_service_factory.h" | 116 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
| 120 #include "chrome/browser/ui/intents/web_intent_picker_controller.h" | |
| 121 #include "chrome/browser/ui/media_stream_infobar_delegate.h" | 117 #include "chrome/browser/ui/media_stream_infobar_delegate.h" |
| 122 #include "chrome/browser/ui/omnibox/location_bar.h" | 118 #include "chrome/browser/ui/omnibox/location_bar.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" |
| 130 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" | 126 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1579 | 1572 |
| 1580 void Browser::RegisterProtocolHandler(WebContents* web_contents, | 1573 void Browser::RegisterProtocolHandler(WebContents* web_contents, |
| 1581 const std::string& protocol, | 1574 const std::string& protocol, |
| 1582 const GURL& url, | 1575 const GURL& url, |
| 1583 const string16& title, | 1576 const string16& title, |
| 1584 bool user_gesture) { | 1577 bool user_gesture) { |
| 1585 RegisterProtocolHandlerHelper( | 1578 RegisterProtocolHandlerHelper( |
| 1586 web_contents, protocol, url, title, user_gesture, window()); | 1579 web_contents, protocol, url, title, user_gesture, window()); |
| 1587 } | 1580 } |
| 1588 | 1581 |
| 1589 #if defined(ENABLE_WEB_INTENTS) | |
| 1590 void Browser::RegisterIntentHandler( | |
| 1591 WebContents* web_contents, | |
| 1592 const webkit_glue::WebIntentServiceData& data, | |
| 1593 bool user_gesture) { | |
| 1594 RegisterIntentHandlerInfoBarDelegate::Create(web_contents, data); | |
| 1595 } | |
| 1596 | |
| 1597 void Browser::WebIntentDispatch( | |
| 1598 WebContents* web_contents, | |
| 1599 content::WebIntentsDispatcher* intents_dispatcher) { | |
| 1600 if (!web_intents::IsWebIntentsEnabledForProfile(profile_)) { | |
| 1601 web_intents::RecordIntentsDispatchDisabled(); | |
| 1602 delete intents_dispatcher; | |
| 1603 return; | |
| 1604 } | |
| 1605 | |
| 1606 // Make sure the requester is coming from an extension/app page. | |
| 1607 // Internal dispatches set |web_contents| to NULL. | |
| 1608 #if !defined(OS_CHROMEOS) | |
| 1609 if (web_contents && | |
| 1610 !CommandLine::ForCurrentProcess()->HasSwitch( | |
| 1611 switches::kWebIntentsInvocationEnabled)) { | |
| 1612 ExtensionService* extensions_service = | |
| 1613 extensions::ExtensionSystem::Get(profile_)->extension_service(); | |
| 1614 if (!extensions_service || | |
| 1615 extensions_service->extensions()->GetExtensionOrAppByURL( | |
| 1616 ExtensionURLInfo(web_contents->GetURL())) == NULL) { | |
| 1617 web_intents::RecordIntentsDispatchDisabled(); | |
| 1618 intents_dispatcher->SendReply(webkit_glue::WebIntentReply( | |
| 1619 webkit_glue::WEB_INTENT_REPLY_FAILURE, | |
| 1620 ASCIIToUTF16("Intents may only be invoked from extensions/apps."))); | |
| 1621 return; | |
| 1622 } | |
| 1623 } | |
| 1624 #else | |
| 1625 // ChromeOS currently uses a couple specific intent actions. | |
| 1626 // TODO(gbillock): delete this when we find good alternatives for those uses. | |
| 1627 if (intents_dispatcher->GetIntent().action != | |
| 1628 ASCIIToUTF16(web_intents::kActionCrosEcho) && | |
| 1629 intents_dispatcher->GetIntent().action != | |
| 1630 ASCIIToUTF16(web_intents::kActionView)) { | |
| 1631 web_intents::RecordIntentsDispatchDisabled(); | |
| 1632 intents_dispatcher->SendReply(webkit_glue::WebIntentReply( | |
| 1633 webkit_glue::WEB_INTENT_REPLY_FAILURE, | |
| 1634 ASCIIToUTF16("Intents may only be invoked from extensions/apps."))); | |
| 1635 return; | |
| 1636 } | |
| 1637 #endif | |
| 1638 | |
| 1639 web_intents::RecordIntentDispatchRequested(); | |
| 1640 | |
| 1641 if (!web_contents) { | |
| 1642 // Intent is system-caused and the picker will show over the currently | |
| 1643 // active web contents. | |
| 1644 web_contents = tab_strip_model_->GetActiveWebContents(); | |
| 1645 } | |
| 1646 WebIntentPickerController* web_intent_picker_controller = | |
| 1647 WebIntentPickerController::FromWebContents(web_contents); | |
| 1648 web_intent_picker_controller->SetIntentsDispatcher(intents_dispatcher); | |
| 1649 web_intent_picker_controller->ShowDialog( | |
| 1650 intents_dispatcher->GetIntent().action, | |
| 1651 intents_dispatcher->GetIntent().type); | |
| 1652 } | |
| 1653 #endif | |
| 1654 | |
| 1655 void Browser::UpdatePreferredSize(WebContents* source, | 1582 void Browser::UpdatePreferredSize(WebContents* source, |
| 1656 const gfx::Size& pref_size) { | 1583 const gfx::Size& pref_size) { |
| 1657 window_->UpdatePreferredSize(source, pref_size); | 1584 window_->UpdatePreferredSize(source, pref_size); |
| 1658 } | 1585 } |
| 1659 | 1586 |
| 1660 void Browser::ResizeDueToAutoResize(WebContents* source, | 1587 void Browser::ResizeDueToAutoResize(WebContents* source, |
| 1661 const gfx::Size& new_size) { | 1588 const gfx::Size& new_size) { |
| 1662 window_->ResizeDueToAutoResize(source, new_size); | 1589 window_->ResizeDueToAutoResize(source, new_size); |
| 1663 } | 1590 } |
| 1664 | 1591 |
| (...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2336 if (contents && !allow_js_access) { | 2263 if (contents && !allow_js_access) { |
| 2337 contents->web_contents()->GetController().LoadURL( | 2264 contents->web_contents()->GetController().LoadURL( |
| 2338 target_url, | 2265 target_url, |
| 2339 content::Referrer(), | 2266 content::Referrer(), |
| 2340 content::PAGE_TRANSITION_LINK, | 2267 content::PAGE_TRANSITION_LINK, |
| 2341 std::string()); // No extra headers. | 2268 std::string()); // No extra headers. |
| 2342 } | 2269 } |
| 2343 | 2270 |
| 2344 return contents != NULL; | 2271 return contents != NULL; |
| 2345 } | 2272 } |
| OLD | NEW |