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

Unified Diff: chrome/browser/ui/cocoa/browser/zoom_bubble_controller.h

Issue 12286006: [Mac] Implement the basic zoom bubble. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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/browser/zoom_bubble_controller.h
diff --git a/chrome/browser/ui/cocoa/browser/zoom_bubble_controller.h b/chrome/browser/ui/cocoa/browser/zoom_bubble_controller.h
new file mode 100644
index 0000000000000000000000000000000000000000..b59e8cacac96f0e31da8f3152c6d71cfddd1fcb4
--- /dev/null
+++ b/chrome/browser/ui/cocoa/browser/zoom_bubble_controller.h
@@ -0,0 +1,56 @@
+// Copyright (c) 2013 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_BROWSER_ZOOM_BUBBLE_CONTROLLER_H_
+#define CHROME_BROWSER_UI_COCOA_BROWSER_ZOOM_BUBBLE_CONTROLLER_H_
+
+#include "base/mac/scoped_block.h"
+#include "base/memory/scoped_nsobject.h"
+#include "chrome/browser/ui/cocoa/base_bubble_controller.h"
+
+namespace content {
+class WebContents;
+}
+
+// The ZoomBubbleController is used to display the current page zoom percent
+// when not at the user's default. It is opened by the ZoomDecoration in the
+// location bar.
+@interface ZoomBubbleController : BaseBubbleController {
+ @private
+ // The contents for which the zoom percent is being displayed.
+ content::WebContents* contents_;
+
+ // Whether or not the bubble should automatically close itself after being
+ // opened.
+ BOOL autoClose_;
+
+ // A block that is run when the bubble is being closed. This allows any
+ // weak references to be niled.
+ base::mac::ScopedBlock<void(^)(ZoomBubbleController*)> closeObserver_;
+
+ // The text field that displays the current zoom percentage.
+ scoped_nsobject<NSTextField> zoomPercent_;
+}
+
+// Creates the bubble for a parent window but does not show it.
+- (id)initWithParentWindow:(NSWindow*)parentWindow
+ closeObserver:(void(^)(ZoomBubbleController*))closeObserver;
+
+// Shows the bubble for a given contents at an |anchorPoint| in window
+// coordinates. If |autoClose| is YES, then the bubble was opened in response
+// to a zoom change rather than a direct user action, and it will automatically
+// dismiss itself after a few seconds.
+- (void)showForWebContents:(content::WebContents*)contents
+ anchoredAt:(NSPoint)anchorPoint
+ autoClose:(BOOL)autoClose;
+
+// Called by the ZoomDecoration when the zoom percentage changes.
+- (void)onZoomChanged;
+
+// Button action from the bubble that resets the zoom level to the default.
+- (void)resetToDefault:(id)sender;
+
+@end
+
+#endif // CHROME_BROWSER_UI_COCOA_BROWSER_ZOOM_BUBBLE_CONTROLLER_H_

Powered by Google App Engine
This is Rietveld 408576698