summaryrefslogtreecommitdiffstats
path: root/chrome/browser/browser_window_cocoa.mm
blob: d178f0209be88d82c1c03a873d92fd81284b622c (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
// 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];
}

BrowserWindowTesting* BrowserWindowCocoa::GetBrowserWindowTesting() {
  return NULL;
}

StatusBubble* BrowserWindowCocoa::GetStatusBubble() {
  return NULL;
}

void BrowserWindowCocoa::SelectedTabToolbarSizeChanged(bool is_animating) {
}

void BrowserWindowCocoa::UpdateTitleBar() {
}

void BrowserWindowCocoa::UpdateLoadingAnimations(bool should_animate) {
}

void BrowserWindowCocoa::SetStarredState(bool is_starred) {
}

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];
}

LocationBar* BrowserWindowCocoa::GetLocationBar() const {
  return NULL;
}

void BrowserWindowCocoa::UpdateStopGoState(bool is_loading) {
}

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() {
}

bool BrowserWindowCocoa::IsBookmarkBubbleVisible() const {
  return false;
}

void BrowserWindowCocoa::ShowBookmarkBubble(const GURL& url,
                                            bool already_bookmarked) {
}

void BrowserWindowCocoa::ShowReportBugDialog() {
}

void BrowserWindowCocoa::ShowClearBrowsingDataDialog() {
}

void BrowserWindowCocoa::ShowImportDialog() {
}

void BrowserWindowCocoa::ShowSearchEnginesDialog() {
}

void BrowserWindowCocoa::ShowPasswordManager() {
}

void BrowserWindowCocoa::ShowSelectProfileDialog() {
}

void BrowserWindowCocoa::ShowNewProfileDialog() {
}

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.
}