| 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 COMPONENTS_RENDERER_CONTEXT_MENU_CONTEXT_MENU_DELEGATE_H_ | 5 #ifndef COMPONENTS_RENDERER_CONTEXT_MENU_CONTEXT_MENU_DELEGATE_H_ |
| 6 #define COMPONENTS_RENDERER_CONTEXT_MENU_CONTEXT_MENU_DELEGATE_H_ | 6 #define COMPONENTS_RENDERER_CONTEXT_MENU_CONTEXT_MENU_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 9 |
| 8 #include "base/macros.h" | 10 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 | 11 |
| 11 class RenderViewContextMenuBase; | 12 class RenderViewContextMenuBase; |
| 12 | 13 |
| 13 namespace content { | 14 namespace content { |
| 14 class WebContents; | 15 class WebContents; |
| 15 struct ContextMenuParams; | 16 struct ContextMenuParams; |
| 16 } | 17 } |
| 17 | 18 |
| 18 // A ContextMenuDelegate can build and show renderer context menu. | 19 // A ContextMenuDelegate can build and show renderer context menu. |
| 19 class ContextMenuDelegate { | 20 class ContextMenuDelegate { |
| 20 public: | 21 public: |
| 21 explicit ContextMenuDelegate(content::WebContents* web_contents); | 22 explicit ContextMenuDelegate(content::WebContents* web_contents); |
| 22 virtual ~ContextMenuDelegate(); | 23 virtual ~ContextMenuDelegate(); |
| 23 | 24 |
| 24 static ContextMenuDelegate* FromWebContents( | 25 static ContextMenuDelegate* FromWebContents( |
| 25 content::WebContents* web_contents); | 26 content::WebContents* web_contents); |
| 26 | 27 |
| 27 // Builds and returns a context menu for a context specified by |params|. | 28 // Builds and returns a context menu for a context specified by |params|. |
| 28 // The returned value can be used to display the context menu. | 29 // The returned value can be used to display the context menu. |
| 29 virtual scoped_ptr<RenderViewContextMenuBase> BuildMenu( | 30 virtual std::unique_ptr<RenderViewContextMenuBase> BuildMenu( |
| 30 content::WebContents* web_contents, | 31 content::WebContents* web_contents, |
| 31 const content::ContextMenuParams& params) = 0; | 32 const content::ContextMenuParams& params) = 0; |
| 32 | 33 |
| 33 // Displays the context menu. | 34 // Displays the context menu. |
| 34 virtual void ShowMenu(scoped_ptr<RenderViewContextMenuBase> menu) = 0; | 35 virtual void ShowMenu(std::unique_ptr<RenderViewContextMenuBase> menu) = 0; |
| 35 | 36 |
| 36 private: | 37 private: |
| 37 DISALLOW_COPY_AND_ASSIGN(ContextMenuDelegate); | 38 DISALLOW_COPY_AND_ASSIGN(ContextMenuDelegate); |
| 38 }; | 39 }; |
| 39 | 40 |
| 40 #endif // COMPONENTS_RENDERER_CONTEXT_MENU_CONTEXT_MENU_DELEGATE_H_ | 41 #endif // COMPONENTS_RENDERER_CONTEXT_MENU_CONTEXT_MENU_DELEGATE_H_ |
| OLD | NEW |