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

Unified Diff: chrome/browser/extensions/api/app_runtime/app_runtime_api.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/extensions/api/app_runtime/app_runtime_api.cc
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 d5180e8c4e019187f51bdb008611cd1461e9c154..ff70376b983b43f61ed13a2c653a21a7463ba1c6 100644
--- a/chrome/browser/extensions/api/app_runtime/app_runtime_api.cc
+++ b/chrome/browser/extensions/api/app_runtime/app_runtime_api.cc
@@ -11,27 +11,18 @@
#include "base/values.h"
#include "chrome/browser/extensions/event_router.h"
#include "chrome/browser/extensions/extension_system.h"
-#include "chrome/browser/extensions/web_intent_callbacks.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/extensions/extension.h"
#include "content/public/browser/web_contents.h"
-#include "content/public/browser/web_intents_dispatcher.h"
#include "googleurl/src/gurl.h"
-#include "webkit/glue/web_intent_data.h"
namespace extensions {
namespace {
-const char kIntentIdKey[] = "intentId";
-const char kIntentSuccessKey[] = "success";
-const char kIntentDataKey[] = "data";
const char kOnLaunchedEvent[] = "app.runtime.onLaunched";
const char kOnRestartedEvent[] = "app.runtime.onRestarted";
-const char kCallbackNotFoundError[] =
- "WebIntent callback not found; perhaps already responded to";
-
void DispatchOnLaunchedEventImpl(const std::string& extension_id,
scoped_ptr<base::ListValue> args,
Profile* profile) {
@@ -72,7 +63,7 @@ void AppEventRouter::DispatchOnRestartedEvent(
// static.
void AppEventRouter::DispatchOnLaunchedEventWithFileEntry(
- Profile* profile, const Extension* extension, const string16& action,
+ Profile* profile, const Extension* extension,
const std::string& handler_id, const std::string& mime_type,
const std::string& file_system_id, const std::string& base_name) {
scoped_ptr<ListValue> args(new ListValue());
@@ -89,97 +80,4 @@ void AppEventRouter::DispatchOnLaunchedEventWithFileEntry(
DispatchOnLaunchedEventImpl(extension->id(), args.Pass(), profile);
}
-// static.
-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();
- DictionaryValue* intent = new DictionaryValue();
- intent->SetString("action", UTF16ToUTF8(web_intent_data.action));
- intent->SetString("type", UTF16ToUTF8(web_intent_data.type));
- launch_data->Set("intent", intent);
- args->Append(launch_data);
- DictionaryValue* intent_data;
- switch (web_intent_data.data_type) {
- case webkit_glue::WebIntentData::SERIALIZED:
- intent_data = new DictionaryValue();
- intent_data->SetString("format", "serialized");
- intent_data->SetString("data", UTF16ToUTF8(web_intent_data.data));
- // NOTE: This second argument is dropped before being dispatched to the
- // client code.
- args->Append(intent_data);
- break;
- case webkit_glue::WebIntentData::UNSERIALIZED:
- args->Append(Value::CreateNullValue());
- intent->SetString("data", UTF16ToUTF8(web_intent_data.unserialized_data));
- break;
- case webkit_glue::WebIntentData::BLOB:
- intent_data = new DictionaryValue();
- intent_data->SetString("format", "blob");
- intent_data->SetString("blobFileName", web_intent_data.blob_file.value());
- intent_data->SetString("blobLength",
- base::Int64ToString(web_intent_data.blob_length));
- // NOTE: This second argument is dropped before being dispatched to the
- // client code.
- args->Append(intent_data);
- break;
- case webkit_glue::WebIntentData::FILESYSTEM:
- intent_data = new DictionaryValue();
- intent_data->SetString("format", "filesystem");
- intent_data->SetString("fileSystemId", web_intent_data.filesystem_id);
- intent_data->SetString("baseName", web_intent_data.root_name);
- args->Append(intent_data);
- break;
- default:
- NOTREACHED();
- break;
- }
- DCHECK(args->GetSize() == 2); // intent_id must be our third argument.
- WebIntentCallbacks* callbacks = WebIntentCallbacks::Get(profile);
- int intent_id =
- 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));
-
- int intent_id = 0;
- EXTENSION_FUNCTION_VALIDATE(details->GetInteger(kIntentIdKey, &intent_id));
-
- WebIntentCallbacks* callbacks = WebIntentCallbacks::Get(profile());
- content::WebIntentsDispatcher* intents_dispatcher =
- callbacks->RetrieveCallback(GetExtension(), intent_id);
- if (!intents_dispatcher) {
- error_ = kCallbackNotFoundError;
- return false;
- }
-
- webkit_glue::WebIntentReplyType reply_type =
- webkit_glue::WEB_INTENT_REPLY_FAILURE;
- bool success;
- EXTENSION_FUNCTION_VALIDATE(details->GetBoolean(kIntentSuccessKey, &success));
- if (success)
- reply_type = webkit_glue::WEB_INTENT_REPLY_SUCCESS;
-
- std::string data;
- EXTENSION_FUNCTION_VALIDATE(details->GetString(kIntentDataKey, &data));
-
- intents_dispatcher->SendReply(webkit_glue::WebIntentReply(
- reply_type, UTF8ToUTF16(data)));
-
- return true;
-#else
- return false;
-#endif
-}
-
} // namespace extensions
« no previous file with comments | « chrome/browser/extensions/api/app_runtime/app_runtime_api.h ('k') | chrome/browser/extensions/extension_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698