OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <string> | 10 #include <string> |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 #include "components/sessions/core/session_types.h" | 169 #include "components/sessions/core/session_types.h" |
170 #include "components/sessions/core/tab_restore_service.h" | 170 #include "components/sessions/core/tab_restore_service.h" |
171 #include "components/startup_metric_utils/browser/startup_metric_utils.h" | 171 #include "components/startup_metric_utils/browser/startup_metric_utils.h" |
172 #include "components/toolbar/toolbar_model_impl.h" | 172 #include "components/toolbar/toolbar_model_impl.h" |
173 #include "components/translate/core/browser/language_state.h" | 173 #include "components/translate/core/browser/language_state.h" |
174 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 174 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
175 #include "components/zoom/zoom_controller.h" | 175 #include "components/zoom/zoom_controller.h" |
176 #include "content/public/browser/devtools_agent_host.h" | 176 #include "content/public/browser/devtools_agent_host.h" |
177 #include "content/public/browser/interstitial_page.h" | 177 #include "content/public/browser/interstitial_page.h" |
178 #include "content/public/browser/invalidate_type.h" | 178 #include "content/public/browser/invalidate_type.h" |
| 179 #include "content/public/browser/keyboard_event_processing_result.h" |
179 #include "content/public/browser/navigation_controller.h" | 180 #include "content/public/browser/navigation_controller.h" |
180 #include "content/public/browser/navigation_entry.h" | 181 #include "content/public/browser/navigation_entry.h" |
181 #include "content/public/browser/notification_details.h" | 182 #include "content/public/browser/notification_details.h" |
182 #include "content/public/browser/notification_service.h" | 183 #include "content/public/browser/notification_service.h" |
183 #include "content/public/browser/plugin_service.h" | 184 #include "content/public/browser/plugin_service.h" |
184 #include "content/public/browser/render_frame_host.h" | 185 #include "content/public/browser/render_frame_host.h" |
185 #include "content/public/browser/render_process_host.h" | 186 #include "content/public/browser/render_process_host.h" |
186 #include "content/public/browser/render_view_host.h" | 187 #include "content/public/browser/render_view_host.h" |
187 #include "content/public/browser/render_widget_host.h" | 188 #include "content/public/browser/render_widget_host.h" |
188 #include "content/public/browser/render_widget_host_view.h" | 189 #include "content/public/browser/render_widget_host_view.h" |
(...skipping 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1249 // Two differences between this and FocusLocationBar(): | 1250 // Two differences between this and FocusLocationBar(): |
1250 // (1) This doesn't get recorded in user metrics, since it's called | 1251 // (1) This doesn't get recorded in user metrics, since it's called |
1251 // internally. | 1252 // internally. |
1252 // (2) This checks whether the location bar can be focused, and if not, clears | 1253 // (2) This checks whether the location bar can be focused, and if not, clears |
1253 // the focus. FocusLocationBar() is only reached when the location bar is | 1254 // the focus. FocusLocationBar() is only reached when the location bar is |
1254 // focusable, but this may be reached at other times, e.g. while in | 1255 // focusable, but this may be reached at other times, e.g. while in |
1255 // fullscreen mode, where we need to leave focus in a consistent state. | 1256 // fullscreen mode, where we need to leave focus in a consistent state. |
1256 window_->SetFocusToLocationBar(select_all); | 1257 window_->SetFocusToLocationBar(select_all); |
1257 } | 1258 } |
1258 | 1259 |
1259 bool Browser::PreHandleKeyboardEvent(content::WebContents* source, | 1260 content::KeyboardEventProcessingResult Browser::PreHandleKeyboardEvent( |
1260 const NativeWebKeyboardEvent& event, | 1261 content::WebContents* source, |
1261 bool* is_keyboard_shortcut) { | 1262 const NativeWebKeyboardEvent& event) { |
1262 // Forward keyboard events to the manager for fullscreen / mouse lock. This | 1263 // Forward keyboard events to the manager for fullscreen / mouse lock. This |
1263 // may consume the event (e.g., Esc exits fullscreen mode). | 1264 // may consume the event (e.g., Esc exits fullscreen mode). |
1264 // TODO(koz): Write a test for this http://crbug.com/100441. | 1265 // TODO(koz): Write a test for this http://crbug.com/100441. |
1265 if (exclusive_access_manager_->HandleUserKeyPress(event)) | 1266 if (exclusive_access_manager_->HandleUserKeyPress(event)) |
1266 return true; | 1267 return content::KeyboardEventProcessingResult::HANDLED; |
1267 | 1268 |
1268 return window()->PreHandleKeyboardEvent(event, is_keyboard_shortcut); | 1269 return window()->PreHandleKeyboardEvent(event); |
1269 } | 1270 } |
1270 | 1271 |
1271 void Browser::HandleKeyboardEvent(content::WebContents* source, | 1272 void Browser::HandleKeyboardEvent(content::WebContents* source, |
1272 const NativeWebKeyboardEvent& event) { | 1273 const NativeWebKeyboardEvent& event) { |
1273 DevToolsWindow* devtools_window = | 1274 DevToolsWindow* devtools_window = |
1274 DevToolsWindow::GetInstanceForInspectedWebContents(source); | 1275 DevToolsWindow::GetInstanceForInspectedWebContents(source); |
1275 bool handled = false; | 1276 bool handled = false; |
1276 if (devtools_window) | 1277 if (devtools_window) |
1277 handled = devtools_window->ForwardKeyboardEvent(event); | 1278 handled = devtools_window->ForwardKeyboardEvent(event); |
1278 | 1279 |
(...skipping 1358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2637 // new window later, thus we need to navigate the window now. | 2638 // new window later, thus we need to navigate the window now. |
2638 if (contents) { | 2639 if (contents) { |
2639 contents->web_contents()->GetController().LoadURL( | 2640 contents->web_contents()->GetController().LoadURL( |
2640 target_url, content::Referrer(), ui::PAGE_TRANSITION_LINK, | 2641 target_url, content::Referrer(), ui::PAGE_TRANSITION_LINK, |
2641 std::string()); // No extra headers. | 2642 std::string()); // No extra headers. |
2642 } | 2643 } |
2643 } | 2644 } |
2644 | 2645 |
2645 return contents != NULL; | 2646 return contents != NULL; |
2646 } | 2647 } |
OLD | NEW |