| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/views/frame/browser_view.h" | 5 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 6 | 6 |
| 7 #if defined(TOOLKIT_USES_GTK) | 7 #if defined(TOOLKIT_USES_GTK) |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 1226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1237 event.modifiers == NativeWebKeyboardEvent::AltKey) { | 1237 event.modifiers == NativeWebKeyboardEvent::AltKey) { |
| 1238 DefWindowProc(event.os_event.hwnd, event.os_event.message, | 1238 DefWindowProc(event.os_event.hwnd, event.os_event.message, |
| 1239 event.os_event.wParam, event.os_event.lParam); | 1239 event.os_event.wParam, event.os_event.lParam); |
| 1240 return true; | 1240 return true; |
| 1241 } | 1241 } |
| 1242 #endif | 1242 #endif |
| 1243 | 1243 |
| 1244 views::FocusManager* focus_manager = GetFocusManager(); | 1244 views::FocusManager* focus_manager = GetFocusManager(); |
| 1245 DCHECK(focus_manager); | 1245 DCHECK(focus_manager); |
| 1246 | 1246 |
| 1247 #if defined(TOOLKIT_USES_GTK) && !defined(TOUCH_UI) | 1247 #if defined(TOOLKIT_USES_GTK) && !(defined(TOUCH_UI) || defined(USE_AURA)) |
| 1248 // Views and WebKit use different tables for GdkEventKey -> views::KeyEvent | 1248 // Views and WebKit use different tables for GdkEventKey -> views::KeyEvent |
| 1249 // conversion. We need to use View's conversion table here to keep consistent | 1249 // conversion. We need to use View's conversion table here to keep consistent |
| 1250 // behavior with views::FocusManager::OnKeyEvent() method. | 1250 // behavior with views::FocusManager::OnKeyEvent() method. |
| 1251 // TODO(suzhe): We need to check if Windows code also has this issue, and | 1251 // TODO(suzhe): We need to check if Windows code also has this issue, and |
| 1252 // it'll be best if we can unify these conversion tables. | 1252 // it'll be best if we can unify these conversion tables. |
| 1253 // See http://crbug.com/54315 | 1253 // See http://crbug.com/54315 |
| 1254 views::KeyEvent views_event(reinterpret_cast<GdkEvent*>(event.os_event)); | 1254 views::KeyEvent views_event(reinterpret_cast<GdkEvent*>(event.os_event)); |
| 1255 views::Accelerator accelerator(views_event.key_code(), | 1255 views::Accelerator accelerator(views_event.key_code(), |
| 1256 views_event.IsShiftDown(), | 1256 views_event.IsShiftDown(), |
| 1257 views_event.IsControlDown(), | 1257 views_event.IsControlDown(), |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1302 } | 1302 } |
| 1303 | 1303 |
| 1304 DCHECK(is_keyboard_shortcut != NULL); | 1304 DCHECK(is_keyboard_shortcut != NULL); |
| 1305 *is_keyboard_shortcut = true; | 1305 *is_keyboard_shortcut = true; |
| 1306 | 1306 |
| 1307 return false; | 1307 return false; |
| 1308 } | 1308 } |
| 1309 | 1309 |
| 1310 void BrowserView::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { | 1310 void BrowserView::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { |
| 1311 // TODO(ben): figure out why are these two code paths so different | 1311 // TODO(ben): figure out why are these two code paths so different |
| 1312 #if defined(TOOLKIT_USES_GTK) && !defined(TOUCH_UI) | 1312 #if defined(TOOLKIT_USES_GTK) && !(defined(TOUCH_UI) || defined(USE_AURA)) |
| 1313 HandleWebKeyboardEvent(GetWidget(), event); | 1313 HandleWebKeyboardEvent(GetWidget(), event); |
| 1314 #else | 1314 #else |
| 1315 unhandled_keyboard_event_handler_.HandleKeyboardEvent(event, | 1315 unhandled_keyboard_event_handler_.HandleKeyboardEvent(event, |
| 1316 GetFocusManager()); | 1316 GetFocusManager()); |
| 1317 #endif | 1317 #endif |
| 1318 } | 1318 } |
| 1319 | 1319 |
| 1320 void BrowserView::ToggleUseCompactNavigationBar() { | 1320 void BrowserView::ToggleUseCompactNavigationBar() { |
| 1321 bool use_compact_navigation_bar = UseCompactNavigationBar(); | 1321 bool use_compact_navigation_bar = UseCompactNavigationBar(); |
| 1322 // Compact Navigation Bar only works with horizontal tabs for now! | 1322 // Compact Navigation Bar only works with horizontal tabs for now! |
| (...skipping 1382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2705 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { | 2705 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { |
| 2706 // Create the view and the frame. The frame will attach itself via the view | 2706 // Create the view and the frame. The frame will attach itself via the view |
| 2707 // so we don't need to do anything with the pointer. | 2707 // so we don't need to do anything with the pointer. |
| 2708 BrowserView* view = new BrowserView(browser); | 2708 BrowserView* view = new BrowserView(browser); |
| 2709 (new BrowserFrame(view))->InitBrowserFrame(); | 2709 (new BrowserFrame(view))->InitBrowserFrame(); |
| 2710 view->GetWidget()->non_client_view()->SetAccessibleName( | 2710 view->GetWidget()->non_client_view()->SetAccessibleName( |
| 2711 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); | 2711 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); |
| 2712 return view; | 2712 return view; |
| 2713 } | 2713 } |
| 2714 #endif | 2714 #endif |
| OLD | NEW |