OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #include "chrome/browser/tab_contents/tab_contents_view_mac.h" | 5 #include "chrome/browser/tab_contents/tab_contents_view_mac.h" |
6 | 6 |
7 #include "chrome/browser/browser.h" // TODO(beng): this dependency is awful. | 7 #include "chrome/browser/browser.h" // TODO(beng): this dependency is awful. |
8 #include "chrome/browser/cocoa/sad_tab_view.h" | 8 #include "chrome/browser/cocoa/sad_tab_view.h" |
9 #include "chrome/browser/renderer_host/render_widget_host.h" | 9 #include "chrome/browser/renderer_host/render_widget_host.h" |
10 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" | 10 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 100 |
101 void TabContentsViewMac::SizeContents(const gfx::Size& size) { | 101 void TabContentsViewMac::SizeContents(const gfx::Size& size) { |
102 // TODO(brettw) this is a hack and should be removed. See tab_contents_view.h. | 102 // TODO(brettw) this is a hack and should be removed. See tab_contents_view.h. |
103 NOTIMPLEMENTED(); // Leaving the hack unimplemented. | 103 NOTIMPLEMENTED(); // Leaving the hack unimplemented. |
104 } | 104 } |
105 | 105 |
106 void TabContentsViewMac::Focus() { | 106 void TabContentsViewMac::Focus() { |
107 } | 107 } |
108 | 108 |
109 void TabContentsViewMac::SetInitialFocus() { | 109 void TabContentsViewMac::SetInitialFocus() { |
110 // TODO(port) | 110 // TODO(port): Set focus in the else case correctly. |
| 111 if (web_contents()->FocusLocationBarByDefault()) |
| 112 web_contents()->delegate()->SetFocusToLocationBar(); |
111 } | 113 } |
112 | 114 |
113 void TabContentsViewMac::StoreFocus() { | 115 void TabContentsViewMac::StoreFocus() { |
114 // TODO(port) | 116 // TODO(port) |
115 } | 117 } |
116 | 118 |
117 void TabContentsViewMac::RestoreFocus() { | 119 void TabContentsViewMac::RestoreFocus() { |
118 // TODO(port) | 120 // TODO(port) |
| 121 // For now just assume we are viewing the tab for the first time. |
| 122 SetInitialFocus(); |
119 } | 123 } |
120 | 124 |
121 void TabContentsViewMac::UpdateDragCursor(bool is_drop_target) { | 125 void TabContentsViewMac::UpdateDragCursor(bool is_drop_target) { |
122 NOTIMPLEMENTED(); | 126 NOTIMPLEMENTED(); |
123 } | 127 } |
124 | 128 |
125 void TabContentsViewMac::TakeFocus(bool reverse) { | 129 void TabContentsViewMac::TakeFocus(bool reverse) { |
126 [cocoa_view_.get() becomeFirstResponder]; | 130 [cocoa_view_.get() becomeFirstResponder]; |
127 } | 131 } |
128 | 132 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 } | 238 } |
235 | 239 |
236 - (void)paste:(id)sender { | 240 - (void)paste:(id)sender { |
237 TabContentsView_->web_contents()->Paste(); | 241 TabContentsView_->web_contents()->Paste(); |
238 } | 242 } |
239 | 243 |
240 // Tons of stuff goes here, where we grab events going on in Cocoaland and send | 244 // Tons of stuff goes here, where we grab events going on in Cocoaland and send |
241 // them into the C++ system. TODO(avi): all that jazz | 245 // them into the C++ system. TODO(avi): all that jazz |
242 | 246 |
243 @end | 247 @end |
OLD | NEW |