Save errno for logging before potentially overwriting it.
[chromium-blink-merge.git] / content / browser / renderer_host / popup_menu_helper_mac.h
blobfa143cb14e64f5222da8e19b84b131f3d105cd46
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_POPUP_MENU_HELPER_MAC_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_POPUP_MENU_HELPER_MAC_H_
8 #include <vector>
10 #include "base/compiler_specific.h"
11 #include "content/common/content_export.h"
12 #include "content/public/browser/notification_observer.h"
13 #include "content/public/browser/notification_registrar.h"
14 #include "ui/gfx/rect.h"
16 struct WebMenuItem;
18 namespace content {
19 class RenderViewHost;
20 class RenderViewHostImpl;
21 class RenderWidgetHostViewMac;
23 class PopupMenuHelper : public NotificationObserver {
24 public:
25 // Creates a PopupMenuHelper that will notify |render_view_host| when a user
26 // selects or cancels the popup.
27 explicit PopupMenuHelper(RenderViewHost* render_view_host);
29 // Shows the popup menu and notifies the RenderViewHost of the selection/
30 // cancel.
31 // This call is blocking.
32 void ShowPopupMenu(const gfx::Rect& bounds,
33 int item_height,
34 double item_font_size,
35 int selected_item,
36 const std::vector<WebMenuItem>& items,
37 bool right_aligned,
38 bool allow_multiple_selection);
40 // Immediately return from ShowPopupMenu.
41 CONTENT_EXPORT static void DontShowPopupMenuForTesting();
43 protected:
44 virtual RenderWidgetHostViewMac* GetRenderWidgetHostView() const;
46 // NotificationObserver implementation:
47 virtual void Observe(int type,
48 const NotificationSource& source,
49 const NotificationDetails& details) OVERRIDE;
51 NotificationRegistrar notification_registrar_;
53 RenderViewHostImpl* render_view_host_;
55 DISALLOW_COPY_AND_ASSIGN(PopupMenuHelper);
58 } // namespace content
60 #endif // CONTENT_BROWSER_RENDERER_HOST_POPUP_MENU_HELPER_MAC_H_