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

Side by Side Diff: content/browser/browser_plugin/browser_plugin_embedder.h

Issue 12086095: Fixed drag and drop into and out of Browser Plugin. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Drag and drop enabled for linux only Created 7 years, 9 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // A BrowserPluginEmbedder handles messages coming from a BrowserPlugin's 5 // A BrowserPluginEmbedder handles messages coming from a BrowserPlugin's
6 // embedder that are not directed at any particular existing guest process. 6 // embedder that are not directed at any particular existing guest process.
7 // In the beginning, when a BrowserPlugin instance in the embedder renderer 7 // In the beginning, when a BrowserPlugin instance in the embedder renderer
8 // process requests an initial navigation, the WebContents for that renderer 8 // process requests an initial navigation, the WebContents for that renderer
9 // renderer creates a BrowserPluginEmbedder for itself. The 9 // renderer creates a BrowserPluginEmbedder for itself. The
10 // BrowserPluginEmbedder, in turn, forwards the requests to a 10 // BrowserPluginEmbedder, in turn, forwards the requests to a
11 // BrowserPluginGuestManager, which creates and manages the lifetime of the new 11 // BrowserPluginGuestManager, which creates and manages the lifetime of the new
12 // guest. 12 // guest.
13 13
14 #ifndef CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_H_ 14 #ifndef CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_H_
15 #define CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_H_ 15 #define CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_H_
16 16
17 #include <map> 17 #include <map>
18 18
19 #include "base/memory/weak_ptr.h"
19 #include "content/public/browser/web_contents.h" 20 #include "content/public/browser/web_contents.h"
20 #include "content/public/browser/web_contents_observer.h" 21 #include "content/public/browser/web_contents_observer.h"
21 22
22 struct BrowserPluginHostMsg_CreateGuest_Params; 23 struct BrowserPluginHostMsg_CreateGuest_Params;
23 struct BrowserPluginHostMsg_ResizeGuest_Params; 24 struct BrowserPluginHostMsg_ResizeGuest_Params;
24 25
25 namespace gfx { 26 namespace gfx {
26 class Point; 27 class Point;
27 } 28 }
28 29
29 namespace content { 30 namespace content {
30 31
32 class BrowserPluginGuest;
31 class BrowserPluginGuestManager; 33 class BrowserPluginGuestManager;
32 class BrowserPluginHostFactory; 34 class BrowserPluginHostFactory;
33 class WebContentsImpl; 35 class WebContentsImpl;
34 36
35 class CONTENT_EXPORT BrowserPluginEmbedder : public WebContentsObserver { 37 class CONTENT_EXPORT BrowserPluginEmbedder : public WebContentsObserver {
36 public: 38 public:
37 virtual ~BrowserPluginEmbedder(); 39 virtual ~BrowserPluginEmbedder();
38 40
39 static BrowserPluginEmbedder* Create(WebContentsImpl* web_contents); 41 static BrowserPluginEmbedder* Create(WebContentsImpl* web_contents);
40 42
41 // Returns the RenderViewHost at a point (|x|, |y|) asynchronously via 43 // Returns the RenderViewHost at a point (|x|, |y|) asynchronously via
42 // |callback|. We need a roundtrip to renderer process to get this 44 // |callback|. We need a roundtrip to renderer process to get this
43 // information. 45 // information.
44 void GetRenderViewHostAtPosition( 46 void GetRenderViewHostAtPosition(
45 int x, 47 int x,
46 int y, 48 int y,
47 const WebContents::GetRenderViewHostCallback& callback); 49 const WebContents::GetRenderViewHostCallback& callback);
48 50
49 // Overrides factory for testing. Default (NULL) value indicates regular 51 // Overrides factory for testing. Default (NULL) value indicates regular
50 // (non-test) environment. 52 // (non-test) environment.
51 static void set_factory_for_testing(BrowserPluginHostFactory* factory) { 53 static void set_factory_for_testing(BrowserPluginHostFactory* factory) {
52 factory_ = factory; 54 factory_ = factory;
53 } 55 }
54 56
55 // WebContentsObserver implementation. 57 // WebContentsObserver implementation.
56 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; 58 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE;
57 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 59 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
60 virtual void SystemDragEnded() OVERRIDE;
61
62 void DragSourceEndedAt(int client_x, int client_y, int screen_x,
63 int screen_y, WebKit::WebDragOperation operation);
64
65 void DragSourceMovedTo(int client_x, int client_y,
66 int screen_x, int screen_y);
67
68 void OnUpdateDragCursor(bool* handled);
69
70 void DragEnteredGuest(BrowserPluginGuest* guest);
71
72 void DragLeftGuest(BrowserPluginGuest* guest);
73
74 void StartDrag(BrowserPluginGuest* guest);
75
76 void StopDrag(BrowserPluginGuest* guest);
58 77
59 private: 78 private:
60 friend class TestBrowserPluginEmbedder; 79 friend class TestBrowserPluginEmbedder;
61 80
62 BrowserPluginEmbedder(WebContentsImpl* web_contents); 81 BrowserPluginEmbedder(WebContentsImpl* web_contents);
63 82
64 void CleanUp(); 83 void CleanUp();
65 84
66 BrowserPluginGuestManager* GetBrowserPluginGuestManager(); 85 BrowserPluginGuestManager* GetBrowserPluginGuestManager();
67 86
(...skipping 12 matching lines...) Expand all
80 static BrowserPluginHostFactory* factory_; 99 static BrowserPluginHostFactory* factory_;
81 100
82 // Map that contains outstanding queries to |GetRenderViewHostAtPosition|. 101 // Map that contains outstanding queries to |GetRenderViewHostAtPosition|.
83 // We need a roundtrip to the renderer process to retrieve the answer, 102 // We need a roundtrip to the renderer process to retrieve the answer,
84 // so we store these callbacks until we hear back from the renderer. 103 // so we store these callbacks until we hear back from the renderer.
85 typedef std::map<int, WebContents::GetRenderViewHostCallback> 104 typedef std::map<int, WebContents::GetRenderViewHostCallback>
86 GetRenderViewHostCallbackMap; 105 GetRenderViewHostCallbackMap;
87 GetRenderViewHostCallbackMap pending_get_render_view_callbacks_; 106 GetRenderViewHostCallbackMap pending_get_render_view_callbacks_;
88 // Next request id for BrowserPluginMsg_PluginAtPositionRequest query. 107 // Next request id for BrowserPluginMsg_PluginAtPositionRequest query.
89 int next_get_render_view_request_id_; 108 int next_get_render_view_request_id_;
109 base::WeakPtr<BrowserPluginGuest> guest_dragging_over_;
110 base::WeakPtr<BrowserPluginGuest> guest_started_drag_;
90 111
91 DISALLOW_COPY_AND_ASSIGN(BrowserPluginEmbedder); 112 DISALLOW_COPY_AND_ASSIGN(BrowserPluginEmbedder);
92 }; 113 };
93 114
94 } // namespace content 115 } // namespace content
95 116
96 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_H_ 117 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698