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

Unified Diff: chrome/browser/ui/toolbar/action_box_button_controller.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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/toolbar/action_box_button_controller.cc
diff --git a/chrome/browser/ui/toolbar/action_box_button_controller.cc b/chrome/browser/ui/toolbar/action_box_button_controller.cc
index 7d8c0fd54244b37e5e2754e862d22b26c4355f7d..5044d8f856925c53a4f5efe3073742efbf53e67f 100644
--- a/chrome/browser/ui/toolbar/action_box_button_controller.cc
+++ b/chrome/browser/ui/toolbar/action_box_button_controller.cc
@@ -9,8 +9,6 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_system.h"
-#include "chrome/browser/intents/web_intents_registry_factory.h"
-#include "chrome/browser/intents/web_intents_registry.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
@@ -23,21 +21,11 @@
#include "content/public/browser/notification_source.h"
#include "content/public/browser/user_metrics.h"
#include "content/public/browser/web_contents.h"
-#include "content/public/browser/web_intents_dispatcher.h"
#include "grit/generated_resources.h"
-#include "webkit/glue/web_intent_data.h"
#include "webkit/glue/webkit_glue.h"
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
// the menu. Extensions get a reserved block of commands after share handlers.
@@ -51,9 +39,6 @@ enum ActionBoxLocalCommandIds {
EXTENSION_COMMAND_FIRST
};
-const char kShareIntentAction[] = "http://webintents.org/share";
-const char kShareIntentMimeType[] = "text/uri-list";
-
} // namespace
using content::UserMetricsAction;
@@ -81,50 +66,6 @@ void ActionBoxButtonController::OnButtonClicked() {
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();
- const ExtensionSet* extension_set = extension_service->extensions();
- WebIntentsRegistry* intents_registry =
- WebIntentsRegistryFactory::GetForProfile(browser_->profile());
- for (ExtensionSet::const_iterator it = extension_set->begin();
- it != extension_set->end(); ++it) {
- const extensions::Extension* extension = *it;
- WebIntentsRegistry::IntentServiceList services;
- intents_registry->GetIntentServicesForExtensionFilter(
- ASCIIToUTF16(kShareIntentAction),
- ASCIIToUTF16(kShareIntentMimeType),
- extension->id(),
- &services);
- if (!services.empty()) {
- int command_id = next_share_intent_command_id++;
- if (command_id > SHARE_COMMAND_LAST)
- break;
- // TODO(skare): If an intent supports multiple services, be able to
- // disambiguate. Choosing the first matches the picker behavior; see
- // TODO in WebIntentPickerController::DispatchToInstalledExtension.
- share_intent_service_ids_[command_id] = services[0].service_url;
- menu_model->AddItem(command_id, services[0].title);
- }
- }
-
- // Add link to the Web Store to find additional share intents.
- menu_model->AddItemWithStringId(CWS_FIND_SHARE_INTENTS_COMMAND,
- IDS_FIND_SHARE_INTENTS);
-
- content::RecordAction(UserMetricsAction("ActionBox.ClickButton"));
- if (send_uma_share_command_count) {
- UMA_HISTOGRAM_ENUMERATION("ActionBox.ShareCommandCount",
- next_share_intent_command_id - SHARE_COMMAND_FIRST,
- kMaxShareItemsToShow + 1);
- send_uma_share_command_count = false;
- }
- }
-#endif
-
// Add Extensions.
next_extension_command_id_ = EXTENSION_COMMAND_FIRST;
extension_command_ids_.clear();
@@ -154,20 +95,6 @@ bool ActionBoxButtonController::GetAcceleratorForCommandId(
}
void ActionBoxButtonController::ExecuteCommand(int command_id) {
- // Handle explicit intent triggers for share intent commands.
- if (share_intent_service_ids_.count(command_id) > 0) {
- TriggerExplicitShareIntent(share_intent_service_ids_[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
// menu was open (sync perhaps?) but that will just fall through safely.
@@ -229,33 +156,3 @@ void ActionBoxButtonController::Observe(
// We may also want to listen to EXTENSION_LOADED to do the opposite.
extension_command_ids_.erase(extension->id());
}
-
-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(
- ASCIIToUTF16(kShareIntentAction),
- ASCIIToUTF16(kShareIntentMimeType),
- UTF8ToUTF16(current_url.spec()));
- 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);
- chrome::NavigateParams params(browser_->profile(), query_url,
- content::PAGE_TRANSITION_LINK);
- params.disposition = NEW_FOREGROUND_TAB;
- chrome::Navigate(&params);
-
- content::RecordAction(UserMetricsAction("ActionBox.FindShareHandlers"));
- send_uma_share_command_count = true;
-#endif
-}
« no previous file with comments | « chrome/browser/ui/toolbar/action_box_button_controller.h ('k') | chrome/browser/ui/views/external_tab_container_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698