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

Side by Side Diff: content/browser/intents/intent_injector.h

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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/intents/OWNERS ('k') | content/browser/intents/intent_injector.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_INTENTS_INTENT_INJECTOR_H_
6 #define CONTENT_BROWSER_INTENTS_INTENT_INJECTOR_H_
7
8 #include "base/basictypes.h"
9 #include "base/gtest_prod_util.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h"
12 #include "base/string16.h"
13 #include "content/public/browser/web_contents_observer.h"
14 #include "content/common/content_export.h"
15 #include "googleurl/src/gurl.h"
16 #include "webkit/glue/web_intent_reply_data.h"
17
18 namespace webkit_glue {
19 struct WebIntentData;
20 }
21
22 namespace content {
23 class WebIntentsDispatcher;
24
25 // Injects an intent into the renderer of a WebContents. The intent dispatch
26 // logic will create one of these to take care of passing intent data down into
27 // the context of the service, which will be running in the WebContents on which
28 // this class is an observer. Attaches to the service contents and deletes
29 // itself when that WebContents is closed.
30 //
31 // This object should be attached to the new WebContents very early: before the
32 // RenderView is created. It will then send the intent data down to the renderer
33 // on the RenderViewCreated call, so that the intent data is available
34 // throughout the parsing of the loaded document.
35 class CONTENT_EXPORT IntentInjector : public WebContentsObserver {
36 public:
37 // |web_contents| must not be NULL.
38 explicit IntentInjector(WebContents* web_contents);
39
40 // WebContentsObserver implementation.
41 virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE;
42 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
43 virtual void WebContentsDestroyed(WebContents* contents) OVERRIDE;
44
45 // Used to notify the object that the source contents has been destroyed.
46 void SourceWebContentsDestroyed(WebContents* contents);
47
48 // Sets the intent data to be injected. Call after the user has selected a
49 // service to pass the intent data to that service. |intents_dispatcher| is a
50 // sender to use to communicate to the source contents. The caller must
51 // ensure that SourceWebContentsDestroyed is called when this object becomes
52 // unusable. |intent| is the intent data from the source.
53 void SetIntent(WebIntentsDispatcher* intents_dispatcher,
54 const webkit_glue::WebIntentData& intent);
55
56 // Abandon this injector. Used when re-delivering an intent to a different
57 // service provider, i.e. when abandoning an inline disposition and picking
58 // a new provider. Self-deletes.
59 void Abandon();
60
61 private:
62 FRIEND_TEST_ALL_PREFIXES(IntentInjectorTest, AbandonDeletes);
63
64 // Private, since the class is self-deleting.
65 virtual ~IntentInjector();
66
67 // Handles receiving a reply from the intent delivery page.
68 void OnReply(const webkit_glue::WebIntentReply& reply);
69
70 // Gets notification that someone else has replied to the intent call.
71 void OnSendReturnMessage(webkit_glue::WebIntentReplyType reply_type);
72
73 // Source intent data provided by caller.
74 scoped_ptr<webkit_glue::WebIntentData> source_intent_;
75
76 // Weak pointer to the message forwarder to the contents invoking the intent.
77 WebIntentsDispatcher* intents_dispatcher_;
78
79 // Remember the initial delivery url for origin restriction.
80 GURL initial_url_;
81
82 // The injector may be Abandon()ed and deleted before the dispatcher. Use weak
83 // pointers to ensure the notification callback remains valid.
84 base::WeakPtrFactory<IntentInjector> weak_factory_;
85
86 DISALLOW_COPY_AND_ASSIGN(IntentInjector);
87 };
88
89 } // namespace content
90
91 #endif // CONTENT_BROWSER_INTENTS_INTENT_INJECTOR_H_
OLDNEW
« no previous file with comments | « content/browser/intents/OWNERS ('k') | content/browser/intents/intent_injector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698