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

Side by Side Diff: chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 months 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #include "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h" 5 #include "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h"
6 6
7 #include <Carbon/Carbon.h> // kVK_Return 7 #include <Carbon/Carbon.h> // kVK_Return
8 8
9 #include "base/mac/foundation_util.h" 9 #include "base/mac/foundation_util.h"
10 #include "base/memory/ptr_util.h"
10 #include "base/metrics/histogram.h" 11 #include "base/metrics/histogram.h"
11 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
12 #include "base/strings/sys_string_conversions.h" 13 #include "base/strings/sys_string_conversions.h"
13 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
14 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" 15 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h"
15 #include "chrome/browser/browser_process.h" 16 #include "chrome/browser/browser_process.h"
16 #include "chrome/browser/search/search.h" 17 #include "chrome/browser/search/search.h"
17 #include "chrome/browser/themes/theme_service.h" 18 #include "chrome/browser/themes/theme_service.h"
19 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
18 #include "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h" 20 #include "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h"
19 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.h" 21 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.h"
20 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
21 #include "chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.h" 22 #include "chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.h"
22 #include "chrome/browser/ui/omnibox/chrome_omnibox_client.h" 23 #include "chrome/browser/ui/omnibox/chrome_omnibox_client.h"
23 #include "chrome/browser/ui/omnibox/clipboard_utils.h" 24 #include "chrome/browser/ui/omnibox/clipboard_utils.h"
24 #include "chrome/grit/generated_resources.h" 25 #include "chrome/grit/generated_resources.h"
25 #include "components/omnibox/browser/autocomplete_input.h" 26 #include "components/omnibox/browser/autocomplete_input.h"
26 #include "components/omnibox/browser/autocomplete_match.h" 27 #include "components/omnibox/browser/autocomplete_match.h"
27 #include "components/omnibox/browser/omnibox_edit_controller.h" 28 #include "components/omnibox/browser/omnibox_edit_controller.h"
28 #include "components/omnibox/browser/omnibox_field_trial.h" 29 #include "components/omnibox/browser/omnibox_field_trial.h"
29 #include "components/omnibox/browser/omnibox_popup_model.h" 30 #include "components/omnibox/browser/omnibox_popup_model.h"
30 #include "components/security_state/security_state_model.h" 31 #include "components/security_state/security_state_model.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 return inDarkMode ? [NSColor colorWithCalibratedWhite:1 alpha:0.5] 167 return inDarkMode ? [NSColor colorWithCalibratedWhite:1 alpha:0.5]
167 : [NSColor colorWithCalibratedWhite:0 alpha:0.5]; 168 : [NSColor colorWithCalibratedWhite:0 alpha:0.5];
168 } 169 }
169 170
170 OmniboxViewMac::OmniboxViewMac(OmniboxEditController* controller, 171 OmniboxViewMac::OmniboxViewMac(OmniboxEditController* controller,
171 Profile* profile, 172 Profile* profile,
172 CommandUpdater* command_updater, 173 CommandUpdater* command_updater,
173 AutocompleteTextField* field) 174 AutocompleteTextField* field)
174 : OmniboxView( 175 : OmniboxView(
175 controller, 176 controller,
176 make_scoped_ptr(new ChromeOmniboxClient(controller, profile))), 177 base::WrapUnique(new ChromeOmniboxClient(controller, profile))),
177 profile_(profile), 178 profile_(profile),
178 popup_view_(new OmniboxPopupViewMac(this, model(), field)), 179 popup_view_(new OmniboxPopupViewMac(this, model(), field)),
179 field_(field), 180 field_(field),
180 saved_temporary_selection_(NSMakeRange(0, 0)), 181 saved_temporary_selection_(NSMakeRange(0, 0)),
181 selection_before_change_(NSMakeRange(0, 0)), 182 selection_before_change_(NSMakeRange(0, 0)),
182 marked_range_before_change_(NSMakeRange(0, 0)), 183 marked_range_before_change_(NSMakeRange(0, 0)),
183 delete_was_pressed_(false), 184 delete_was_pressed_(false),
184 delete_at_end_pressed_(false), 185 delete_at_end_pressed_(false),
185 in_coalesced_update_block_(false), 186 in_coalesced_update_block_(false),
186 do_coalesced_text_update_(false), 187 do_coalesced_text_update_(false),
(...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 1108
1108 NSUInteger OmniboxViewMac::GetTextLength() const { 1109 NSUInteger OmniboxViewMac::GetTextLength() const {
1109 return [field_ currentEditor] ? [[[field_ currentEditor] string] length] : 1110 return [field_ currentEditor] ? [[[field_ currentEditor] string] length] :
1110 [[field_ stringValue] length]; 1111 [[field_ stringValue] length];
1111 } 1112 }
1112 1113
1113 bool OmniboxViewMac::IsCaretAtEnd() const { 1114 bool OmniboxViewMac::IsCaretAtEnd() const {
1114 const NSRange selection = GetSelectedRange(); 1115 const NSRange selection = GetSelectedRange();
1115 return NSMaxRange(selection) == GetTextLength(); 1116 return NSMaxRange(selection) == GetTextLength();
1116 } 1117 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h ('k') | chrome/browser/ui/cocoa/omnibox/omnibox_view_mac_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698