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 1690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1701 // Internal dispatches set |web_contents| to NULL. | 1701 // Internal dispatches set |web_contents| to NULL. |
1702 #if !defined(OS_CHROMEOS) | 1702 #if !defined(OS_CHROMEOS) |
1703 if (web_contents && | 1703 if (web_contents && |
1704 !CommandLine::ForCurrentProcess()->HasSwitch( | 1704 !CommandLine::ForCurrentProcess()->HasSwitch( |
1705 switches::kWebIntentsInvocationEnabled)) { | 1705 switches::kWebIntentsInvocationEnabled)) { |
1706 ExtensionService* extensions_service = profile_->GetExtensionService(); | 1706 ExtensionService* extensions_service = profile_->GetExtensionService(); |
1707 if (!extensions_service || | 1707 if (!extensions_service || |
1708 extensions_service->extensions()->GetExtensionOrAppByURL( | 1708 extensions_service->extensions()->GetExtensionOrAppByURL( |
1709 ExtensionURLInfo(web_contents->GetURL())) == NULL) { | 1709 ExtensionURLInfo(web_contents->GetURL())) == NULL) { |
1710 web_intents::RecordIntentsDispatchDisabled(); | 1710 web_intents::RecordIntentsDispatchDisabled(); |
1711 intents_dispatcher->SendReplyMessage( | 1711 intents_dispatcher->SendReply(webkit_glue::WebIntentReply( |
1712 webkit_glue::WEB_INTENT_REPLY_FAILURE, | 1712 webkit_glue::WEB_INTENT_REPLY_FAILURE, |
1713 ASCIIToUTF16("Intents may only be invoked from extensions/apps.")); | 1713 ASCIIToUTF16("Intents may only be invoked from extensions/apps."))); |
1714 return; | 1714 return; |
1715 } | 1715 } |
1716 } | 1716 } |
1717 #else | 1717 #else |
1718 // ChromeOS currently uses a couple specific intent actions. | 1718 // ChromeOS currently uses a couple specific intent actions. |
1719 // TODO(gbillock): delete this when we find good alternatives for those uses. | 1719 // TODO(gbillock): delete this when we find good alternatives for those uses. |
1720 if (intents_dispatcher->GetIntent().action != | 1720 if (intents_dispatcher->GetIntent().action != |
1721 ASCIIToUTF16(web_intents::kActionCrosEcho) && | 1721 ASCIIToUTF16(web_intents::kActionCrosEcho) && |
1722 intents_dispatcher->GetIntent().action != | 1722 intents_dispatcher->GetIntent().action != |
1723 ASCIIToUTF16(web_intents::kActionView)) { | 1723 ASCIIToUTF16(web_intents::kActionView)) { |
1724 web_intents::RecordIntentsDispatchDisabled(); | 1724 web_intents::RecordIntentsDispatchDisabled(); |
1725 intents_dispatcher->SendReplyMessage( | 1725 intents_dispatcher->SendReply(webkit_glue::WebIntentReply( |
1726 webkit_glue::WEB_INTENT_REPLY_FAILURE, | 1726 webkit_glue::WEB_INTENT_REPLY_FAILURE, |
1727 ASCIIToUTF16("Intents may only be invoked from extensions/apps.")); | 1727 ASCIIToUTF16("Intents may only be invoked from extensions/apps."))); |
1728 return; | 1728 return; |
1729 } | 1729 } |
1730 #endif | 1730 #endif |
1731 | 1731 |
1732 web_intents::RecordIntentDispatchRequested(); | 1732 web_intents::RecordIntentDispatchRequested(); |
1733 | 1733 |
1734 if (!web_contents) { | 1734 if (!web_contents) { |
1735 // Intent is system-caused and the picker will show over the currently | 1735 // Intent is system-caused and the picker will show over the currently |
1736 // active web contents. | 1736 // active web contents. |
1737 web_contents = tab_strip_model_->GetActiveWebContents(); | 1737 web_contents = tab_strip_model_->GetActiveWebContents(); |
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2412 if (contents && !allow_js_access) { | 2412 if (contents && !allow_js_access) { |
2413 contents->web_contents()->GetController().LoadURL( | 2413 contents->web_contents()->GetController().LoadURL( |
2414 target_url, | 2414 target_url, |
2415 content::Referrer(), | 2415 content::Referrer(), |
2416 content::PAGE_TRANSITION_LINK, | 2416 content::PAGE_TRANSITION_LINK, |
2417 std::string()); // No extra headers. | 2417 std::string()); // No extra headers. |
2418 } | 2418 } |
2419 | 2419 |
2420 return contents != NULL; | 2420 return contents != NULL; |
2421 } | 2421 } |
OLD | NEW |