OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_BROWSERTEST_UTIL_H_ | 5 #ifndef CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_BROWSERTEST_UTIL_H_ |
6 #define CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_BROWSERTEST_UTIL_H_ | 6 #define CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_BROWSERTEST_UTIL_H_ |
7 #pragma once | |
8 | 7 |
9 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
10 #include "content/public/browser/notification_observer.h" | 9 #include "content/public/browser/notification_observer.h" |
11 #include "content/public/browser/notification_registrar.h" | 10 #include "content/public/browser/notification_registrar.h" |
12 | 11 |
13 class RenderViewContextMenu; | 12 class RenderViewContextMenu; |
14 | 13 |
15 class ContextMenuNotificationObserver : public content::NotificationObserver { | 14 class ContextMenuNotificationObserver : public content::NotificationObserver { |
16 public: | 15 public: |
17 // Wait for a context menu to be shown, and then execute |command_to_execute|. | 16 // Wait for a context menu to be shown, and then execute |command_to_execute|. |
18 explicit ContextMenuNotificationObserver(int command_to_execute); | 17 explicit ContextMenuNotificationObserver(int command_to_execute); |
19 virtual ~ContextMenuNotificationObserver(); | 18 virtual ~ContextMenuNotificationObserver(); |
20 | 19 |
21 private: | 20 private: |
22 virtual void Observe(int type, | 21 virtual void Observe(int type, |
23 const content::NotificationSource& source, | 22 const content::NotificationSource& source, |
24 const content::NotificationDetails& details) OVERRIDE; | 23 const content::NotificationDetails& details) OVERRIDE; |
25 | 24 |
26 void ExecuteCommand(RenderViewContextMenu* context_menu); | 25 void ExecuteCommand(RenderViewContextMenu* context_menu); |
27 | 26 |
28 content::NotificationRegistrar registrar_; | 27 content::NotificationRegistrar registrar_; |
29 int command_to_execute_; | 28 int command_to_execute_; |
30 | 29 |
31 DISALLOW_COPY_AND_ASSIGN(ContextMenuNotificationObserver); | 30 DISALLOW_COPY_AND_ASSIGN(ContextMenuNotificationObserver); |
32 }; | 31 }; |
33 | 32 |
34 #endif // CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_BROWSERTEST_UTIL
_H_ | 33 #endif // CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_BROWSERTEST_UTIL
_H_ |
OLD | NEW |