OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/shell/browser/shell.h" | 5 #include "content/shell/browser/shell.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #import "base/mac/scoped_nsobject.h" | 10 #import "base/mac/scoped_nsobject.h" |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 break; | 296 break; |
297 case IDC_NAV_RELOAD: | 297 case IDC_NAV_RELOAD: |
298 Reload(); | 298 Reload(); |
299 break; | 299 break; |
300 case IDC_NAV_STOP: | 300 case IDC_NAV_STOP: |
301 Stop(); | 301 Stop(); |
302 break; | 302 break; |
303 } | 303 } |
304 } | 304 } |
305 | 305 |
306 void Shell::URLEntered(std::string url_string) { | 306 void Shell::URLEntered(const std::string& url_string) { |
307 if (!url_string.empty()) { | 307 if (!url_string.empty()) { |
308 GURL url(url_string); | 308 GURL url(url_string); |
309 if (!url.has_scheme()) | 309 if (!url.has_scheme()) |
310 url = GURL("http://" + url_string); | 310 url = GURL("http://" + url_string); |
311 LoadURL(url); | 311 LoadURL(url); |
312 } | 312 } |
313 } | 313 } |
314 | 314 |
315 void Shell::HandleKeyboardEvent(WebContents* source, | 315 void Shell::HandleKeyboardEvent(WebContents* source, |
316 const NativeWebKeyboardEvent& event) { | 316 const NativeWebKeyboardEvent& event) { |
317 if (event.skip_in_browser) | 317 if (event.skip_in_browser) |
318 return; | 318 return; |
319 | 319 |
320 // The event handling to get this strictly right is a tangle; cheat here a bit | 320 // The event handling to get this strictly right is a tangle; cheat here a bit |
321 // by just letting the menus have a chance at it. | 321 // by just letting the menus have a chance at it. |
322 if ([event.os_event type] == NSKeyDown) { | 322 if ([event.os_event type] == NSKeyDown) { |
323 if (([event.os_event modifierFlags] & NSCommandKeyMask) && | 323 if (([event.os_event modifierFlags] & NSCommandKeyMask) && |
324 [[event.os_event characters] isEqual:@"l"]) { | 324 [[event.os_event characters] isEqual:@"l"]) { |
325 [window_ makeFirstResponder:url_edit_view_]; | 325 [window_ makeFirstResponder:url_edit_view_]; |
326 return; | 326 return; |
327 } | 327 } |
328 | 328 |
329 [[NSApp mainMenu] performKeyEquivalent:event.os_event]; | 329 [[NSApp mainMenu] performKeyEquivalent:event.os_event]; |
330 } | 330 } |
331 } | 331 } |
332 | 332 |
333 } // namespace content | 333 } // namespace content |
OLD | NEW |