| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_H_ | 5 #ifndef CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_H_ |
| 6 #define CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_H_ | 6 #define CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_H_ |
| 7 | 7 |
| 8 #include "base/string16.h" | 8 #include "base/string16.h" |
| 9 #include "chrome/common/page_transition_types.h" | 9 #include "chrome/common/page_transition_types.h" |
| 10 #include "webkit/glue/context_menu.h" | 10 #include "webkit/glue/context_menu.h" |
| 11 #include "webkit/glue/window_open_disposition.h" | 11 #include "webkit/glue/window_open_disposition.h" |
| 12 | 12 |
| 13 class Profile; | 13 class Profile; |
| 14 class TabContents; | 14 class TabContents; |
| 15 | 15 |
| 16 class RenderViewContextMenu { | 16 class RenderViewContextMenu { |
| 17 public: | 17 public: |
| 18 RenderViewContextMenu( | 18 RenderViewContextMenu( |
| 19 TabContents* tab_contents, | 19 TabContents* tab_contents, |
| 20 const ContextMenuParams& params); | 20 const ContextMenuParams& params); |
| 21 | 21 |
| 22 virtual ~RenderViewContextMenu(); | 22 virtual ~RenderViewContextMenu(); |
| 23 | 23 |
| 24 // Initializes the context menu. | 24 // Initializes the context menu. |
| 25 void Init(); | 25 void Init(); |
| 26 | 26 |
| 27 protected: | 27 protected: |
| 28 void InitMenu(ContextNode node); | 28 void InitMenu(ContextNode node, ContextMenuMediaParams media_params); |
| 29 | 29 |
| 30 // Functions to be implemented by platform-specific subclasses --------------- | 30 // Functions to be implemented by platform-specific subclasses --------------- |
| 31 | 31 |
| 32 // Platform specific initialization goes here. | 32 // Platform specific initialization goes here. |
| 33 virtual void DoInit() {} | 33 virtual void DoInit() {} |
| 34 | 34 |
| 35 // Append a normal menu item, taking the name from the id. | 35 // Append a normal menu item, taking the name from the id. |
| 36 virtual void AppendMenuItem(int id) = 0; | 36 virtual void AppendMenuItem(int id) = 0; |
| 37 | 37 |
| 38 // Append a normal menu item, using |label| for the name. | 38 // Append a normal menu item, using |label| for the name. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 69 | 69 |
| 70 protected: | 70 protected: |
| 71 ContextMenuParams params_; | 71 ContextMenuParams params_; |
| 72 TabContents* source_tab_contents_; | 72 TabContents* source_tab_contents_; |
| 73 Profile* profile_; | 73 Profile* profile_; |
| 74 | 74 |
| 75 private: | 75 private: |
| 76 void AppendDeveloperItems(); | 76 void AppendDeveloperItems(); |
| 77 void AppendLinkItems(); | 77 void AppendLinkItems(); |
| 78 void AppendImageItems(); | 78 void AppendImageItems(); |
| 79 void AppendAudioItems(ContextMenuMediaParams media_params); |
| 80 void AppendVideoItems(ContextMenuMediaParams media_params); |
| 81 void AppendMediaItems(ContextMenuMediaParams media_params); |
| 79 void AppendPageItems(); | 82 void AppendPageItems(); |
| 80 void AppendFrameItems(); | 83 void AppendFrameItems(); |
| 81 void AppendCopyItem(); | 84 void AppendCopyItem(); |
| 82 void AppendEditableItems(); | 85 void AppendEditableItems(); |
| 83 void AppendSearchProvider(); | 86 void AppendSearchProvider(); |
| 84 | 87 |
| 85 // Opens the specified URL string in a new tab. If |in_current_window| is | 88 // Opens the specified URL string in a new tab. If |in_current_window| is |
| 86 // false, a new window is created to hold the new tab. | 89 // false, a new window is created to hold the new tab. |
| 87 void OpenURL(const GURL& url, | 90 void OpenURL(const GURL& url, |
| 88 WindowOpenDisposition disposition, | 91 WindowOpenDisposition disposition, |
| 89 PageTransition::Type transition); | 92 PageTransition::Type transition); |
| 90 | 93 |
| 91 // Copy to the clipboard an image located at a point in the RenderView | 94 // Copy to the clipboard an image located at a point in the RenderView |
| 92 void CopyImageAt(int x, int y); | 95 void CopyImageAt(int x, int y); |
| 93 | 96 |
| 94 // Launch the inspector targeting a point in the RenderView | 97 // Launch the inspector targeting a point in the RenderView |
| 95 void Inspect(int x, int y); | 98 void Inspect(int x, int y); |
| 96 | 99 |
| 97 // Writes the specified text/url to the system clipboard | 100 // Writes the specified text/url to the system clipboard |
| 98 void WriteTextToClipboard(const string16& text); | 101 void WriteTextToClipboard(const string16& text); |
| 99 void WriteURLToClipboard(const GURL& url); | 102 void WriteURLToClipboard(const GURL& url); |
| 100 | 103 |
| 101 bool IsDevCommandEnabled(int id) const; | 104 bool IsDevCommandEnabled(int id) const; |
| 102 | 105 |
| 103 DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenu); | 106 DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenu); |
| 104 }; | 107 }; |
| 105 | 108 |
| 106 #endif // CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_H_ | 109 #endif // CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_H_ |
| OLD | NEW |