summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/cocoa/website_settings/permission_bubble_cocoa.h
blob: c770d4e56d450d79a0dccf8303466d9e032a162c (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
// Copyright 2014 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_UI_COCOA_PERMISSION_BUBBLE_COCOA_H_
#define CHROME_BROWSER_UI_COCOA_PERMISSION_BUBBLE_COCOA_H_

#include "base/mac/scoped_nsobject.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "chrome/browser/ui/website_settings/permission_bubble_view.h"
#include "content/public/browser/web_contents.h"

#ifdef __OBJC__
@class PermissionBubbleController;
#else
class PermissionBubbleController;
#endif

class PermissionBubbleCocoa : public PermissionBubbleView {
 public:
  explicit PermissionBubbleCocoa(NSWindow* parent_window);
  virtual ~PermissionBubbleCocoa();

  // PermissionBubbleView interface.
  virtual void Show(const std::vector<PermissionBubbleRequest*>& requests,
                    const std::vector<bool>& accept_state,
                    bool customization_mode) OVERRIDE;
  virtual void Hide() OVERRIDE;
  virtual bool IsVisible() OVERRIDE;
  virtual void SetDelegate(Delegate* delegate) OVERRIDE;
  virtual bool CanAcceptRequestUpdate() OVERRIDE;

  // Called when |bubbleController_| is closing.
  void OnBubbleClosing();

  // Returns the point, in screen coordinates, to which the bubble's arrow
  // should point.
  NSPoint GetAnchorPoint();

  // Returns the NSWindow containing the bubble.
  NSWindow* window();

private:
  NSWindow* parent_window_;  // Weak.
  Delegate* delegate_;  // Weak.

  // Cocoa-side UI controller for the bubble.  Weak, as it will close itself.
  PermissionBubbleController* bubbleController_;

  DISALLOW_COPY_AND_ASSIGN(PermissionBubbleCocoa);
};

#endif  // CHROME_BROWSER_UI_COCOA_PERMISSION_BUBBLE_COCOA_H_