OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_DELEGATE_H_ | 5 #ifndef EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_DELEGATE_H_ |
6 #define EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_DELEGATE_H_ | 6 #define EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_DELEGATE_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/memory/scoped_ptr.h" |
9 #include "components/guest_view/browser/guest_view_base.h" | 10 #include "components/guest_view/browser/guest_view_base.h" |
10 | 11 |
11 namespace content { | 12 namespace content { |
12 class RenderViewHost; | 13 class RenderViewHost; |
13 class WebContents; | 14 class WebContents; |
14 } // namespace content | 15 } // namespace content |
15 | 16 |
16 namespace extensions { | 17 namespace extensions { |
17 | 18 |
18 class WebViewGuest; | 19 class WebViewGuest; |
19 | 20 |
20 namespace api { | 21 namespace api { |
21 namespace web_view_internal { | 22 namespace web_view_internal { |
22 | 23 |
23 struct ContextMenuItem; | 24 struct ContextMenuItem; |
24 } // namespace web_view_internal | 25 } // namespace web_view_internal |
25 } // namespace api | 26 } // namespace api |
26 | 27 |
27 // A delegate class of WebViewGuest that are not a part of chrome. | 28 // A delegate class of WebViewGuest that are not a part of chrome. |
28 class WebViewGuestDelegate { | 29 class WebViewGuestDelegate { |
29 public : | 30 public : |
30 virtual ~WebViewGuestDelegate() {} | 31 virtual ~WebViewGuestDelegate() {} |
31 | 32 |
32 typedef std::vector<linked_ptr<api::web_view_internal::ContextMenuItem> > | |
33 MenuItemVector; | |
34 | |
35 // Called when context menu operation was handled. | 33 // Called when context menu operation was handled. |
36 virtual bool HandleContextMenu(const content::ContextMenuParams& params) = 0; | 34 virtual bool HandleContextMenu(const content::ContextMenuParams& params) = 0; |
37 | 35 |
38 // Called just after additional initialization is performed. | 36 // Called just after additional initialization is performed. |
39 virtual void OnDidInitialize() = 0; | 37 virtual void OnDidInitialize() = 0; |
40 | 38 |
41 // Shows the context menu for the guest. | 39 // Shows the context menu for the guest. |
42 // |items| acts as a filter. This restricts the current context's default | 40 virtual void OnShowContextMenu(int request_id) = 0; |
43 // menu items to contain only the items from |items|. | |
44 // |items| == NULL means no filtering will be applied. | |
45 virtual void OnShowContextMenu( | |
46 int request_id, | |
47 const MenuItemVector* items) = 0; | |
48 | 41 |
49 // Returns true if the WebViewGuest should handle find requests for its | 42 // Returns true if the WebViewGuest should handle find requests for its |
50 // embedder. | 43 // embedder. |
51 virtual bool ShouldHandleFindRequestsForEmbedder() const = 0; | 44 virtual bool ShouldHandleFindRequestsForEmbedder() const = 0; |
52 | 45 |
53 virtual void SetContextMenuPosition(const gfx::Point& position) = 0; | 46 virtual void SetContextMenuPosition(const gfx::Point& position) = 0; |
54 }; | 47 }; |
55 | 48 |
56 } // namespace extensions | 49 } // namespace extensions |
57 | 50 |
58 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_DELEGATE_H_ | 51 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_DELEGATE_H_ |
OLD | NEW |