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

Unified Diff: chrome/browser/ui/cocoa/extensions/chooser_dialog_cocoa.h

Issue 2005443002: Implement bluetooth chooser for Chrome Apps on Mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@refactor_chooser_bubble_ui_cocoa
Patch Set: rebase and address comments Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/extensions/chooser_dialog_cocoa.h
diff --git a/chrome/browser/ui/cocoa/extensions/chooser_dialog_cocoa.h b/chrome/browser/ui/cocoa/extensions/chooser_dialog_cocoa.h
new file mode 100644
index 0000000000000000000000000000000000000000..72656f1684c913530f41b9833590a720c6c561c1
--- /dev/null
+++ b/chrome/browser/ui/cocoa/extensions/chooser_dialog_cocoa.h
@@ -0,0 +1,54 @@
+// Copyright 2016 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_EXTENSIONS_CHOOSER_DIALOG_COCOA_H_
+#define CHROME_BROWSER_UI_COCOA_EXTENSIONS_CHOOSER_DIALOG_COCOA_H_
+
+#import <Cocoa/Cocoa.h>
+
+#include "base/mac/scoped_nsobject.h"
+#import "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h"
+#include "components/chooser_controller/chooser_controller.h"
+
+namespace content {
+class WebContents;
+}
+
+@class ChooserDialogCocoaController;
+
+// Displays a chooser dialog as a modal sheet constrained
+// to the window/tab displaying the given web contents.
+class ChooserDialogCocoa : public ConstrainedWindowMacDelegate,
+ public ChooserController::Observer {
+ public:
+ ChooserDialogCocoa(content::WebContents* web_contents,
+ ChooserController* chooser_controller);
+ ~ChooserDialogCocoa() override;
+
+ // ConstrainedWindowMacDelegate:
+ void OnConstrainedWindowClosed(ConstrainedWindowMac* window) override;
+
+ // ChooserController::Observer:
+ void OnOptionsInitialized() override;
+ void OnOptionAdded(size_t index) override;
+ void OnOptionRemoved(size_t index) override;
+
+ // Create and show the modal dialog.
+ void ShowDialog();
+
+ // Call this to close the chooser dialog.
+ void Dismissed();
+
+ content::WebContents* web_contents() const { return web_contents_; }
+
+ private:
+ friend class ChooserDialogCocoaControllerTest;
+ base::scoped_nsobject<ChooserDialogCocoaController>
+ chooser_dialog_cocoa_controller_ = nullptr;
+ std::unique_ptr<ConstrainedWindowMac> constrained_window_ = nullptr;
+ content::WebContents* web_contents_; // Weak.
+ ChooserController* chooser_controller_; // Weak.
+};
+
+#endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_CHOOSER_DIALOG_COCOA_H_

Powered by Google App Engine
This is Rietveld 408576698