summaryrefslogtreecommitdiffstats
path: root/chrome/browser/browser_window_cocoa.mm
diff options
context:
space:
mode:
authorpinkerton@google.com <pinkerton@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-21 16:41:33 +0000
committerpinkerton@google.com <pinkerton@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-21 16:41:33 +0000
commit8a53ee044de003495430e48203c8606dbf9aa261 (patch)
treed6171016214fa15a4b586b008a5b75f0e0777a96 /chrome/browser/browser_window_cocoa.mm
parent9c19aa146af6d80de43f00fd109a43bb8f018b24 (diff)
downloadchromium_src-8a53ee044de003495430e48203c8606dbf9aa261.zip
chromium_src-8a53ee044de003495430e48203c8606dbf9aa261.tar.gz
chromium_src-8a53ee044de003495430e48203c8606dbf9aa261.tar.bz2
Get browser window showing using a Browser object and accompanying scaffolding. Adds browser window controller and shim from NSWindow to BrowserWindow.
Review URL: http://codereview.chromium.org/18368 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8364 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_window_cocoa.mm')
-rw-r--r--chrome/browser/browser_window_cocoa.mm141
1 files changed, 141 insertions, 0 deletions
diff --git a/chrome/browser/browser_window_cocoa.mm b/chrome/browser/browser_window_cocoa.mm
new file mode 100644
index 0000000..d3061d9
--- /dev/null
+++ b/chrome/browser/browser_window_cocoa.mm
@@ -0,0 +1,141 @@
+// Copyright (c) 2009 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.
+
+#include "base/gfx/rect.h"
+#include "chrome/browser/browser_window_cocoa.h"
+#include "chrome/browser/browser_window_controller.h"
+
+BrowserWindowCocoa::BrowserWindowCocoa(BrowserWindowController* controller,
+ NSWindow* window)
+ : controller_(controller), window_(window) {
+}
+
+BrowserWindowCocoa::~BrowserWindowCocoa() {
+}
+
+void BrowserWindowCocoa::Init() {
+}
+
+void BrowserWindowCocoa::Show() {
+ [window_ makeKeyAndOrderFront:controller_];
+}
+
+void BrowserWindowCocoa::SetBounds(const gfx::Rect& bounds) {
+ NSRect cocoa_bounds = NSMakeRect(bounds.x(), 0, bounds.width(),
+ bounds.height());
+ // flip coordinates
+ NSScreen* screen = [window_ screen];
+ cocoa_bounds.origin.y =
+ [screen frame].size.height - bounds.height() - bounds.y();
+}
+
+void BrowserWindowCocoa::Close() {
+ [window_ orderOut:controller_];
+}
+
+void BrowserWindowCocoa::Activate() {
+ [window_ makeKeyAndOrderFront:controller_];
+}
+
+void BrowserWindowCocoa::FlashFrame() {
+ [[NSApplication sharedApplication]
+ requestUserAttention:NSInformationalRequest];
+}
+
+void* BrowserWindowCocoa::GetNativeHandle() {
+ return [controller_ window];
+}
+
+TabStrip* BrowserWindowCocoa::GetTabStrip() const {
+ return NULL;
+}
+
+StatusBubble* BrowserWindowCocoa::GetStatusBubble() {
+ return NULL;
+}
+
+void BrowserWindowCocoa::SelectedTabToolbarSizeChanged(bool is_animating) {
+}
+
+void BrowserWindowCocoa::UpdateTitleBar() {
+}
+
+void BrowserWindowCocoa::UpdateLoadingAnimations(bool should_animate) {
+}
+
+gfx::Rect BrowserWindowCocoa::GetNormalBounds() const {
+ // TODO(pinkerton): not sure if we can get the non-zoomed bounds, or if it
+ // really matters. We may want to let Cocoa handle all this for us.
+ NSRect frame = [window_ frame];
+ NSScreen* screen = [window_ screen];
+ gfx::Rect bounds(frame.origin.x, 0, frame.size.width, frame.size.height);
+ bounds.set_y([screen frame].size.height + frame.size.height + frame.origin.y);
+ return bounds;
+}
+
+bool BrowserWindowCocoa::IsMaximized() {
+ return [window_ isZoomed];
+}
+
+ToolbarStarToggle* BrowserWindowCocoa::GetStarButton() const {
+ return NULL;
+}
+
+LocationBarView* BrowserWindowCocoa::GetLocationBarView() const {
+ return NULL;
+}
+
+GoButton* BrowserWindowCocoa::GetGoButton() const {
+ return NULL;
+}
+
+BookmarkBarView* BrowserWindowCocoa::GetBookmarkBarView() {
+ return NULL;
+}
+
+void BrowserWindowCocoa::UpdateToolbar(TabContents* contents,
+ bool should_restore_state) {
+}
+
+void BrowserWindowCocoa::FocusToolbar() {
+}
+
+bool BrowserWindowCocoa::IsBookmarkBarVisible() const {
+ return true;
+}
+
+void BrowserWindowCocoa::ToggleBookmarkBar() {
+}
+
+void BrowserWindowCocoa::ShowAboutChromeDialog() {
+}
+
+void BrowserWindowCocoa::ShowBookmarkManager() {
+}
+
+void BrowserWindowCocoa::ShowReportBugDialog() {
+}
+
+void BrowserWindowCocoa::ShowClearBrowsingDataDialog() {
+}
+
+void BrowserWindowCocoa::ShowImportDialog() {
+}
+
+void BrowserWindowCocoa::ShowSearchEnginesDialog() {
+}
+
+void BrowserWindowCocoa::ShowPasswordManager() {
+}
+
+void BrowserWindowCocoa::ShowHTMLDialog(HtmlDialogContentsDelegate* delegate,
+ void* parent_window) {
+}
+
+void BrowserWindowCocoa::DestroyBrowser() {
+ [controller_ destroyBrowser];
+
+ // at this point the controller is dead (autoreleased), so
+ // make sure we don't try to reference it any more.
+}