summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgbillock@chromium.org <gbillock@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-01 08:38:36 +0000
committergbillock@chromium.org <gbillock@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-01 08:38:36 +0000
commit3a3b75ab9cc13b9acb466de0ef1bc7036756fce4 (patch)
treeb58f4946657cc25dfc6f667e10aad16f070be5b4
parent75001aab2af6da7c04d30daf3019f0dba4982432 (diff)
downloadchromium_src-3a3b75ab9cc13b9acb466de0ef1bc7036756fce4.zip
chromium_src-3a3b75ab9cc13b9acb466de0ef1bc7036756fce4.tar.gz
chromium_src-3a3b75ab9cc13b9acb466de0ef1bc7036756fce4.tar.bz2
Pass user gesture indicator for RPH and intents.
We are moving to a policy which will change where we show RPH and web intents registrations between infobar and page-action type indicator depending on factors like user gesture, previous showing of the infobar, and perhaps other considerations. This change gets that user gesture indicator to the policy logic. It also incorporates a change to the web intents registration IPC to pass the service info struct instead of individual members. (Adding the user gesture went over the param limit, and passing the struct is a good change regardless.) R=groby@chromium.org,jam@chromium.org BUG=119438 TEST=*WebIntent*.* Review URL: https://chromiumcodereview.appspot.com/10447067 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139996 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/external_tab/external_tab_container_win.cc23
-rw-r--r--chrome/browser/external_tab/external_tab_container_win.h13
-rw-r--r--chrome/browser/intents/register_intent_handler_helper.cc30
-rw-r--r--chrome/browser/ui/browser.cc21
-rw-r--r--chrome/browser/ui/browser.h32
-rw-r--r--content/browser/web_contents/web_contents_impl.cc17
-rw-r--r--content/browser/web_contents/web_contents_impl.h11
-rw-r--r--content/common/intents_messages.h19
-rw-r--r--content/common/view_messages.h5
-rw-r--r--content/public/browser/web_contents_delegate.h23
-rw-r--r--content/renderer/notification_provider.cc4
-rw-r--r--content/renderer/render_view_browsertest.cc17
-rw-r--r--content/renderer/render_view_impl.cc21
-rw-r--r--webkit/glue/web_intent_service_data.cc13
-rw-r--r--webkit/glue/web_intent_service_data.h10
15 files changed, 136 insertions, 123 deletions
diff --git a/chrome/browser/external_tab/external_tab_container_win.cc b/chrome/browser/external_tab/external_tab_container_win.cc
index 4cb512d..9c06ad8 100644
--- a/chrome/browser/external_tab/external_tab_container_win.cc
+++ b/chrome/browser/external_tab/external_tab_container_win.cc
@@ -736,18 +736,17 @@ void ExternalTabContainer::JSOutOfMemory(WebContents* tab) {
void ExternalTabContainer::RegisterProtocolHandler(WebContents* tab,
const std::string& protocol,
const GURL& url,
- const string16& title) {
- Browser::RegisterProtocolHandlerHelper(tab, protocol, url, title);
-}
-
-void ExternalTabContainer::RegisterIntentHandler(WebContents* tab,
- const string16& action,
- const string16& type,
- const string16& href,
- const string16& title,
- const string16& disposition) {
- Browser::RegisterIntentHandlerHelper(
- tab, action, type, href, title, disposition);
+ const string16& title,
+ bool user_gesture) {
+ Browser::RegisterProtocolHandlerHelper(tab, protocol, url, title,
+ user_gesture);
+}
+
+void ExternalTabContainer::RegisterIntentHandler(
+ WebContents* tab,
+ const webkit_glue::WebIntentServiceData& data,
+ bool user_gesture) {
+ Browser::RegisterIntentHandlerHelper(tab, data, user_gesture);
}
void ExternalTabContainer::WebIntentDispatch(
diff --git a/chrome/browser/external_tab/external_tab_container_win.h b/chrome/browser/external_tab/external_tab_container_win.h
index 2cb8f82..52413b3 100644
--- a/chrome/browser/external_tab/external_tab_container_win.h
+++ b/chrome/browser/external_tab/external_tab_container_win.h
@@ -176,13 +176,12 @@ class ExternalTabContainer : public content::WebContentsDelegate,
virtual void RegisterProtocolHandler(content::WebContents* tab,
const std::string& protocol,
const GURL& url,
- const string16& title) OVERRIDE;
- virtual void RegisterIntentHandler(content::WebContents* tab,
- const string16& action,
- const string16& type,
- const string16& href,
- const string16& title,
- const string16& disposition) OVERRIDE;
+ const string16& title,
+ bool user_gesture) OVERRIDE;
+ virtual void RegisterIntentHandler(
+ content::WebContents* tab,
+ const webkit_glue::WebIntentServiceData& data,
+ bool user_gesture) OVERRIDE;
virtual void WebIntentDispatch(
content::WebContents* tab,
content::WebIntentsDispatcher* intents_dispatcher) OVERRIDE;
diff --git a/chrome/browser/intents/register_intent_handler_helper.cc b/chrome/browser/intents/register_intent_handler_helper.cc
index abfd47f..88c1f96 100644
--- a/chrome/browser/intents/register_intent_handler_helper.cc
+++ b/chrome/browser/intents/register_intent_handler_helper.cc
@@ -17,14 +17,12 @@
using content::WebContents;
// static
-void Browser::RegisterIntentHandlerHelper(WebContents* tab,
- const string16& action,
- const string16& type,
- const string16& href,
- const string16& title,
- const string16& disposition) {
- TabContentsWrapper* tcw = TabContentsWrapper::GetCurrentWrapperForContents(
- tab);
+void Browser::RegisterIntentHandlerHelper(
+ WebContents* tab,
+ const webkit_glue::WebIntentServiceData& data,
+ bool user_gesture) {
+ TabContentsWrapper* tcw =
+ TabContentsWrapper::GetCurrentWrapperForContents(tab);
if (!tcw || tcw->profile()->IsOffTheRecord())
return;
@@ -34,24 +32,10 @@ void Browser::RegisterIntentHandlerHelper(WebContents* tab,
FaviconService* favicon_service =
tcw->profile()->GetFaviconService(Profile::EXPLICIT_ACCESS);
- // |href| can be relative to originating URL. Resolve if necessary.
- GURL service_url(href);
- if (!service_url.is_valid()) {
- const GURL& url = tab->GetURL();
- service_url = url.Resolve(href);
- }
-
- webkit_glue::WebIntentServiceData service;
- service.service_url = service_url;
- service.action = action;
- service.type = type;
- service.title = title;
- service.setDisposition(disposition);
-
RegisterIntentHandlerInfoBarDelegate::MaybeShowIntentInfoBar(
tcw->infobar_tab_helper(),
WebIntentsRegistryFactory::GetForProfile(tcw->profile()),
- service,
+ data,
favicon_service,
tab->GetURL());
}
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index 785af04..3d5c55c 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -186,6 +186,7 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/point.h"
#include "webkit/glue/web_intent_data.h"
+#include "webkit/glue/web_intent_service_data.h"
#include "webkit/glue/webkit_glue.h"
#include "webkit/glue/window_open_disposition.h"
#include "webkit/plugins/webplugininfo.h"
@@ -2235,7 +2236,8 @@ void Browser::JSOutOfMemoryHelper(WebContents* tab) {
void Browser::RegisterProtocolHandlerHelper(WebContents* tab,
const std::string& protocol,
const GURL& url,
- const string16& title) {
+ const string16& title,
+ bool user_gesture) {
TabContentsWrapper* tcw = TabContentsWrapper::GetCurrentWrapperForContents(
tab);
if (!tcw || tcw->profile()->IsOffTheRecord())
@@ -3601,17 +3603,16 @@ void Browser::JSOutOfMemory(WebContents* tab) {
void Browser::RegisterProtocolHandler(WebContents* tab,
const std::string& protocol,
const GURL& url,
- const string16& title) {
- RegisterProtocolHandlerHelper(tab, protocol, url, title);
+ const string16& title,
+ bool user_gesture) {
+ RegisterProtocolHandlerHelper(tab, protocol, url, title, user_gesture);
}
-void Browser::RegisterIntentHandler(WebContents* tab,
- const string16& action,
- const string16& type,
- const string16& href,
- const string16& title,
- const string16& disposition) {
- RegisterIntentHandlerHelper(tab, action, type, href, title, disposition);
+void Browser::RegisterIntentHandler(
+ WebContents* tab,
+ const webkit_glue::WebIntentServiceData& data,
+ bool user_gesture) {
+ RegisterIntentHandlerHelper(tab, data, user_gesture);
}
void Browser::WebIntentDispatch(
diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h
index b7f5e51..05a74418 100644
--- a/chrome/browser/ui/browser.h
+++ b/chrome/browser/ui/browser.h
@@ -86,6 +86,10 @@ namespace ui {
class WebDialogDelegate;
}
+namespace webkit_glue {
+struct WebIntentServiceData;
+}
+
class Browser : public TabStripModelDelegate,
public TabStripModelObserver,
public content::WebContentsDelegate,
@@ -649,15 +653,16 @@ class Browser : public TabStripModelDelegate,
static void RegisterProtocolHandlerHelper(content::WebContents* tab,
const std::string& protocol,
const GURL& url,
- const string16& title);
+ const string16& title,
+ bool user_gesture);
// Helper function to register an intent handler.
- static void RegisterIntentHandlerHelper(content::WebContents* tab,
- const string16& action,
- const string16& type,
- const string16& href,
- const string16& title,
- const string16& disposition);
+ // |data| is the registered handler data. |user_gesture| is true if the call
+ // was made in the context of a user gesture.
+ static void RegisterIntentHandlerHelper(
+ content::WebContents* tab,
+ const webkit_glue::WebIntentServiceData& data,
+ bool user_gesture);
// Helper function to handle find results.
static void FindReplyHelper(content::WebContents* tab,
@@ -967,13 +972,12 @@ class Browser : public TabStripModelDelegate,
virtual void RegisterProtocolHandler(content::WebContents* tab,
const std::string& protocol,
const GURL& url,
- const string16& title) OVERRIDE;
- virtual void RegisterIntentHandler(content::WebContents* tab,
- const string16& action,
- const string16& type,
- const string16& href,
- const string16& title,
- const string16& disposition) OVERRIDE;
+ const string16& title,
+ bool user_gesture) OVERRIDE;
+ virtual void RegisterIntentHandler(
+ content::WebContents* tab,
+ const webkit_glue::WebIntentServiceData& data,
+ bool user_gesture) OVERRIDE;
virtual void WebIntentDispatch(
content::WebContents* tab,
content::WebIntentsDispatcher* intents_dispatcher) OVERRIDE;
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index ef1d9b1..218f6f9 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -72,6 +72,7 @@
#include "ui/gfx/monitor.h"
#include "ui/gfx/screen.h"
#include "webkit/glue/web_intent_data.h"
+#include "webkit/glue/web_intent_service_data.h"
#include "webkit/glue/webpreferences.h"
#if defined(OS_MACOSX)
@@ -1737,13 +1738,10 @@ void WebContentsImpl::SetFocusToLocationBar(bool select_all) {
delegate_->SetFocusToLocationBar(select_all);
}
-void WebContentsImpl::OnRegisterIntentService(const string16& action,
- const string16& type,
- const string16& href,
- const string16& title,
- const string16& disposition) {
- delegate_->RegisterIntentHandler(
- this, action, type, href, title, disposition);
+void WebContentsImpl::OnRegisterIntentService(
+ const webkit_glue::WebIntentServiceData& data,
+ bool user_gesture) {
+ delegate_->RegisterIntentHandler(this, data, user_gesture);
}
void WebContentsImpl::OnWebIntentDispatch(
@@ -2038,12 +2036,13 @@ void WebContentsImpl::OnJSOutOfMemory() {
void WebContentsImpl::OnRegisterProtocolHandler(const std::string& protocol,
const GURL& url,
- const string16& title) {
+ const string16& title,
+ bool user_gesture) {
ChildProcessSecurityPolicyImpl* policy =
ChildProcessSecurityPolicyImpl::GetInstance();
if (policy->IsPseudoScheme(protocol) || policy->IsDisabledScheme(protocol))
return;
- delegate_->RegisterProtocolHandler(this, protocol, url, title);
+ delegate_->RegisterProtocolHandler(this, protocol, url, title, user_gesture);
}
void WebContentsImpl::OnFindReply(int request_id,
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h
index b63e1b2..e52a21d 100644
--- a/content/browser/web_contents/web_contents_impl.h
+++ b/content/browser/web_contents/web_contents_impl.h
@@ -64,6 +64,7 @@ WebContentsView* CreateWebContentsView(
namespace webkit_glue {
struct WebIntentData;
+struct WebIntentServiceData;
}
class CONTENT_EXPORT WebContentsImpl
@@ -466,11 +467,8 @@ class CONTENT_EXPORT WebContentsImpl
const string16& user_input);
// IPC message handlers.
- void OnRegisterIntentService(const string16& action,
- const string16& type,
- const string16& href,
- const string16& title,
- const string16& disposition);
+ void OnRegisterIntentService(const webkit_glue::WebIntentServiceData& data,
+ bool user_gesture);
void OnWebIntentDispatch(const webkit_glue::WebIntentData& intent,
int intent_id);
void OnDidLoadResourceFromMemoryCache(const GURL& url,
@@ -501,7 +499,8 @@ class CONTENT_EXPORT WebContentsImpl
void OnRegisterProtocolHandler(const std::string& protocol,
const GURL& url,
- const string16& title);
+ const string16& title,
+ bool user_gesture);
void OnFindReply(int request_id, int number_of_matches,
const gfx::Rect& selection_rect, int active_match_ordinal,
bool final_update);
diff --git a/content/common/intents_messages.h b/content/common/intents_messages.h
index fd2866d..8e648d5 100644
--- a/content/common/intents_messages.h
+++ b/content/common/intents_messages.h
@@ -10,6 +10,7 @@
#include "ipc/param_traits_macros.h"
#include "webkit/glue/web_intent_data.h"
#include "webkit/glue/web_intent_reply_data.h"
+#include "webkit/glue/web_intent_service_data.h"
#undef IPC_MESSAGE_EXPORT
#define IPC_MESSAGE_EXPORT CONTENT_EXPORT
@@ -17,6 +18,7 @@
IPC_ENUM_TRAITS(webkit_glue::WebIntentReplyType)
IPC_ENUM_TRAITS(webkit_glue::WebIntentData::DataType)
+IPC_ENUM_TRAITS(webkit_glue::WebIntentServiceData::Disposition)
IPC_STRUCT_TRAITS_BEGIN(webkit_glue::WebIntentData)
IPC_STRUCT_TRAITS_MEMBER(action)
@@ -32,6 +34,14 @@ IPC_STRUCT_TRAITS_BEGIN(webkit_glue::WebIntentData)
IPC_STRUCT_TRAITS_MEMBER(data_type)
IPC_STRUCT_TRAITS_END()
+IPC_STRUCT_TRAITS_BEGIN(webkit_glue::WebIntentServiceData)
+ IPC_STRUCT_TRAITS_MEMBER(service_url)
+ IPC_STRUCT_TRAITS_MEMBER(action)
+ IPC_STRUCT_TRAITS_MEMBER(type)
+ IPC_STRUCT_TRAITS_MEMBER(title)
+ IPC_STRUCT_TRAITS_MEMBER(disposition)
+IPC_STRUCT_TRAITS_END()
+
// Set the intent data to be set on the service page.
IPC_MESSAGE_ROUTED1(IntentsMsg_SetWebIntentData,
webkit_glue::WebIntentData)
@@ -53,9 +63,6 @@ IPC_MESSAGE_ROUTED2(IntentsHostMsg_WebIntentDispatch,
int /* intent ID */)
// Register a new service for Intents with the given action and type filter.
-IPC_MESSAGE_ROUTED5(IntentsHostMsg_RegisterIntentService,
- string16 /* action */,
- string16 /* type */,
- string16 /* href */,
- string16 /* title */,
- string16 /* disposition */)
+IPC_MESSAGE_ROUTED2(IntentsHostMsg_RegisterIntentService,
+ webkit_glue::WebIntentServiceData,
+ bool /* user_gesture */)
diff --git a/content/common/view_messages.h b/content/common/view_messages.h
index 0e461f5..0870e02 100644
--- a/content/common/view_messages.h
+++ b/content/common/view_messages.h
@@ -2021,10 +2021,11 @@ IPC_MESSAGE_ROUTED2(ViewHostMsg_SaveURLAs,
IPC_MESSAGE_ROUTED0(ViewHostMsg_JSOutOfMemory)
// Register a new handler for URL requests with the given scheme.
-IPC_MESSAGE_ROUTED3(ViewHostMsg_RegisterProtocolHandler,
+IPC_MESSAGE_ROUTED4(ViewHostMsg_RegisterProtocolHandler,
std::string /* scheme */,
GURL /* url */,
- string16 /* title */)
+ string16 /* title */,
+ bool /* user_gesture */)
// Stores new inspector setting in the profile.
// TODO(jam): this should be in the chrome module
diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h
index 55a73b5..6c3b6f8 100644
--- a/content/public/browser/web_contents_delegate.h
+++ b/content/public/browser/web_contents_delegate.h
@@ -53,6 +53,7 @@ class HistoryAddPageArgs;
namespace webkit_glue {
struct WebIntentData;
+struct WebIntentServiceData;
}
namespace content {
@@ -355,18 +356,22 @@ class CONTENT_EXPORT WebContentsDelegate {
virtual void JSOutOfMemory(WebContents* web_contents) {}
// Register a new handler for URL requests with the given scheme.
+ // |user_gesture| is true if the registration is made in the context of a user
+ // gesture.
virtual void RegisterProtocolHandler(WebContents* web_contents,
const std::string& protocol,
const GURL& url,
- const string16& title) {}
-
- // Register a new handler for Intents with the given action and type filter.
- virtual void RegisterIntentHandler(WebContents* web_contents,
- const string16& action,
- const string16& type,
- const string16& href,
- const string16& title,
- const string16& disposition) {}
+ const string16& title,
+ bool user_gesture) {}
+
+ // Register a new Web Intents service.
+ // |user_gesture| is true if the registration is made in the context of a user
+ // gesture. |web_contents| is the context in which the registration was
+ // performed, and |data| is the service record being registered.
+ virtual void RegisterIntentHandler(
+ WebContents* web_contents,
+ const webkit_glue::WebIntentServiceData& data,
+ bool user_gesture) {}
// Web Intents notification handler. See WebIntentsDispatcher for
// documentation of callee responsibility for the dispatcher.
diff --git a/content/renderer/notification_provider.cc b/content/renderer/notification_provider.cc
index 9123a32..c4de9d1 100644
--- a/content/renderer/notification_provider.cc
+++ b/content/renderer/notification_provider.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -69,7 +69,7 @@ void NotificationProvider::requestPermission(
const WebSecurityOrigin& origin,
WebNotificationPermissionCallback* callback) {
// We only request permission in response to a user gesture.
- if (!render_view()->GetWebView()->mainFrame()->isProcessingUserGesture())
+ if (!render_view()->GetWebView()->mainFrame()->isProcessingUserGesture())
return;
int id = manager_.RegisterPermissionRequest(callback);
diff --git a/content/renderer/render_view_browsertest.cc b/content/renderer/render_view_browsertest.cc
index 507e482..faa6d3b 100644
--- a/content/renderer/render_view_browsertest.cc
+++ b/content/renderer/render_view_browsertest.cc
@@ -1256,16 +1256,13 @@ TEST_F(RenderViewImplTest, FindTitleForIntentsPage) {
const IPC::Message* msg = render_thread_->sink().GetUniqueMessageMatching(
IntentsHostMsg_RegisterIntentService::ID);
ASSERT_TRUE(msg);
- string16 action;
- string16 type;
- string16 href;
- string16 title;
- string16 disposition;
- IntentsHostMsg_RegisterIntentService::Read(
- msg, &action, &type, &href, &title, &disposition);
- EXPECT_EQ(ASCIIToUTF16("a"), action);
- EXPECT_EQ(ASCIIToUTF16("t"), type);
- EXPECT_EQ(ASCIIToUTF16("title"), title);
+ webkit_glue::WebIntentServiceData service_data;
+ bool user_gesture = true;
+ IntentsHostMsg_RegisterIntentService::Read(msg, &service_data, &user_gesture);
+ EXPECT_EQ(ASCIIToUTF16("a"), service_data.action);
+ EXPECT_EQ(ASCIIToUTF16("t"), service_data.type);
+ EXPECT_EQ(ASCIIToUTF16("title"), service_data.title);
+ EXPECT_FALSE(user_gesture);
}
TEST_F(RenderViewImplTest, ContextMenu) {
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index b8cf211..060eb19 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -174,6 +174,7 @@
#include "webkit/glue/dom_operations.h"
#include "webkit/glue/glue_serialize.h"
#include "webkit/glue/webdropdata.h"
+#include "webkit/glue/web_intent_service_data.h"
#include "webkit/glue/webkit_constants.h"
#include "webkit/glue/webkit_glue.h"
#include "webkit/glue/weburlloader_impl.h"
@@ -3618,16 +3619,13 @@ void RenderViewImpl::requestStorageQuota(
void RenderViewImpl::registerIntentService(
WebFrame* frame, const WebIntentServiceInfo& service) {
- string16 title = service.title();
- if (title.empty())
- title = webview()->mainFrame()->document().title();
-
+ webkit_glue::WebIntentServiceData data(service);
+ if (data.title.empty())
+ data.title = webview()->mainFrame()->document().title();
+ bool user_gesture = frame->isProcessingUserGesture();
Send(new IntentsHostMsg_RegisterIntentService(routing_id_,
- service.action(),
- service.type(),
- service.url().spec().utf16(),
- title,
- service.disposition()));
+ data,
+ user_gesture));
}
void RenderViewImpl::dispatchIntent(
@@ -5453,6 +5451,8 @@ void RenderViewImpl::registerProtocolHandler(const WebString& scheme,
const WebString& base_url,
const WebString& url,
const WebString& title) {
+ bool user_gesture = (webview()->focusedFrame() &&
+ webview()->focusedFrame()->isProcessingUserGesture());
GURL base(base_url);
GURL absolute_url = base.Resolve(UTF16ToUTF8(url));
if (base.GetOrigin() != absolute_url.GetOrigin()) {
@@ -5461,7 +5461,8 @@ void RenderViewImpl::registerProtocolHandler(const WebString& scheme,
Send(new ViewHostMsg_RegisterProtocolHandler(routing_id_,
UTF16ToUTF8(scheme),
absolute_url,
- title));
+ title,
+ user_gesture));
}
WebKit::WebPageVisibilityState RenderViewImpl::visibilityState() const {
diff --git a/webkit/glue/web_intent_service_data.cc b/webkit/glue/web_intent_service_data.cc
index e9d8d56..4367b60 100644
--- a/webkit/glue/web_intent_service_data.cc
+++ b/webkit/glue/web_intent_service_data.cc
@@ -1,10 +1,11 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <ostream>
#include "base/utf_string_conversions.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebIntentServiceInfo.h"
#include "webkit/glue/web_intent_service_data.h"
namespace webkit_glue {
@@ -26,6 +27,16 @@ WebIntentServiceData::WebIntentServiceData(const GURL& svc_url,
disposition(WebIntentServiceData::DISPOSITION_WINDOW) {
}
+WebIntentServiceData::WebIntentServiceData(
+ const WebKit::WebIntentServiceInfo& info)
+ : service_url(info.url()),
+ action(info.action()),
+ type(info.type()),
+ title(info.title()),
+ disposition(WebIntentServiceData::DISPOSITION_WINDOW) {
+ setDisposition(info.disposition());
+}
+
WebIntentServiceData::~WebIntentServiceData() {}
bool WebIntentServiceData::operator==(const WebIntentServiceData& other) const {
diff --git a/webkit/glue/web_intent_service_data.h b/webkit/glue/web_intent_service_data.h
index d23f3dd..d5a9136 100644
--- a/webkit/glue/web_intent_service_data.h
+++ b/webkit/glue/web_intent_service_data.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,10 +6,15 @@
#define WEBKIT_GLUE_WEB_INTENT_SERVICE_DATA_H_
#pragma once
+#include <iosfwd>
+
#include "base/string16.h"
#include "googleurl/src/gurl.h"
#include "webkit/glue/webkit_glue_export.h"
-#include <iosfwd>
+
+namespace WebKit {
+class WebIntentServiceInfo;
+}
namespace webkit_glue {
@@ -26,6 +31,7 @@ struct WEBKIT_GLUE_EXPORT WebIntentServiceData {
const string16& action,
const string16& type,
const string16& title);
+ explicit WebIntentServiceData(const WebKit::WebIntentServiceInfo& info);
~WebIntentServiceData();
bool operator==(const WebIntentServiceData& other) const;