diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-01 21:04:50 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-01 21:04:50 +0000 |
commit | 3a3e1712d881db14618a8ee023c744cc196e7a83 (patch) | |
tree | 03bd2515c26cd26ddfbccbdf1f61c0a9c2e21537 | |
parent | 235702b425a34556a4bb06c135ac7867ba4204eb (diff) | |
download | chromium_src-3a3e1712d881db14618a8ee023c744cc196e7a83.zip chromium_src-3a3e1712d881db14618a8ee023c744cc196e7a83.tar.gz chromium_src-3a3e1712d881db14618a8ee023c744cc196e7a83.tar.bz2 |
Make most code on mac compile with enable_web_intents=0
Once everything builds with that set, I'll switch the default
of that to off, then merge that into webkit and delete the
webkit pieces, and then I'll delete the chromium bits.
Since enable_web_intents is still 1, this change has no observable effect.
BUG=173194
TEST=build with GYP_DEFINES=enable_web_intents=0. No compile errors,
fewer linker errors.
TBR=jschuh
Review URL: https://codereview.chromium.org/12089102
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@180186 0039d316-1c4b-4281-b951-d872f2087c98
34 files changed, 178 insertions, 2 deletions
diff --git a/chrome/browser/download/chrome_download_manager_delegate.cc b/chrome/browser/download/chrome_download_manager_delegate.cc index 44aceb8..6e0b31a 100644 --- a/chrome/browser/download/chrome_download_manager_delegate.cc +++ b/chrome/browser/download/chrome_download_manager_delegate.cc @@ -375,15 +375,18 @@ bool ChromeDownloadManagerDelegate::ShouldOpenDownload( return false; } +#if defined(ENABLE_WEB_INTENTS) if (ShouldOpenWithWebIntents(item)) { OpenWithWebIntent(item); callback.Run(true); return false; } +#endif return true; } +#if defined(ENABLE_WEB_INTENTS) bool ChromeDownloadManagerDelegate::ShouldOpenWithWebIntents( const DownloadItem* item) { if (!web_intents::IsWebIntentsEnabledForProfile(profile_)) @@ -471,6 +474,7 @@ void ChromeDownloadManagerDelegate::OpenWithWebIntent( DCHECK(delegate); delegate->WebIntentDispatch(NULL, dispatcher); } +#endif bool ChromeDownloadManagerDelegate::GenerateFileHash() { #if defined(FULL_SAFE_BROWSING) @@ -753,6 +757,7 @@ void ChromeDownloadManagerDelegate::CheckVisitedReferrerBeforeDone( suggested_path = download->GetForcedFilePath(); } +#if defined(ENABLE_WEB_INTENTS) // If we will open the file with a web intents dispatch, // give it a name that will not allow the OS to open it using usual // associated apps. @@ -760,6 +765,7 @@ void ChromeDownloadManagerDelegate::CheckVisitedReferrerBeforeDone( download->SetDisplayName(suggested_path.BaseName()); suggested_path = suggested_path.AddExtension(kWebIntentsFileExtension); } +#endif // If the download hasn't already been marked dangerous (could be // DANGEROUS_URL), check if it is a dangerous file. diff --git a/chrome/browser/download/chrome_download_manager_delegate.h b/chrome/browser/download/chrome_download_manager_delegate.h index 60d0654..93a6e28 100644 --- a/chrome/browser/download/chrome_download_manager_delegate.h +++ b/chrome/browser/download/chrome_download_manager_delegate.h @@ -207,12 +207,14 @@ class ChromeDownloadManagerDelegate content::DownloadDangerType danger_type, const FilePath& target_path); +#if defined(ENABLE_WEB_INTENTS) // Check policy of whether we should open this download with a web intents // dispatch. bool ShouldOpenWithWebIntents(const content::DownloadItem* item); // Open the given item with a web intent dispatch. void OpenWithWebIntent(const content::DownloadItem* item); +#endif // Internal gateways for ShouldCompleteDownload(). bool IsDownloadReadyForCompletion( diff --git a/chrome/browser/extensions/api/app_runtime/app_runtime_api.cc b/chrome/browser/extensions/api/app_runtime/app_runtime_api.cc index 4f22f3d..b3071a0 100644 --- a/chrome/browser/extensions/api/app_runtime/app_runtime_api.cc +++ b/chrome/browser/extensions/api/app_runtime/app_runtime_api.cc @@ -94,6 +94,7 @@ void AppEventRouter::DispatchOnLaunchedEventWithWebIntent( Profile* profile, const Extension* extension, content::WebIntentsDispatcher* intents_dispatcher, content::WebContents* source) { +#if defined(ENABLE_WEB_INTENTS) webkit_glue::WebIntentData web_intent_data = intents_dispatcher->GetIntent(); scoped_ptr<ListValue> args(new ListValue()); DictionaryValue* launch_data = new DictionaryValue(); @@ -143,9 +144,11 @@ void AppEventRouter::DispatchOnLaunchedEventWithWebIntent( callbacks->RegisterCallback(extension, intents_dispatcher, source); args->Append(base::Value::CreateIntegerValue(intent_id)); DispatchOnLaunchedEventImpl(extension->id(), args.Pass(), profile); +#endif } bool AppRuntimePostIntentResponseFunction::RunImpl() { +#if defined(ENABLE_WEB_INTENTS) DictionaryValue* details = NULL; EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(0, &details)); @@ -174,6 +177,9 @@ bool AppRuntimePostIntentResponseFunction::RunImpl() { reply_type, UTF8ToUTF16(data))); return true; +#else + return false; +#endif } } // namespace extensions diff --git a/chrome/browser/extensions/extension_special_storage_policy.cc b/chrome/browser/extensions/extension_special_storage_policy.cc index bc99895..e035ff1 100644 --- a/chrome/browser/extensions/extension_special_storage_policy.cc +++ b/chrome/browser/extensions/extension_special_storage_policy.cc @@ -28,6 +28,7 @@ namespace { bool ExtensionSupportsIntentAction( const extensions::Extension* extension, const std::string& action) { +#if defined(ENABLE_WEB_INTENTS) for (std::vector<webkit_glue::WebIntentServiceData>::const_iterator i = extensions::WebIntentsInfo::GetIntentsServices(extension).begin(); i != extensions::WebIntentsInfo::GetIntentsServices(extension).end(); @@ -35,6 +36,7 @@ bool ExtensionSupportsIntentAction( if (UTF16ToUTF8(i->action) == action) return true; } +#endif return false; } diff --git a/chrome/browser/extensions/extension_special_storage_policy_unittest.cc b/chrome/browser/extensions/extension_special_storage_policy_unittest.cc index 4dd098a..b6e7de8 100644 --- a/chrome/browser/extensions/extension_special_storage_policy_unittest.cc +++ b/chrome/browser/extensions/extension_special_storage_policy_unittest.cc @@ -27,8 +27,10 @@ class ExtensionSpecialStoragePolicyTest : public testing::Test { public: virtual void SetUp() { policy_ = new ExtensionSpecialStoragePolicy(NULL); +#if defined(ENABLE_WEB_INTENTS) extensions::ManifestHandler::Register(keys::kIntents, new extensions::WebIntentsHandler); +#endif } protected: @@ -131,6 +133,7 @@ class ExtensionSpecialStoragePolicyTest : public testing::Test { return handler_app; } +#if defined(ENABLE_WEB_INTENTS) scoped_refptr<Extension> CreateWebIntentViewApp() { #if defined(OS_WIN) FilePath path(FILE_PATH_LITERAL("c:\\bar")); @@ -164,6 +167,7 @@ class ExtensionSpecialStoragePolicyTest : public testing::Test { EXPECT_TRUE(intent_app.get()) << error; return intent_app; } +#endif // Verifies that the set of extensions protecting |url| is *exactly* equal to // |expected_extensions|. Pass in an empty set to verify that an origin is not @@ -287,6 +291,7 @@ TEST_F(ExtensionSpecialStoragePolicyTest, OverlappingApps) { } TEST_F(ExtensionSpecialStoragePolicyTest, WebIntentViewApp) { +#if defined(ENABLE_WEB_INTENTS) scoped_refptr<Extension> intent_app(CreateWebIntentViewApp()); policy_->GrantRightsForExtension(intent_app); @@ -294,6 +299,7 @@ TEST_F(ExtensionSpecialStoragePolicyTest, WebIntentViewApp) { policy_->RevokeRightsForExtension(intent_app); EXPECT_FALSE(policy_->IsFileHandler(intent_app->id())); +#endif } TEST_F(ExtensionSpecialStoragePolicyTest, HasSessionOnlyOrigins) { diff --git a/chrome/browser/extensions/platform_app_launcher.cc b/chrome/browser/extensions/platform_app_launcher.cc index de6fdee..513e54b 100644 --- a/chrome/browser/extensions/platform_app_launcher.cc +++ b/chrome/browser/extensions/platform_app_launcher.cc @@ -174,6 +174,7 @@ class PlatformAppPathLauncher // TODO(benwells): remove this once we no longer support the "intents" // syntax in platform app manifests. if (!found_service) { +#if defined(ENABLE_WEB_INTENTS) std::vector<webkit_glue::WebIntentServiceData> services = extensions::WebIntentsInfo::GetIntentsServices(extension_); for (size_t i = 0; i < services.size(); i++) { @@ -184,6 +185,7 @@ class PlatformAppPathLauncher break; } } +#endif } // If this app doesn't have an intent that supports the file, launch with diff --git a/chrome/browser/profiles/profile_dependency_manager.cc b/chrome/browser/profiles/profile_dependency_manager.cc index 6059988..e20e2fd 100644 --- a/chrome/browser/profiles/profile_dependency_manager.cc +++ b/chrome/browser/profiles/profile_dependency_manager.cc @@ -296,7 +296,9 @@ void ProfileDependencyManager::AssertFactoriesBuilt() { extensions::TabsWindowsAPI::GetFactoryInstance(); extensions::TtsAPI::GetFactoryInstance(); extensions::WebAccessibleResourcesParser::GetFactoryInstance(); +#if defined(ENABLE_WEB_INTENTS) extensions::WebIntentsParser::GetFactoryInstance(); +#endif extensions::WebNavigationAPI::GetFactoryInstance(); #endif FaviconServiceFactory::GetInstance(); diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index a715b1a..065b302 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -1590,6 +1590,7 @@ void Browser::RegisterProtocolHandler(WebContents* web_contents, web_contents, protocol, url, title, user_gesture, window()); } +#if defined(ENABLE_WEB_INTENTS) void Browser::RegisterIntentHandler( WebContents* web_contents, const webkit_glue::WebIntentServiceData& data, @@ -1653,6 +1654,7 @@ void Browser::WebIntentDispatch( intents_dispatcher->GetIntent().action, intents_dispatcher->GetIntent().type); } +#endif void Browser::UpdatePreferredSize(WebContents* source, const gfx::Size& pref_size) { diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h index 9f86dd5..c4c1e72 100644 --- a/chrome/browser/ui/browser.h +++ b/chrome/browser/ui/browser.h @@ -611,6 +611,7 @@ class Browser : public TabStripModelObserver, const GURL& url, const string16& title, bool user_gesture) OVERRIDE; +#if defined(ENABLE_WEB_INTENTS) virtual void RegisterIntentHandler( content::WebContents* web_contents, const webkit_glue::WebIntentServiceData& data, @@ -618,6 +619,7 @@ class Browser : public TabStripModelObserver, virtual void WebIntentDispatch( content::WebContents* web_contents, content::WebIntentsDispatcher* intents_dispatcher) OVERRIDE; +#endif virtual void UpdatePreferredSize(content::WebContents* source, const gfx::Size& pref_size) OVERRIDE; virtual void ResizeDueToAutoResize(content::WebContents* source, diff --git a/chrome/browser/ui/browser_tab_contents.cc b/chrome/browser/ui/browser_tab_contents.cc index 4b35cc0..23a9a66 100644 --- a/chrome/browser/ui/browser_tab_contents.cc +++ b/chrome/browser/ui/browser_tab_contents.cc @@ -153,7 +153,9 @@ void BrowserTabContents::AttachTabHelpers(WebContents* web_contents) { ThreeDAPIObserver::CreateForWebContents(web_contents); ThumbnailTabHelper::CreateForWebContents(web_contents); TranslateTabHelper::CreateForWebContents(web_contents); +#if defined(ENABLE_WEB_INTENTS) WebIntentPickerController::CreateForWebContents(web_contents); +#endif ZoomController::CreateForWebContents(web_contents); #if defined(ENABLE_AUTOMATION) diff --git a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h index 7ef1a954..e445aad 100644 --- a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h +++ b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h @@ -70,7 +70,9 @@ class LocationBarViewMac : public LocationBar, virtual void UpdateContentSettingsIcons() OVERRIDE; virtual void UpdatePageActions() OVERRIDE; virtual void InvalidatePageActions() OVERRIDE; +#if defined(ENABLE_WEB_INTENTS) virtual void UpdateWebIntentsButton() OVERRIDE; +#endif virtual void UpdateOpenPDFInReaderPrompt() OVERRIDE; virtual void SaveStateToContents(content::WebContents* contents) OVERRIDE; virtual void Revert() OVERRIDE; @@ -278,9 +280,11 @@ class LocationBarViewMac : public LocationBar, // Keyword hint decoration displayed on the right-hand side. scoped_ptr<KeywordHintDecoration> keyword_hint_decoration_; +#if defined(ENABLE_WEB_INTENTS) // A decoration that shows the web intents "use another service" button // on the right. scoped_ptr<WebIntentsButtonDecoration> web_intents_button_decoration_; +#endif Profile* profile_; diff --git a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm index ee9bbe0..61d5895 100644 --- a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm +++ b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm @@ -108,8 +108,10 @@ LocationBarViewMac::LocationBarViewMac( zoom_decoration_(new ZoomDecoration(toolbar_model)), keyword_hint_decoration_( new KeywordHintDecoration(OmniboxViewMac::GetFieldFont())), +#if defined(ENABLE_WEB_INTENTS) web_intents_button_decoration_( new WebIntentsButtonDecoration(this, OmniboxViewMac::GetFieldFont())), +#endif profile_(profile), browser_(browser), toolbar_model_(toolbar_model), @@ -128,11 +130,13 @@ LocationBarViewMac::LocationBarViewMac( new ContentSettingDecoration(type, this, profile_)); } +#if defined(ENABLE_WEB_INTENTS) ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); web_intents_button_decoration_->SetButtonImages( rb.GetNativeImageNamed(IDR_OMNIBOX_WI_BUBBLE_BACKGROUND_L).ToNSImage(), rb.GetNativeImageNamed(IDR_OMNIBOX_WI_BUBBLE_BACKGROUND_C).ToNSImage(), rb.GetNativeImageNamed(IDR_OMNIBOX_WI_BUBBLE_BACKGROUND_R).ToNSImage()); +#endif registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED, @@ -242,9 +246,11 @@ void LocationBarViewMac::InvalidatePageActions() { } } +#if defined(ENABLE_WEB_INTENTS) void LocationBarViewMac::UpdateWebIntentsButton() { RefreshWebIntentsButtonDecoration(); } +#endif void LocationBarViewMac::UpdateOpenPDFInReaderPrompt() { // Not implemented on Mac. @@ -667,6 +673,7 @@ void LocationBarViewMac::RefreshPageActionDecorations() { } void LocationBarViewMac::RefreshWebIntentsButtonDecoration() { +#if defined(ENABLE_WEB_INTENTS) WebContents* web_contents = GetWebContents(); if (!web_contents) { web_intents_button_decoration_->SetVisible(false); @@ -674,6 +681,7 @@ void LocationBarViewMac::RefreshWebIntentsButtonDecoration() { } web_intents_button_decoration_->Update(web_contents); +#endif } // TODO(shess): This function should over time grow to closely match @@ -705,7 +713,10 @@ void LocationBarViewMac::Layout() { [cell addRightDecoration:keyword_hint_decoration_.get()]; +#if defined(ENABLE_WEB_INTENTS) [cell addRightDecoration:web_intents_button_decoration_.get()]; +#endif + [cell addRightDecoration:separator_decoration_.get()]; [cell addRightDecoration:search_token_decoration_.get()]; diff --git a/chrome/browser/ui/extensions/shell_window.cc b/chrome/browser/ui/extensions/shell_window.cc index bdb9fcf..8be9cce 100644 --- a/chrome/browser/ui/extensions/shell_window.cc +++ b/chrome/browser/ui/extensions/shell_window.cc @@ -130,7 +130,9 @@ void ShellWindow::Init(const GURL& url, profile(), SiteInstance::CreateForURL(profile(), url)))); WebContentsModalDialogManager::CreateForWebContents(web_contents_.get()); FaviconTabHelper::CreateForWebContents(web_contents_.get()); +#if defined(ENABLE_WEB_INTENTS) WebIntentPickerController::CreateForWebContents(web_contents_.get()); +#endif content::WebContentsObserver::Observe(web_contents_.get()); web_contents_->SetDelegate(this); @@ -500,6 +502,7 @@ bool ShellWindow::ShouldSuppressDialogs() { void ShellWindow::WebIntentDispatch( content::WebContents* web_contents, content::WebIntentsDispatcher* intents_dispatcher) { +#if defined(ENABLE_WEB_INTENTS) if (!web_intents::IsWebIntentsEnabledForProfile(profile_)) return; @@ -509,6 +512,7 @@ void ShellWindow::WebIntentDispatch( web_intent_picker_controller->ShowDialog( intents_dispatcher->GetIntent().action, intents_dispatcher->GetIntent().type); +#endif } void ShellWindow::RunFileChooser(WebContents* tab, diff --git a/chrome/browser/ui/gtk/location_bar_view_gtk.cc b/chrome/browser/ui/gtk/location_bar_view_gtk.cc index 18b9615..598ead6 100644 --- a/chrome/browser/ui/gtk/location_bar_view_gtk.cc +++ b/chrome/browser/ui/gtk/location_bar_view_gtk.cc @@ -740,7 +740,9 @@ void LocationBarViewGtk::Update(const WebContents* contents) { UpdateSiteTypeArea(); UpdateContentSettingsIcons(); UpdatePageActions(); +#if defined(ENABLE_WEB_INTENTS) UpdateWebIntentsButton(); +#endif location_entry_->Update(contents); // The security level (background color) could have changed, etc. if (theme_service_->UsingNativeTheme()) { @@ -1032,11 +1034,13 @@ void LocationBarViewGtk::InvalidatePageActions() { } } +#if defined(ENABLE_WEB_INTENTS) void LocationBarViewGtk::UpdateWebIntentsButton() { web_intents_button_view_->Update(GetWebContents()); gtk_widget_set_visible(web_intents_hbox_.get(), web_intents_button_view_->IsVisible()); } +#endif void LocationBarViewGtk::UpdateOpenPDFInReaderPrompt() { // Not implemented on Gtk. @@ -1179,7 +1183,9 @@ void LocationBarViewGtk::Observe(int type, UpdateStarIcon(); UpdateSiteTypeArea(); UpdateContentSettingsIcons(); +#if defined(ENABLE_WEB_INTENTS) UpdateWebIntentsButton(); +#endif break; } diff --git a/chrome/browser/ui/gtk/location_bar_view_gtk.h b/chrome/browser/ui/gtk/location_bar_view_gtk.h index a8d8f3f..3a8dde4 100644 --- a/chrome/browser/ui/gtk/location_bar_view_gtk.h +++ b/chrome/browser/ui/gtk/location_bar_view_gtk.h @@ -140,7 +140,9 @@ class LocationBarViewGtk : public OmniboxEditController, virtual void UpdateContentSettingsIcons() OVERRIDE; virtual void UpdatePageActions() OVERRIDE; virtual void InvalidatePageActions() OVERRIDE; +#if defined(ENABLE_WEB_INTENTS) virtual void UpdateWebIntentsButton() OVERRIDE; +#endif virtual void UpdateOpenPDFInReaderPrompt() OVERRIDE; virtual void SaveStateToContents(content::WebContents* contents) OVERRIDE; virtual void Revert() OVERRIDE; diff --git a/chrome/browser/ui/omnibox/location_bar.h b/chrome/browser/ui/omnibox/location_bar.h index 61567c1..8a0849e 100644 --- a/chrome/browser/ui/omnibox/location_bar.h +++ b/chrome/browser/ui/omnibox/location_bar.h @@ -66,8 +66,10 @@ class LocationBar { // extension is unloaded or crashes. virtual void InvalidatePageActions() = 0; +#if defined(ENABLE_WEB_INTENTS) // Updates the state of the web intents use-another-service button. virtual void UpdateWebIntentsButton() = 0; +#endif // Updates the state of the button to open a PDF in Adobe Reader. virtual void UpdateOpenPDFInReaderPrompt() = 0; diff --git a/chrome/browser/ui/toolbar/action_box_button_controller.cc b/chrome/browser/ui/toolbar/action_box_button_controller.cc index 51c8c8f..7d8c0fd 100644 --- a/chrome/browser/ui/toolbar/action_box_button_controller.cc +++ b/chrome/browser/ui/toolbar/action_box_button_controller.cc @@ -30,11 +30,13 @@ namespace { +#if defined(ENABLE_WEB_INTENTS) // This indicates we need to send UMA data about the number of // "Share with X" commands shown in the menu after user tried to // find share extensions from web store or the first use of action // box after browser starts. static bool send_uma_share_command_count = true; +#endif // Share intents get command IDs that are beyond the maximal valid command ID // (0xDFFF) so that they are not confused with actual commands that appear in @@ -75,11 +77,13 @@ void ActionBoxButtonController::OnButtonClicked() { scoped_ptr<ActionBoxMenuModel> menu_model( new ActionBoxMenuModel(browser_, this)); - // Add share intent triggers and a link to the web store. - // Web Intents are not currently supported in Incognito mode. ExtensionService* extension_service = extensions::ExtensionSystem::Get(browser_->profile())-> extension_service(); + +#if defined(ENABLE_WEB_INTENTS) + // Add share intent triggers and a link to the web store. + // Web Intents are not currently supported in Incognito mode. if (!browser_->profile()->IsOffTheRecord()) { int next_share_intent_command_id = SHARE_COMMAND_FIRST; share_intent_service_ids_.clear(); @@ -119,6 +123,7 @@ void ActionBoxButtonController::OnButtonClicked() { send_uma_share_command_count = false; } } +#endif // Add Extensions. next_extension_command_id_ = EXTENSION_COMMAND_FIRST; @@ -155,11 +160,13 @@ void ActionBoxButtonController::ExecuteCommand(int command_id) { return; } +#if defined(ENABLE_WEB_INTENTS) // Handle link to the CWS web store. if (command_id == CWS_FIND_SHARE_INTENTS_COMMAND) { NavigateToWebStoreShareIntentsList(); return; } +#endif // Handle commands associated with extensions. // Note that the extension might have been uninstalled or disabled while the @@ -225,6 +232,7 @@ void ActionBoxButtonController::Observe( void ActionBoxButtonController::TriggerExplicitShareIntent( const GURL& share_service_url) { +#if defined(ENABLE_WEB_INTENTS) const GURL& current_url = browser_->tab_strip_model()->GetActiveWebContents()->GetURL(); webkit_glue::WebIntentData intent_data( @@ -234,9 +242,11 @@ void ActionBoxButtonController::TriggerExplicitShareIntent( intent_data.service = share_service_url; static_cast<content::WebContentsDelegate*>(browser_)->WebIntentDispatch( NULL, content::WebIntentsDispatcher::Create(intent_data)); +#endif } void ActionBoxButtonController::NavigateToWebStoreShareIntentsList() { +#if defined(ENABLE_WEB_INTENTS) const GURL& query_url = extension_urls::GetWebstoreIntentQueryURL( kShareIntentAction, kShareIntentMimeType); @@ -247,4 +257,5 @@ void ActionBoxButtonController::NavigateToWebStoreShareIntentsList() { content::RecordAction(UserMetricsAction("ActionBox.FindShareHandlers")); send_uma_share_command_count = true; +#endif } diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc index 118279d..76f0852 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.cc +++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc @@ -186,7 +186,9 @@ LocationBarView::LocationBarView(Browser* browser, open_pdf_in_reader_view_(NULL), script_bubble_icon_view_(NULL), star_view_(NULL), +#if defined(ENABLE_WEB_INTENTS) web_intents_button_view_(NULL), +#endif action_box_button_view_(NULL), mode_(mode), show_focus_rect_(false), @@ -286,10 +288,12 @@ void LocationBarView::Init() { zoom_view_->set_id(VIEW_ID_ZOOM_BUTTON); AddChildView(zoom_view_); +#if defined(ENABLE_WEB_INTENTS) web_intents_button_view_ = new WebIntentsButtonView(this, kWIBubbleBackgroundImages, font_, GetColor(ToolbarModel::NONE, TEXT)); AddChildView(web_intents_button_view_); +#endif open_pdf_in_reader_view_ = new OpenPDFInReaderView(this); AddChildView(open_pdf_in_reader_view_); @@ -418,7 +422,9 @@ void LocationBarView::Update(const WebContents* tab_for_state_restoring) { RefreshZoomView(); RefreshPageActionViews(); RefreshScriptBubble(); +#if defined(ENABLE_WEB_INTENTS) web_intents_button_view_->Update(GetWebContents()); +#endif open_pdf_in_reader_view_->Update( model_->GetInputInProgress() ? NULL : GetWebContents()); @@ -495,12 +501,14 @@ void LocationBarView::InvalidatePageActions() { } } +#if defined(ENABLE_WEB_INTENTS) void LocationBarView::UpdateWebIntentsButton() { web_intents_button_view_->Update(GetWebContents()); Layout(); SchedulePaint(); } +#endif void LocationBarView::UpdateOpenPDFInReaderPrompt() { open_pdf_in_reader_view_->Update( @@ -785,12 +793,14 @@ void LocationBarView::Layout() { (*i)->GetBuiltInHorizontalPadding(), (*i)); } } +#if defined(ENABLE_WEB_INTENTS) if (web_intents_button_view_->visible()) { right_decorations.AddDecoration( kBubbleLocationY, 0, false, 0, GetEdgeItemPadding(), GetItemPadding(), web_intents_button_view_->GetBuiltInHorizontalPadding(), web_intents_button_view_); } +#endif if (show_keyword_hint) { right_decorations.AddDecoration( kVerticalEdgeThickness, 0, true, 0, GetEdgeItemPadding(), diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.h b/chrome/browser/ui/views/location_bar/location_bar_view.h index 69bb021..75abbf9 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.h +++ b/chrome/browser/ui/views/location_bar/location_bar_view.h @@ -300,7 +300,9 @@ class LocationBarView : public LocationBar, virtual void UpdateContentSettingsIcons() OVERRIDE; virtual void UpdatePageActions() OVERRIDE; virtual void InvalidatePageActions() OVERRIDE; +#if defined(ENABLE_WEB_INTENTS) virtual void UpdateWebIntentsButton() OVERRIDE; +#endif virtual void UpdateOpenPDFInReaderPrompt() OVERRIDE; virtual void SaveStateToContents(content::WebContents* contents) OVERRIDE; virtual void Revert() OVERRIDE; @@ -483,8 +485,10 @@ class LocationBarView : public LocationBar, // The star. StarView* star_view_; +#if defined(ENABLE_WEB_INTENTS) // The web intents choose-another-service button WebIntentsButtonView* web_intents_button_view_; +#endif // The action box button (plus). ActionBoxButtonView* action_box_button_view_; diff --git a/chrome/chrome_browser_extensions.gypi b/chrome/chrome_browser_extensions.gypi index e0497de..1267624 100644 --- a/chrome/chrome_browser_extensions.gypi +++ b/chrome/chrome_browser_extensions.gypi @@ -807,6 +807,12 @@ '../third_party/libusb/libusb.gyp:libusb' ], }], + ['enable_web_intents==0', { + 'sources!': [ + 'browser/extensions/web_intents_parser.cc', + 'browser/extensions/web_intents_parser.h', + ], + }], ['OS=="linux" and use_aura==1', { 'dependencies': [ '../build/linux/system.gyp:dbus', diff --git a/chrome/chrome_browser_ui.gypi b/chrome/chrome_browser_ui.gypi index 1b5d936..aac88e0 100644 --- a/chrome/chrome_browser_ui.gypi +++ b/chrome/chrome_browser_ui.gypi @@ -2489,6 +2489,16 @@ 'sources/': [ ['exclude', '^browser/ui/intents/'], ], + 'sources!': [ + 'browser/ui/cocoa/intents/web_intent_picker_cocoa.mm', + 'browser/ui/cocoa/location_bar/web_intents_button_decoration.h', + 'browser/ui/cocoa/location_bar/web_intents_button_decoration.mm', + 'browser/ui/gtk/web_intent_picker_gtk.cc', + 'browser/ui/gtk/web_intent_picker_gtk.h', + 'browser/ui/views/location_bar/web_intents_button_view.cc', + 'browser/ui/views/location_bar/web_intents_button_view.h', + 'browser/ui/views/web_intent_picker_views.cc', + ], }], ['enable_themes==0', { 'sources!': [ diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi index eccc67e..f6d4af4 100644 --- a/chrome/chrome_common.gypi +++ b/chrome/chrome_common.gypi @@ -503,6 +503,12 @@ ['exclude', '^common/automation_'] ] }], + ['enable_web_intents==0', { + 'sources!': [ + 'common/extensions/web_intents_handler.cc', + 'common/extensions/web_intents_handler.h', + ], + }], ['use_system_nspr==1', { 'dependencies': [ '<(DEPTH)/base/third_party/nspr/nspr.gyp:nspr', diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index c04b4084..84061ac 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -1608,6 +1608,14 @@ 'browser/media/chrome_webrtc_browsertest.cc', ], }], + ['enable_web_intents==0', { + 'sources!': [ + 'browser/intents/native_services_browsertest.cc', + 'browser/ui/intents/web_intent_picker_controller_browsertest.cc', + 'browser/ui/intents/web_intent_picker_delegate_mock.cc', + 'browser/ui/intents/web_intent_picker_delegate_mock.h', + ], + }], ['OS=="win"', { 'sources': [ '<(SHARED_INTERMEDIATE_DIR)/chrome/browser_resources.rc', diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi index 6bf0c1f..9bcaad8 100644 --- a/chrome/chrome_tests_unit.gypi +++ b/chrome/chrome_tests_unit.gypi @@ -2203,8 +2203,12 @@ ['exclude', '^browser/ui/intents/'], ], 'sources!': [ + 'browser/ui/cocoa/location_bar/web_intents_button_decoration_unittest.mm', 'browser/webdata/web_data_service_unittest.cc', 'browser/webdata/web_intents_table_unittest.cc', + 'common/extensions/manifest_tests/extension_manifests_web_intents_unittest.cc', + '../webkit/glue/web_intent_reply_data_unittest.cc', + '../webkit/glue/web_intent_service_data_unittest.cc', ], }], ['enable_themes==0', { diff --git a/chrome/test/base/test_location_bar.h b/chrome/test/base/test_location_bar.h index 614215a..902bde0 100644 --- a/chrome/test/base/test_location_bar.h +++ b/chrome/test/base/test_location_bar.h @@ -39,7 +39,9 @@ class TestLocationBar : public LocationBar { virtual void UpdateContentSettingsIcons() OVERRIDE {} virtual void UpdatePageActions() OVERRIDE {} virtual void InvalidatePageActions() OVERRIDE {} +#if defined(ENABLE_WEB_INTENTS) virtual void UpdateWebIntentsButton() OVERRIDE {} +#endif virtual void UpdateOpenPDFInReaderPrompt() OVERRIDE {} virtual void SaveStateToContents(content::WebContents* contents) OVERRIDE {} virtual void Revert() OVERRIDE {} diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc index a94766d..5a1278d 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc @@ -715,10 +715,12 @@ bool WebContentsImpl::OnMessageReceived(RenderViewHost* render_view_host, bool handled = true; bool message_is_ok = true; IPC_BEGIN_MESSAGE_MAP_EX(WebContentsImpl, message, message_is_ok) +#if defined(ENABLE_WEB_INTENTS) IPC_MESSAGE_HANDLER(IntentsHostMsg_RegisterIntentService, OnRegisterIntentService) IPC_MESSAGE_HANDLER(IntentsHostMsg_WebIntentDispatch, OnWebIntentDispatch) +#endif IPC_MESSAGE_HANDLER(ViewHostMsg_DidLoadResourceFromMemoryCache, OnDidLoadResourceFromMemoryCache) IPC_MESSAGE_HANDLER(ViewHostMsg_DidDisplayInsecureContent, @@ -1991,6 +1993,7 @@ void WebContentsImpl::SetFocusToLocationBar(bool select_all) { delegate_->SetFocusToLocationBar(select_all); } +#if defined(ENABLE_WEB_INTENTS) void WebContentsImpl::OnRegisterIntentService( const webkit_glue::WebIntentServiceData& data, bool user_gesture) { @@ -2008,6 +2011,7 @@ void WebContentsImpl::OnWebIntentDispatch( new WebIntentsDispatcherImpl(this, intent, intent_id); delegate_->WebIntentDispatch(this, intents_dispatcher); } +#endif void WebContentsImpl::DidStartProvisionalLoadForFrame( RenderViewHost* render_view_host, diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h index d060755..847b11f 100644 --- a/content/browser/web_contents/web_contents_impl.h +++ b/content/browser/web_contents/web_contents_impl.h @@ -511,10 +511,12 @@ class CONTENT_EXPORT WebContentsImpl void OnPpapiBrokerPermissionResult(int request_id, bool result); // IPC message handlers. +#if defined(ENABLE_WEB_INTENTS) void OnRegisterIntentService(const webkit_glue::WebIntentServiceData& data, bool user_gesture); void OnWebIntentDispatch(const webkit_glue::WebIntentData& intent, int intent_id); +#endif void OnDidLoadResourceFromMemoryCache(const GURL& url, const std::string& security_info, const std::string& http_request, diff --git a/content/common/intents_messages.h b/content/common/intents_messages.h index 9b8ea34..3db6a92 100644 --- a/content/common/intents_messages.h +++ b/content/common/intents_messages.h @@ -20,6 +20,8 @@ IPC_ENUM_TRAITS(webkit_glue::WebIntentReplyType) IPC_ENUM_TRAITS(webkit_glue::WebIntentData::DataType) IPC_ENUM_TRAITS(webkit_glue::WebIntentServiceData::Disposition) +#if defined(ENABLE_WEB_INTENTS) + IPC_STRUCT_TRAITS_BEGIN(webkit_glue::WebIntentData) IPC_STRUCT_TRAITS_MEMBER(action) IPC_STRUCT_TRAITS_MEMBER(type) @@ -75,3 +77,5 @@ IPC_MESSAGE_ROUTED2(IntentsHostMsg_WebIntentDispatch, IPC_MESSAGE_ROUTED2(IntentsHostMsg_RegisterIntentService, webkit_glue::WebIntentServiceData, bool /* user_gesture */) + +#endif diff --git a/content/content_browser.gypi b/content/content_browser.gypi index 3c4a1a5..e59ec9a 100644 --- a/content/content_browser.gypi +++ b/content/content_browser.gypi @@ -1020,6 +1020,11 @@ 'browser/renderer_host/p2p/socket_dispatcher_host.h', ], }], + ['enable_web_intents==0', { + 'sources/': [ + ['exclude', '^browser/intents/' ], + ], + }], ['OS=="win"', { 'dependencies': [ # For accessibility diff --git a/content/content_renderer.gypi b/content/content_renderer.gypi index 46b29b1..945f83f 100644 --- a/content/content_renderer.gypi +++ b/content/content_renderer.gypi @@ -324,6 +324,12 @@ '../third_party/libphonenumber/libphonenumber.gyp:libphonenumber', ], }], + ['enable_web_intents==0', { + 'sources!': [ + 'renderer/web_intents_host.cc', + 'renderer/web_intents_host.h', + ], + }], # TODO(jrg): remove the OS=="android" section? # http://crbug.com/113172 # Understand better how media_stream_ is tied into Chromium. diff --git a/content/content_tests.gypi b/content/content_tests.gypi index af3a324..534df0a 100644 --- a/content/content_tests.gypi +++ b/content/content_tests.gypi @@ -562,6 +562,12 @@ '../third_party/webrtc/voice_engine/voice_engine.gyp:voice_engine_core', ] }], + ['enable_web_intents==0', { + 'sources!': [ + 'browser/intents/intent_injector_unittest.cc', + 'browser/intents/internal_web_intents_dispatcher_unittest.cc', + ], + }], # TODO(jrg): remove the OS=="android" section? # http://crbug.com/113172 # Understand better how media_stream_ is tied into Chromium. @@ -858,6 +864,11 @@ 'browser/media/webrtc_browsertest.cc', ], }], + ['enable_web_intents==0', { + 'sources!': [ + 'renderer/web_intents_host_browsertest.cc', + ], + }], ['enable_plugins==0', { 'sources!': [ 'browser/plugin_service_impl_browsertest.cc', diff --git a/content/renderer/render_view_browsertest.cc b/content/renderer/render_view_browsertest.cc index 21b76b9..b477ed7 100644 --- a/content/renderer/render_view_browsertest.cc +++ b/content/renderer/render_view_browsertest.cc @@ -1583,6 +1583,7 @@ TEST_F(RenderViewImplTest, SetHistoryLengthAndPrune) { EXPECT_EQ(expected_page_id_2, view()->history_page_ids_[3]); } +#if defined(ENABLE_WEB_INTENTS) TEST_F(RenderViewImplTest, FindTitleForIntentsPage) { view()->set_send_content_state_immediately(true); LoadHTML("<html><head><title>title</title>" @@ -1606,6 +1607,7 @@ TEST_F(RenderViewImplTest, FindTitleForIntentsPage) { EXPECT_EQ(ASCIIToUTF16("title"), service_data.title); EXPECT_FALSE(user_gesture); } +#endif TEST_F(RenderViewImplTest, ContextMenu) { LoadHTML("<div>Page A</div>"); diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index 0cb157b..06d15f7 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc @@ -739,7 +739,11 @@ RenderViewImpl::RenderViewImpl(RenderViewImplParams* params) // along with the RenderView automatically. devtools_agent_ = new DevToolsAgent(this); mouse_lock_dispatcher_ = new RenderViewMouseLockDispatcher(this); +#if defined(ENABLE_WEB_INTENTS) intents_host_ = new WebIntentsHost(this); +#else + intents_host_ = NULL; +#endif favicon_helper_ = new FaviconHelper(this); // Create renderer_accessibility_ if needed. @@ -3924,8 +3928,10 @@ void RenderViewImpl::didCreateScriptContext(WebFrame* frame, GetContentClient()->renderer()->DidCreateScriptContext( frame, context, extension_group, world_id); +#if defined(ENABLE_WEB_INTENTS) intents_host_->DidCreateScriptContext( frame, context, extension_group, world_id); +#endif } void RenderViewImpl::willReleaseScriptContext(WebFrame* frame, @@ -4297,6 +4303,7 @@ void RenderViewImpl::requestStorageQuota( void RenderViewImpl::registerIntentService( WebFrame* frame, const WebIntentServiceInfo& service) { +#if defined(ENABLE_WEB_INTENTS) webkit_glue::WebIntentServiceData data(service); if (data.title.empty()) data.title = webview()->mainFrame()->document().title(); @@ -4304,10 +4311,12 @@ void RenderViewImpl::registerIntentService( Send(new IntentsHostMsg_RegisterIntentService(routing_id_, data, user_gesture)); +#endif } void RenderViewImpl::dispatchIntent( WebFrame* frame, const WebIntentRequest& intentRequest) { +#if defined(ENABLE_WEB_INTENTS) webkit_glue::WebIntentData intent_data(intentRequest.intent()); // See WebMessagePortChannelImpl::postMessage() and ::OnMessagedQueued() @@ -4326,6 +4335,7 @@ void RenderViewImpl::dispatchIntent( int id = intents_host_->RegisterWebIntent(intentRequest); Send(new IntentsHostMsg_WebIntentDispatch( routing_id_, intent_data, id)); +#endif } bool RenderViewImpl::willCheckAndDispatchMessageEvent( diff --git a/webkit/glue/webkit_glue.gypi b/webkit/glue/webkit_glue.gypi index 5d2a717..e512310 100644 --- a/webkit/glue/webkit_glue.gypi +++ b/webkit/glue/webkit_glue.gypi @@ -430,6 +430,16 @@ ['exclude', '^\\.\\./plugins/npapi/webplugin_delegate_impl_aura'], ], }], + ['enable_web_intents==0', { + 'sources!': [ + 'web_intent_data.cc', + 'web_intent_data.h', + 'web_intent_reply_data.cc', + 'web_intent_reply_data.h', + 'web_intent_service_data.cc', + 'web_intent_service_data.h', + ], + }], ['OS!="mac"', { 'sources/': [['exclude', '_mac\\.(cc|mm)$']], 'sources!': [ |