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 #import "ios/chrome/browser/ui/toolbar/web_toolbar_controller.h" | 5 #import "ios/chrome/browser/ui/toolbar/web_toolbar_controller.h" |
6 | 6 |
7 #import <CoreLocation/CoreLocation.h> | 7 #import <CoreLocation/CoreLocation.h> |
8 #include <QuartzCore/QuartzCore.h> | 8 #include <QuartzCore/QuartzCore.h> |
9 | 9 |
10 #include <stdint.h> | 10 #include <stdint.h> |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "base/metrics/user_metrics_action.h" | 22 #include "base/metrics/user_metrics_action.h" |
23 #include "base/strings/sys_string_conversions.h" | 23 #include "base/strings/sys_string_conversions.h" |
24 #include "components/google/core/browser/google_util.h" | 24 #include "components/google/core/browser/google_util.h" |
25 #include "components/omnibox/browser/omnibox_edit_model.h" | 25 #include "components/omnibox/browser/omnibox_edit_model.h" |
26 #include "components/search_engines/util.h" | 26 #include "components/search_engines/util.h" |
27 #include "components/strings/grit/components_strings.h" | 27 #include "components/strings/grit/components_strings.h" |
28 #include "components/toolbar/toolbar_model.h" | 28 #include "components/toolbar/toolbar_model.h" |
29 #include "ios/chrome/browser/autocomplete/autocomplete_scheme_classifier_impl.h" | 29 #include "ios/chrome/browser/autocomplete/autocomplete_scheme_classifier_impl.h" |
30 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" | 30 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
31 #include "ios/chrome/browser/chrome_url_constants.h" | 31 #include "ios/chrome/browser/chrome_url_constants.h" |
| 32 #include "ios/chrome/browser/experimental_flags.h" |
32 #include "ios/chrome/browser/reading_list/reading_list_model_factory.h" | 33 #include "ios/chrome/browser/reading_list/reading_list_model_factory.h" |
33 #include "ios/chrome/browser/search_engines/template_url_service_factory.h" | 34 #include "ios/chrome/browser/search_engines/template_url_service_factory.h" |
34 #import "ios/chrome/browser/tabs/tab.h" | 35 #import "ios/chrome/browser/tabs/tab.h" |
35 #import "ios/chrome/browser/tabs/tab_model.h" | 36 #import "ios/chrome/browser/tabs/tab_model.h" |
36 #import "ios/chrome/browser/ui/animation_util.h" | 37 #import "ios/chrome/browser/ui/animation_util.h" |
37 #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h" | 38 #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h" |
38 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h" | 39 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h" |
39 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h" | 40 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h" |
40 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" | 41 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" |
41 #import "ios/chrome/browser/ui/history/tab_history_popup_controller.h" | 42 #import "ios/chrome/browser/ui/history/tab_history_popup_controller.h" |
(...skipping 1432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1474 ->IsVoiceSearchEnabled()) { | 1475 ->IsVoiceSearchEnabled()) { |
1475 base::RecordAction(UserMetricsAction("MobileCustomRowVoiceSearch")); | 1476 base::RecordAction(UserMetricsAction("MobileCustomRowVoiceSearch")); |
1476 GenericChromeCommand* command = | 1477 GenericChromeCommand* command = |
1477 [[GenericChromeCommand alloc] initWithTag:IDC_VOICE_SEARCH]; | 1478 [[GenericChromeCommand alloc] initWithTag:IDC_VOICE_SEARCH]; |
1478 [_keyBoardAccessoryView chromeExecuteCommand:command]; | 1479 [_keyBoardAccessoryView chromeExecuteCommand:command]; |
1479 } else { | 1480 } else { |
1480 _keyBoardAccessoryView.mode = KEY_SHORTCUTS; | 1481 _keyBoardAccessoryView.mode = KEY_SHORTCUTS; |
1481 } | 1482 } |
1482 } | 1483 } |
1483 | 1484 |
| 1485 - (void)keyboardAccessoryCameraSearchTouchUpInside { |
| 1486 GenericChromeCommand* command = |
| 1487 [[GenericChromeCommand alloc] initWithTag:IDC_SHOW_QR_SCANNER]; |
| 1488 [_keyBoardAccessoryView chromeExecuteCommand:command]; |
| 1489 } |
| 1490 |
1484 - (void)keyPressed:(NSString*)title { | 1491 - (void)keyPressed:(NSString*)title { |
1485 NSString* text = [self updateTextForDotCom:title]; | 1492 NSString* text = [self updateTextForDotCom:title]; |
1486 [_omniBox insertTextWhileEditing:text]; | 1493 [_omniBox insertTextWhileEditing:text]; |
1487 } | 1494 } |
1488 | 1495 |
1489 #pragma mark - | 1496 #pragma mark - |
1490 #pragma mark Private methods. | 1497 #pragma mark Private methods. |
1491 | 1498 |
1492 - (UIButton*)cancelButton { | 1499 - (UIButton*)cancelButton { |
1493 if (_cancelButton) | 1500 if (_cancelButton) |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1836 ui::PAGE_TRANSITION_LINK | ui::PAGE_TRANSITION_FROM_ADDRESS_BAR); | 1843 ui::PAGE_TRANSITION_LINK | ui::PAGE_TRANSITION_FROM_ADDRESS_BAR); |
1837 [self.urlLoader loadURL:GURL(searchURL) | 1844 [self.urlLoader loadURL:GURL(searchURL) |
1838 referrer:web::Referrer() | 1845 referrer:web::Referrer() |
1839 transition:transition | 1846 transition:transition |
1840 rendererInitiated:NO]; | 1847 rendererInitiated:NO]; |
1841 } | 1848 } |
1842 } | 1849 } |
1843 | 1850 |
1844 - (UIView*)keyboardAccessoryView { | 1851 - (UIView*)keyboardAccessoryView { |
1845 if (!_keyBoardAccessoryView) { | 1852 if (!_keyBoardAccessoryView) { |
1846 NSArray<NSString*>* buttonTitles = | 1853 NSArray<NSString*>* buttonTitles; |
1847 [NSArray arrayWithObjects:@":", @".", @"-", @"/", kDotComTLD, nil]; | 1854 if (experimental_flags::IsKeyboardAccessoryViewWithCameraSearchEnabled()) { |
| 1855 // The '.' shortcut is left out because the new keyboard accessory view |
| 1856 // has less free space for the shortcut buttons, and the '.' is already |
| 1857 // present in the standard iOS keyboard. |
| 1858 buttonTitles = |
| 1859 [NSArray arrayWithObjects:@":", @"-", @"/", kDotComTLD, nil]; |
| 1860 } else { |
| 1861 buttonTitles = |
| 1862 [NSArray arrayWithObjects:@":", @".", @"-", @"/", kDotComTLD, nil]; |
| 1863 } |
1848 _keyBoardAccessoryView = | 1864 _keyBoardAccessoryView = |
1849 [[KeyboardAccessoryView alloc] initWithButtons:buttonTitles | 1865 [[KeyboardAccessoryView alloc] initWithButtons:buttonTitles |
1850 delegate:self]; | 1866 delegate:self]; |
1851 [_keyBoardAccessoryView | 1867 [_keyBoardAccessoryView |
1852 setAutoresizingMask:UIViewAutoresizingFlexibleWidth]; | 1868 setAutoresizingMask:UIViewAutoresizingFlexibleWidth]; |
1853 _hardwareKeyboardWatcher = [[HardwareKeyboardWatcher alloc] | 1869 _hardwareKeyboardWatcher = [[HardwareKeyboardWatcher alloc] |
1854 initWithAccessoryView:_keyBoardAccessoryView]; | 1870 initWithAccessoryView:_keyBoardAccessoryView]; |
1855 } | 1871 } |
1856 return _keyBoardAccessoryView; | 1872 return _keyBoardAccessoryView; |
1857 } | 1873 } |
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2450 | 2466 |
2451 - (BOOL)isPrerenderAnimationRunning { | 2467 - (BOOL)isPrerenderAnimationRunning { |
2452 return _prerenderAnimating; | 2468 return _prerenderAnimating; |
2453 } | 2469 } |
2454 | 2470 |
2455 - (OmniboxTextFieldIOS*)omnibox { | 2471 - (OmniboxTextFieldIOS*)omnibox { |
2456 return _omniBox; | 2472 return _omniBox; |
2457 } | 2473 } |
2458 | 2474 |
2459 @end | 2475 @end |
OLD | NEW |