OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #endif // OS_WIN | 10 #endif // OS_WIN |
(...skipping 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1165 // Close the frame after we return to the message loop (not immediately, | 1165 // Close the frame after we return to the message loop (not immediately, |
1166 // otherwise it will destroy this object before the stack has a chance to | 1166 // otherwise it will destroy this object before the stack has a chance to |
1167 // cleanly unwind.) | 1167 // cleanly unwind.) |
1168 // Note: This will be called several times if TabStripEmpty is called several | 1168 // Note: This will be called several times if TabStripEmpty is called several |
1169 // times. This is because it does not close the window if tabs are | 1169 // times. This is because it does not close the window if tabs are |
1170 // still present. | 1170 // still present. |
1171 MessageLoop::current()->PostTask( | 1171 MessageLoop::current()->PostTask( |
1172 FROM_HERE, base::Bind(&Browser::CloseFrame, weak_factory_.GetWeakPtr())); | 1172 FROM_HERE, base::Bind(&Browser::CloseFrame, weak_factory_.GetWeakPtr())); |
1173 } | 1173 } |
1174 | 1174 |
1175 bool Browser::PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, | 1175 bool Browser::PreHandleKeyboardEvent(content::WebContents* source, |
| 1176 const NativeWebKeyboardEvent& event, |
1176 bool* is_keyboard_shortcut) { | 1177 bool* is_keyboard_shortcut) { |
1177 // Escape exits tabbed fullscreen mode. | 1178 // Escape exits tabbed fullscreen mode. |
1178 // TODO(koz): Write a test for this http://crbug.com/100441. | 1179 // TODO(koz): Write a test for this http://crbug.com/100441. |
1179 if (event.windowsKeyCode == 27 && | 1180 if (event.windowsKeyCode == 27 && |
1180 fullscreen_controller_->HandleUserPressedEscape()) { | 1181 fullscreen_controller_->HandleUserPressedEscape()) { |
1181 return true; | 1182 return true; |
1182 } | 1183 } |
1183 return window()->PreHandleKeyboardEvent(event, is_keyboard_shortcut); | 1184 return window()->PreHandleKeyboardEvent(event, is_keyboard_shortcut); |
1184 } | 1185 } |
1185 | 1186 |
1186 void Browser::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { | 1187 void Browser::HandleKeyboardEvent(content::WebContents* source, |
| 1188 const NativeWebKeyboardEvent& event) { |
1187 window()->HandleKeyboardEvent(event); | 1189 window()->HandleKeyboardEvent(event); |
1188 } | 1190 } |
1189 | 1191 |
1190 bool Browser::TabsNeedBeforeUnloadFired() { | 1192 bool Browser::TabsNeedBeforeUnloadFired() { |
1191 return unload_controller_->TabsNeedBeforeUnloadFired(); | 1193 return unload_controller_->TabsNeedBeforeUnloadFired(); |
1192 } | 1194 } |
1193 | 1195 |
1194 bool Browser::IsMouseLocked() const { | 1196 bool Browser::IsMouseLocked() const { |
1195 return fullscreen_controller_->IsMouseLocked(); | 1197 return fullscreen_controller_->IsMouseLocked(); |
1196 } | 1198 } |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1351 } | 1353 } |
1352 | 1354 |
1353 void Browser::ContentsZoomChange(bool zoom_in) { | 1355 void Browser::ContentsZoomChange(bool zoom_in) { |
1354 chrome::ExecuteCommand(this, zoom_in ? IDC_ZOOM_PLUS : IDC_ZOOM_MINUS); | 1356 chrome::ExecuteCommand(this, zoom_in ? IDC_ZOOM_PLUS : IDC_ZOOM_MINUS); |
1355 } | 1357 } |
1356 | 1358 |
1357 void Browser::WebContentsFocused(WebContents* contents) { | 1359 void Browser::WebContentsFocused(WebContents* contents) { |
1358 window_->WebContentsFocused(contents); | 1360 window_->WebContentsFocused(contents); |
1359 } | 1361 } |
1360 | 1362 |
1361 bool Browser::TakeFocus(bool reverse) { | 1363 bool Browser::TakeFocus(content::WebContents* source, |
| 1364 bool reverse) { |
1362 content::NotificationService::current()->Notify( | 1365 content::NotificationService::current()->Notify( |
1363 chrome::NOTIFICATION_FOCUS_RETURNED_TO_BROWSER, | 1366 chrome::NOTIFICATION_FOCUS_RETURNED_TO_BROWSER, |
1364 content::Source<Browser>(this), | 1367 content::Source<Browser>(this), |
1365 content::NotificationService::NoDetails()); | 1368 content::NotificationService::NoDetails()); |
1366 return false; | 1369 return false; |
1367 } | 1370 } |
1368 | 1371 |
1369 bool Browser::IsApplication() const { | 1372 bool Browser::IsApplication() const { |
1370 return is_app(); | 1373 return is_app(); |
1371 } | 1374 } |
(...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2292 if (contents && !allow_js_access) { | 2295 if (contents && !allow_js_access) { |
2293 contents->web_contents()->GetController().LoadURL( | 2296 contents->web_contents()->GetController().LoadURL( |
2294 target_url, | 2297 target_url, |
2295 content::Referrer(), | 2298 content::Referrer(), |
2296 content::PAGE_TRANSITION_LINK, | 2299 content::PAGE_TRANSITION_LINK, |
2297 std::string()); // No extra headers. | 2300 std::string()); // No extra headers. |
2298 } | 2301 } |
2299 | 2302 |
2300 return contents != NULL; | 2303 return contents != NULL; |
2301 } | 2304 } |
OLD | NEW |