blob: b03fd3bf065811c85c8d8a40c25335b3bffa490b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_RENDER_VIEW_CONTEXT_MENU_CONTROLLER_H__
#define CHROME_BROWSER_RENDER_VIEW_CONTEXT_MENU_CONTROLLER_H__
#include "chrome/common/pref_member.h"
#include "chrome/views/menu.h"
#include "chrome/common/render_messages.h"
class WebContents;
class RenderViewContextMenuController : public Menu::Delegate {
public:
RenderViewContextMenuController(WebContents* source_web_contents,
const ViewHostMsg_ContextMenu_Params& params);
virtual ~RenderViewContextMenuController();
// Overridden from Menu::Delegate
virtual std::wstring GetLabel(int id) const;
virtual bool IsCommandEnabled(int id) const;
virtual bool IsItemChecked(int id) const;
virtual void ExecuteCommand(int id);
virtual bool GetAcceleratorInfo(int id, views::Accelerator* accel);
private:
// Opens the specified URL string in a new tab. If |in_current_window| is
// false, a new window is created to hold the new tab.
void OpenURL(const GURL& url,
WindowOpenDisposition disposition,
PageTransition::Type transition);
// Copy to the clipboard an image located at a point in the RenderView
void CopyImageAt(int x, int y);
// Launch the inspector targeting a point in the RenderView
void Inspect(int x, int y);
// Writes the specified text/url to the system clipboard
void WriteTextToClipboard(const std::wstring& text);
void WriteURLToClipboard(const GURL& url);
bool IsDevCommandEnabled(int id) const;
DISALLOW_EVIL_CONSTRUCTORS(RenderViewContextMenuController);
private:
WebContents* source_web_contents_;
ViewHostMsg_ContextMenu_Params params_;
StringPrefMember dictionary_language_;
int current_dictionary_language_index_;
};
#endif // CHROME_BROWSER_RENDER_VIEW_CONTEXT_MENU_CONTROLLER_H__
|