| 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_RENDER_VIEW_CONTEXT_MENU_BASE_H_ | 5 #ifndef COMPONENTS_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_BASE_H_ |
| 6 #define COMPONENTS_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_BASE_H_ | 6 #define COMPONENTS_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_BASE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 |
| 9 #include <map> | 10 #include <map> |
| 11 #include <memory> |
| 10 #include <string> | 12 #include <string> |
| 11 #include <utility> | 13 #include <utility> |
| 12 | 14 |
| 13 #include "base/macros.h" | 15 #include "base/macros.h" |
| 14 #include "base/memory/scoped_ptr.h" | |
| 15 #include "base/memory/scoped_vector.h" | 16 #include "base/memory/scoped_vector.h" |
| 16 #include "base/observer_list.h" | 17 #include "base/observer_list.h" |
| 17 #include "base/strings/string16.h" | 18 #include "base/strings/string16.h" |
| 18 #include "components/renderer_context_menu/context_menu_content_type.h" | 19 #include "components/renderer_context_menu/context_menu_content_type.h" |
| 19 #include "components/renderer_context_menu/render_view_context_menu_observer.h" | 20 #include "components/renderer_context_menu/render_view_context_menu_observer.h" |
| 20 #include "components/renderer_context_menu/render_view_context_menu_proxy.h" | 21 #include "components/renderer_context_menu/render_view_context_menu_proxy.h" |
| 21 #include "content/public/common/context_menu_params.h" | 22 #include "content/public/common/context_menu_params.h" |
| 22 #include "ui/base/models/simple_menu_model.h" | 23 #include "ui/base/models/simple_menu_model.h" |
| 23 #include "ui/base/page_transition_types.h" | 24 #include "ui/base/page_transition_types.h" |
| 24 #include "ui/base/window_open_disposition.h" | 25 #include "ui/base/window_open_disposition.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 content::BrowserContext* GetBrowserContext() const override; | 114 content::BrowserContext* GetBrowserContext() const override; |
| 114 | 115 |
| 115 protected: | 116 protected: |
| 116 friend class RenderViewContextMenuTest; | 117 friend class RenderViewContextMenuTest; |
| 117 friend class RenderViewContextMenuPrefsTest; | 118 friend class RenderViewContextMenuPrefsTest; |
| 118 | 119 |
| 119 void set_content_type(ContextMenuContentType* content_type) { | 120 void set_content_type(ContextMenuContentType* content_type) { |
| 120 content_type_.reset(content_type); | 121 content_type_.reset(content_type); |
| 121 } | 122 } |
| 122 | 123 |
| 123 void set_toolkit_delegate(scoped_ptr<ToolkitDelegate> delegate) { | 124 void set_toolkit_delegate(std::unique_ptr<ToolkitDelegate> delegate) { |
| 124 toolkit_delegate_ = std::move(delegate); | 125 toolkit_delegate_ = std::move(delegate); |
| 125 } | 126 } |
| 126 | 127 |
| 127 ToolkitDelegate* toolkit_delegate() { | 128 ToolkitDelegate* toolkit_delegate() { |
| 128 return toolkit_delegate_.get(); | 129 return toolkit_delegate_.get(); |
| 129 } | 130 } |
| 130 | 131 |
| 131 // TODO(oshima): Make these methods delegate. | 132 // TODO(oshima): Make these methods delegate. |
| 132 | 133 |
| 133 // Menu Construction. | 134 // Menu Construction. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 // Renderer's frame id. | 182 // Renderer's frame id. |
| 182 const int render_frame_id_; | 183 const int render_frame_id_; |
| 183 | 184 |
| 184 // Our observers. | 185 // Our observers. |
| 185 mutable base::ObserverList<RenderViewContextMenuObserver> observers_; | 186 mutable base::ObserverList<RenderViewContextMenuObserver> observers_; |
| 186 | 187 |
| 187 // Whether a command has been executed. Used to track whether menu observers | 188 // Whether a command has been executed. Used to track whether menu observers |
| 188 // should be notified of menu closing without execution. | 189 // should be notified of menu closing without execution. |
| 189 bool command_executed_; | 190 bool command_executed_; |
| 190 | 191 |
| 191 scoped_ptr<ContextMenuContentType> content_type_; | 192 std::unique_ptr<ContextMenuContentType> content_type_; |
| 192 | 193 |
| 193 private: | 194 private: |
| 194 bool AppendCustomItems(); | 195 bool AppendCustomItems(); |
| 195 | 196 |
| 196 // The RenderFrameHost's IDs. | 197 // The RenderFrameHost's IDs. |
| 197 const int render_process_id_; | 198 const int render_process_id_; |
| 198 | 199 |
| 199 scoped_ptr<ToolkitDelegate> toolkit_delegate_; | 200 std::unique_ptr<ToolkitDelegate> toolkit_delegate_; |
| 200 | 201 |
| 201 ScopedVector<ui::SimpleMenuModel> custom_submenus_; | 202 ScopedVector<ui::SimpleMenuModel> custom_submenus_; |
| 202 | 203 |
| 203 DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenuBase); | 204 DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenuBase); |
| 204 }; | 205 }; |
| 205 | 206 |
| 206 #endif // COMPONENTS_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_BASE_H_ | 207 #endif // COMPONENTS_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_BASE_H_ |
| OLD | NEW |