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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 #include "ui/aura_shell/launcher/launcher_model.h" | 114 #include "ui/aura_shell/launcher/launcher_model.h" |
115 #include "ui/aura_shell/shell.h" | 115 #include "ui/aura_shell/shell.h" |
116 #include "ui/gfx/screen.h" | 116 #include "ui/gfx/screen.h" |
117 #elif defined(OS_WIN) | 117 #elif defined(OS_WIN) |
118 #include "chrome/browser/aeropeek_manager.h" | 118 #include "chrome/browser/aeropeek_manager.h" |
119 #include "chrome/browser/jumplist_win.h" | 119 #include "chrome/browser/jumplist_win.h" |
120 #include "ui/base/message_box_win.h" | 120 #include "ui/base/message_box_win.h" |
121 #include "ui/views/widget/native_widget_win.h" | 121 #include "ui/views/widget/native_widget_win.h" |
122 #elif defined(TOOLKIT_USES_GTK) | 122 #elif defined(TOOLKIT_USES_GTK) |
123 #include "chrome/browser/ui/views/accelerator_table.h" | 123 #include "chrome/browser/ui/views/accelerator_table.h" |
124 #if !defined(TOUCH_UI) | |
125 #include "chrome/browser/ui/views/handle_web_keyboard_event.h" | 124 #include "chrome/browser/ui/views/handle_web_keyboard_event.h" |
126 #endif | 125 #endif |
127 #endif | |
128 | 126 |
129 #if defined(OS_CHROMEOS) | 127 #if defined(OS_CHROMEOS) |
130 #include "chrome/browser/ui/views/keyboard_overlay_dialog_view.h" | 128 #include "chrome/browser/ui/views/keyboard_overlay_dialog_view.h" |
131 #include "chrome/browser/ui/webui/chromeos/mobile_setup_dialog.h" | 129 #include "chrome/browser/ui/webui/chromeos/mobile_setup_dialog.h" |
132 #endif | 130 #endif |
133 | 131 |
134 #if !defined(OS_CHROMEOS) || defined(USE_AURA) | 132 #if !defined(OS_CHROMEOS) || defined(USE_AURA) |
135 #include "chrome/browser/ui/views/download/download_shelf_view.h" | 133 #include "chrome/browser/ui/views/download/download_shelf_view.h" |
136 #endif | 134 #endif |
137 | 135 |
(...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1209 event.modifiers == NativeWebKeyboardEvent::AltKey) { | 1207 event.modifiers == NativeWebKeyboardEvent::AltKey) { |
1210 DefWindowProc(event.os_event.hwnd, event.os_event.message, | 1208 DefWindowProc(event.os_event.hwnd, event.os_event.message, |
1211 event.os_event.wParam, event.os_event.lParam); | 1209 event.os_event.wParam, event.os_event.lParam); |
1212 return true; | 1210 return true; |
1213 } | 1211 } |
1214 #endif | 1212 #endif |
1215 | 1213 |
1216 views::FocusManager* focus_manager = GetFocusManager(); | 1214 views::FocusManager* focus_manager = GetFocusManager(); |
1217 DCHECK(focus_manager); | 1215 DCHECK(focus_manager); |
1218 | 1216 |
1219 #if defined(TOOLKIT_USES_GTK) && !defined(TOUCH_UI) | 1217 #if defined(TOOLKIT_USES_GTK) |
1220 // Views and WebKit use different tables for GdkEventKey -> views::KeyEvent | 1218 // Views and WebKit use different tables for GdkEventKey -> views::KeyEvent |
1221 // conversion. We need to use View's conversion table here to keep consistent | 1219 // conversion. We need to use View's conversion table here to keep consistent |
1222 // behavior with views::FocusManager::OnKeyEvent() method. | 1220 // behavior with views::FocusManager::OnKeyEvent() method. |
1223 // TODO(suzhe): We need to check if Windows code also has this issue, and | 1221 // TODO(suzhe): We need to check if Windows code also has this issue, and |
1224 // it'll be best if we can unify these conversion tables. | 1222 // it'll be best if we can unify these conversion tables. |
1225 // See http://crbug.com/54315 | 1223 // See http://crbug.com/54315 |
1226 views::KeyEvent views_event(reinterpret_cast<GdkEvent*>(event.os_event)); | 1224 views::KeyEvent views_event(reinterpret_cast<GdkEvent*>(event.os_event)); |
1227 ui::Accelerator accelerator(views_event.key_code(), | 1225 ui::Accelerator accelerator(views_event.key_code(), |
1228 views_event.IsShiftDown(), | 1226 views_event.IsShiftDown(), |
1229 views_event.IsControlDown(), | 1227 views_event.IsControlDown(), |
(...skipping 26 matching lines...) Expand all Loading... |
1256 // Then we can retrieve the command id from the |browser_| object. | 1254 // Then we can retrieve the command id from the |browser_| object. |
1257 browser_->SetBlockCommandExecution(true); | 1255 browser_->SetBlockCommandExecution(true); |
1258 focus_manager->ProcessAccelerator(accelerator); | 1256 focus_manager->ProcessAccelerator(accelerator); |
1259 int id = browser_->GetLastBlockedCommand(NULL); | 1257 int id = browser_->GetLastBlockedCommand(NULL); |
1260 browser_->SetBlockCommandExecution(false); | 1258 browser_->SetBlockCommandExecution(false); |
1261 | 1259 |
1262 if (id == -1) | 1260 if (id == -1) |
1263 return false; | 1261 return false; |
1264 | 1262 |
1265 // Executing the command may cause |this| object to be destroyed. | 1263 // Executing the command may cause |this| object to be destroyed. |
1266 #if defined(TOOLKIT_USES_GTK) && !defined(TOUCH_UI) | 1264 #if defined(TOOLKIT_USES_GTK) |
1267 if (browser_->IsReservedCommandOrKey(id, event) && | 1265 if (browser_->IsReservedCommandOrKey(id, event) && |
1268 !event.match_edit_command) { | 1266 !event.match_edit_command) { |
1269 #else | 1267 #else |
1270 if (browser_->IsReservedCommandOrKey(id, event)) { | 1268 if (browser_->IsReservedCommandOrKey(id, event)) { |
1271 #endif | 1269 #endif |
1272 UpdateAcceleratorMetrics(accelerator, id); | 1270 UpdateAcceleratorMetrics(accelerator, id); |
1273 return browser_->ExecuteCommandIfEnabled(id); | 1271 return browser_->ExecuteCommandIfEnabled(id); |
1274 } | 1272 } |
1275 | 1273 |
1276 DCHECK(is_keyboard_shortcut != NULL); | 1274 DCHECK(is_keyboard_shortcut != NULL); |
1277 *is_keyboard_shortcut = true; | 1275 *is_keyboard_shortcut = true; |
1278 | 1276 |
1279 return false; | 1277 return false; |
1280 } | 1278 } |
1281 | 1279 |
1282 void BrowserView::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { | 1280 void BrowserView::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { |
1283 // TODO(ben): figure out why are these two code paths so different | 1281 // TODO(ben): figure out why are these two code paths so different |
1284 #if defined(TOOLKIT_USES_GTK) && !defined(TOUCH_UI) | 1282 #if defined(TOOLKIT_USES_GTK) |
1285 HandleWebKeyboardEvent(GetWidget(), event); | 1283 HandleWebKeyboardEvent(GetWidget(), event); |
1286 #else | 1284 #else |
1287 unhandled_keyboard_event_handler_.HandleKeyboardEvent(event, | 1285 unhandled_keyboard_event_handler_.HandleKeyboardEvent(event, |
1288 GetFocusManager()); | 1286 GetFocusManager()); |
1289 #endif | 1287 #endif |
1290 } | 1288 } |
1291 | 1289 |
1292 // TODO(devint): http://b/issue?id=1117225 Cut, Copy, and Paste are always | 1290 // TODO(devint): http://b/issue?id=1117225 Cut, Copy, and Paste are always |
1293 // enabled in the page menu regardless of whether the command will do | 1291 // enabled in the page menu regardless of whether the command will do |
1294 // anything. When someone selects the menu item, we just act as if they hit | 1292 // anything. When someone selects the menu item, we just act as if they hit |
(...skipping 1366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2661 browser::CreateViewsBubble(bubble); | 2659 browser::CreateViewsBubble(bubble); |
2662 bubble->SetAlignment(views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE); | 2660 bubble->SetAlignment(views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE); |
2663 bubble->Show(); | 2661 bubble->Show(); |
2664 } | 2662 } |
2665 | 2663 |
2666 void BrowserView::ShowAvatarBubbleFromAvatarButton() { | 2664 void BrowserView::ShowAvatarBubbleFromAvatarButton() { |
2667 AvatarMenuButton* button = frame_->GetAvatarMenuButton(); | 2665 AvatarMenuButton* button = frame_->GetAvatarMenuButton(); |
2668 if (button) | 2666 if (button) |
2669 button->ShowAvatarBubble(); | 2667 button->ShowAvatarBubble(); |
2670 } | 2668 } |
OLD | NEW |