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