Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: Source/core/page/ContextMenuController.h

Issue 243403006: Implement contextmenu attribute with basic support of <menu> (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addressed review comments Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 22 matching lines...) Expand all
33 #include "wtf/RefPtr.h" 33 #include "wtf/RefPtr.h"
34 34
35 namespace blink { 35 namespace blink {
36 36
37 class ContextMenu; 37 class ContextMenu;
38 class ContextMenuClient; 38 class ContextMenuClient;
39 class ContextMenuItem; 39 class ContextMenuItem;
40 class ContextMenuProvider; 40 class ContextMenuProvider;
41 class Document; 41 class Document;
42 class Event; 42 class Event;
43 class HTMLElement;
44 class HTMLMenuElement;
43 class LocalFrame; 45 class LocalFrame;
44 class Page; 46 class Page;
45 47
46 class ContextMenuController { 48 class ContextMenuController {
47 WTF_MAKE_NONCOPYABLE(ContextMenuController); WTF_MAKE_FAST_ALLOCATED; 49 WTF_MAKE_NONCOPYABLE(ContextMenuController); WTF_MAKE_FAST_ALLOCATED;
48 public: 50 public:
49 static PassOwnPtr<ContextMenuController> create(Page*, ContextMenuClient *); 51 static PassOwnPtr<ContextMenuController> create(Page*, ContextMenuClient *);
50 ~ContextMenuController(); 52 ~ContextMenuController();
51 53
52 ContextMenu* contextMenu() const { return m_contextMenu.get(); } 54 ContextMenu* contextMenu() const { return m_contextMenu.get(); }
53 void clearContextMenu(); 55 void clearContextMenu();
54 56
55 void documentDetached(Document*); 57 void documentDetached(Document*);
56 58
57 void handleContextMenuEvent(Event*); 59 void handleContextMenuEvent(Event*);
58 void showContextMenu(Event*, PassRefPtr<ContextMenuProvider>); 60 void showContextMenu(Event*, PassRefPtr<ContextMenuProvider>);
59 void showContextMenuAtPoint(LocalFrame*, float x, float y, PassRefPtr<Co ntextMenuProvider>); 61 void showContextMenuAtPoint(LocalFrame*, float x, float y, PassRefPtr<Co ntextMenuProvider>);
62 HTMLElement* menuItemAt(unsigned menuId);
63 HTMLElement* subjectElement() { return m_subject.get(); }
60 64
61 void contextMenuItemSelected(const ContextMenuItem*); 65 void contextMenuItemSelected(const ContextMenuItem*);
62 66
63 const HitTestResult& hitTestResult() { return m_hitTestResult; } 67 const HitTestResult& hitTestResult() { return m_hitTestResult; }
64 68
65 private: 69 private:
66 ContextMenuController(Page*, ContextMenuClient*); 70 ContextMenuController(Page*, ContextMenuClient*);
67 71
68 PassOwnPtr<ContextMenu> createContextMenu(Event*); 72 PassOwnPtr<ContextMenu> createContextMenu(Event*);
69 PassOwnPtr<ContextMenu> createContextMenu(LocalFrame*, const LayoutPoint &); 73 PassOwnPtr<ContextMenu> createContextMenu(LocalFrame*, const LayoutPoint &);
74 void populateContextMenuItems(const HTMLMenuElement&, ContextMenu&);
70 void showContextMenu(Event*); 75 void showContextMenu(Event*);
71 76
72 ContextMenuClient* m_client; 77 ContextMenuClient* m_client;
73 OwnPtr<ContextMenu> m_contextMenu; 78 OwnPtr<ContextMenu> m_contextMenu;
74 RefPtr<ContextMenuProvider> m_menuProvider; 79 RefPtr<ContextMenuProvider> m_menuProvider;
80 RefPtr<HTMLElement> m_subject;
tkent 2014/07/31 06:07:56 Someone needs to clear m_subject and m_menuItems a
pals 2014/08/01 10:03:08 Done. Clearing at CustomContextMenuProvider::conte
81 Vector<HTMLElement*> m_menuItems;
75 HitTestResult m_hitTestResult; 82 HitTestResult m_hitTestResult;
76 }; 83 };
77 84
78 } 85 }
79 86
80 #endif 87 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698