Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm

Issue 2576563002: [Mac] Reverse the omnibox in RTL (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.h" 5 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.h"
6 6
7 #include "base/mac/sdk_forward_declarations.h" 7 #include "base/mac/sdk_forward_declarations.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/sys_string_conversions.h" 9 #include "base/strings/sys_string_conversions.h"
10 #include "chrome/app/chrome_command_ids.h" // IDC_* 10 #include "chrome/app/chrome_command_ids.h" // IDC_*
11 #include "chrome/browser/themes/theme_service.h" 11 #include "chrome/browser/themes/theme_service.h"
12 #include "chrome/browser/ui/browser_list.h" 12 #include "chrome/browser/ui/browser_list.h"
13 #import "chrome/browser/ui/cocoa/browser_window_controller.h" 13 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
14 #include "chrome/browser/ui/cocoa/l10n_util.h"
14 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h" 15 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h"
15 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h" 16 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h"
16 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" 17 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h"
17 #include "chrome/grit/generated_resources.h" 18 #include "chrome/grit/generated_resources.h"
18 #import "ui/base/cocoa/find_pasteboard.h" 19 #import "ui/base/cocoa/find_pasteboard.h"
19 #import "ui/base/cocoa/touch_bar_forward_declarations.h" 20 #import "ui/base/cocoa/touch_bar_forward_declarations.h"
20 #include "ui/base/l10n/l10n_util_mac.h" 21 #include "ui/base/l10n/l10n_util_mac.h"
21 #include "ui/base/material_design/material_design_controller.h" 22 #include "ui/base/material_design/material_design_controller.h"
22 23
23 namespace { 24 namespace {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 87
87 forbiddenCharacters_.reset([[NSCharacterSet controlCharacterSet] retain]); 88 forbiddenCharacters_.reset([[NSCharacterSet controlCharacterSet] retain]);
88 89
89 // Disable all substitutions by default. In regular NSTextFields a user may 90 // Disable all substitutions by default. In regular NSTextFields a user may
90 // selectively enable them via context menu, but that submenu is not enabled 91 // selectively enable them via context menu, but that submenu is not enabled
91 // for the omnibox. The substitutions are unlikely to be useful in any case. 92 // for the omnibox. The substitutions are unlikely to be useful in any case.
92 // 93 //
93 // Also see http://crbug.com/173405 and http://crbug.com/528014. 94 // Also see http://crbug.com/173405 and http://crbug.com/528014.
94 NSTextCheckingTypes checkingTypes = 0; 95 NSTextCheckingTypes checkingTypes = 0;
95 [self setEnabledTextCheckingTypes:checkingTypes]; 96 [self setEnabledTextCheckingTypes:checkingTypes];
97 self.alignment = cocoa_l10n_util::ShouldDoExperimentalRTLLayout()
98 ? NSRightTextAlignment
99 : NSLeftTextAlignment;
Sidney San Martín 2016/12/16 00:05:54 The docs suggest that NSNaturalTextAlignment would
lgrey 2016/12/20 19:41:04 At least in forced RTL, this doesn't hold for the
96 } 100 }
97 return self; 101 return self;
98 } 102 }
99 103
100 // Overridden to prevent unwanted items from appearing in the Touch Bar. 104 // Overridden to prevent unwanted items from appearing in the Touch Bar.
101 - (NSTouchBar*)makeTouchBar { 105 - (NSTouchBar*)makeTouchBar {
102 return nil; 106 return nil;
103 } 107 }
104 108
105 - (void)updateColorsToMatchTheme { 109 - (void)updateColorsToMatchTheme {
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 // ThemedWindowDrawing implementation. 628 // ThemedWindowDrawing implementation.
625 629
626 - (void)windowDidChangeTheme { 630 - (void)windowDidChangeTheme {
627 [self updateColorsToMatchTheme]; 631 [self updateColorsToMatchTheme];
628 } 632 }
629 633
630 - (void)windowDidChangeActive { 634 - (void)windowDidChangeActive {
631 } 635 }
632 636
633 @end 637 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698