| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_UI_COCOA_PERMISSION_BUBBLE_COCOA_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_PERMISSION_BUBBLE_COCOA_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_PERMISSION_BUBBLE_COCOA_H_ | 6 #define CHROME_BROWSER_UI_COCOA_PERMISSION_BUBBLE_COCOA_H_ |
| 7 | 7 |
| 8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
| 9 | 9 |
| 10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| 11 #include "base/mac/scoped_nsobject.h" | 11 #include "base/mac/scoped_nsobject.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "chrome/browser/ui/cocoa/info_bubble_view.h" | 14 #include "chrome/browser/ui/cocoa/info_bubble_view.h" |
| 15 #include "chrome/browser/ui/website_settings/permission_bubble_view.h" | 15 #include "components/bubble/bubble_ui.h" |
| 16 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
| 17 | 17 |
| 18 class Browser; | 18 class PermissionBubbleManager; |
| 19 @class PermissionBubbleController; | 19 @class PermissionBubbleController; |
| 20 | 20 |
| 21 class PermissionBubbleCocoa : public PermissionBubbleView { | 21 class PermissionBubbleCocoa : public BubbleUI { |
| 22 public: | 22 public: |
| 23 explicit PermissionBubbleCocoa(Browser* browser); | 23 explicit PermissionBubbleCocoa(PermissionBubbleManager* manager); |
| 24 ~PermissionBubbleCocoa() override; | 24 ~PermissionBubbleCocoa() override; |
| 25 | 25 |
| 26 // PermissionBubbleView interface. | 26 // BubbleUI interface. |
| 27 void Show(const std::vector<PermissionBubbleRequest*>& requests, | 27 void Show() override; |
| 28 const std::vector<bool>& accept_state) override; | |
| 29 void Hide() override; | 28 void Hide() override; |
| 30 bool IsVisible() override; | |
| 31 void SetDelegate(Delegate* delegate) override; | |
| 32 bool CanAcceptRequestUpdate() override; | |
| 33 void UpdateAnchorPosition() override; | 29 void UpdateAnchorPosition() override; |
| 34 gfx::NativeWindow GetNativeWindow() override; | 30 bool CanAcceptUpdate() const override; |
| 35 | 31 |
| 36 // Called when |bubbleController_| is closing. | 32 // Called when |bubbleController_| is closing. |
| 37 void OnBubbleClosing(); | 33 void OnBubbleClosing(); |
| 38 | 34 |
| 39 // Returns the point, in screen coordinates, to which the bubble's arrow | |
| 40 // should point. | |
| 41 NSPoint GetAnchorPoint(); | |
| 42 | |
| 43 info_bubble::BubbleArrowLocation GetArrowLocation(); | |
| 44 | |
| 45 private: | 35 private: |
| 46 FRIEND_TEST_ALL_PREFIXES(PermissionBubbleBrowserTest, | 36 FRIEND_TEST_ALL_PREFIXES(PermissionBubbleBrowserTest, |
| 47 HasLocationBarByDefault); | 37 HasLocationBarByDefault); |
| 48 FRIEND_TEST_ALL_PREFIXES(PermissionBubbleBrowserTest, | 38 FRIEND_TEST_ALL_PREFIXES(PermissionBubbleBrowserTest, |
| 49 FullscreenHasLocationBar); | 39 FullscreenHasLocationBar); |
| 50 FRIEND_TEST_ALL_PREFIXES(PermissionBubbleBrowserTest, AppHasNoLocationBar); | 40 FRIEND_TEST_ALL_PREFIXES(PermissionBubbleBrowserTest, AppHasNoLocationBar); |
| 51 FRIEND_TEST_ALL_PREFIXES(PermissionBubbleKioskBrowserTest, | 41 FRIEND_TEST_ALL_PREFIXES(PermissionBubbleKioskBrowserTest, |
| 52 KioskHasNoLocationBar); | 42 KioskHasNoLocationBar); |
| 53 | 43 |
| 54 Browser* browser_; // Weak. | 44 PermissionBubbleManager* manager_; // Weak. |
| 55 Delegate* delegate_; // Weak. | |
| 56 | 45 |
| 57 // Cocoa-side UI controller for the bubble. Weak, as it will close itself. | 46 // Cocoa-side UI controller for the bubble. Weak, as it will close itself. |
| 58 PermissionBubbleController* bubbleController_; | 47 PermissionBubbleController* bubbleController_; |
| 59 virtual bool HasLocationBar(); | |
| 60 | |
| 61 // Will get the intended parent window for the bubble and will not be NULL. | |
| 62 NSWindow* GetParentWindow(); | |
| 63 | 48 |
| 64 DISALLOW_COPY_AND_ASSIGN(PermissionBubbleCocoa); | 49 DISALLOW_COPY_AND_ASSIGN(PermissionBubbleCocoa); |
| 65 }; | 50 }; |
| 66 | 51 |
| 67 #endif // CHROME_BROWSER_UI_COCOA_PERMISSION_BUBBLE_COCOA_H_ | 52 #endif // CHROME_BROWSER_UI_COCOA_PERMISSION_BUBBLE_COCOA_H_ |
| OLD | NEW |