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

Side by Side Diff: chrome/browser/ui/cocoa/autofill/autofill_popup_view_cocoa.mm

Issue 159853003: Moving the autofill enum from blink side to browser side (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 10 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 #import "chrome/browser/ui/cocoa/autofill/autofill_popup_view_cocoa.h" 5 #import "chrome/browser/ui/cocoa/autofill/autofill_popup_view_cocoa.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/sys_string_conversions.h" 8 #include "base/strings/sys_string_conversions.h"
9 #include "chrome/browser/ui/autofill/autofill_popup_controller.h" 9 #include "chrome/browser/ui/autofill/autofill_popup_controller.h"
10 #include "chrome/browser/ui/autofill/popup_constants.h" 10 #include "chrome/browser/ui/autofill/popup_constants.h"
11 #include "chrome/browser/ui/cocoa/autofill/autofill_popup_view_bridge.h" 11 #include "chrome/browser/ui/cocoa/autofill/autofill_popup_view_bridge.h"
12 #include "components/autofill/core/browser/popup_item_ids.h"
12 #include "grit/ui_resources.h" 13 #include "grit/ui_resources.h"
13 #include "third_party/WebKit/public/web/WebAutofillClient.h"
14 #include "ui/base/resource/resource_bundle.h" 14 #include "ui/base/resource/resource_bundle.h"
15 #include "ui/gfx/font_list.h" 15 #include "ui/gfx/font_list.h"
16 #include "ui/gfx/image/image.h" 16 #include "ui/gfx/image/image.h"
17 #include "ui/gfx/point.h" 17 #include "ui/gfx/point.h"
18 #include "ui/gfx/rect.h" 18 #include "ui/gfx/rect.h"
19 19
20 using autofill::AutofillPopupView; 20 using autofill::AutofillPopupView;
21 21
22 namespace { 22 namespace {
23 23
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 [BorderColor() setStroke]; 128 [BorderColor() setStroke];
129 [path stroke]; 129 [path stroke];
130 130
131 for (size_t i = 0; i < controller_->names().size(); ++i) { 131 for (size_t i = 0; i < controller_->names().size(); ++i) {
132 // Skip rows outside of the dirty rect. 132 // Skip rows outside of the dirty rect.
133 NSRect rowBounds = 133 NSRect rowBounds =
134 NSRectFromCGRect(controller_->GetRowBounds(i).ToCGRect()); 134 NSRectFromCGRect(controller_->GetRowBounds(i).ToCGRect());
135 if (!NSIntersectsRect(rowBounds, dirtyRect)) 135 if (!NSIntersectsRect(rowBounds, dirtyRect))
136 continue; 136 continue;
137 137
138 if (controller_->identifiers()[i] == 138 if (controller_->identifiers()[i] == autofill::POPUP_ITEM_ID_SEPARATOR) {
139 blink::WebAutofillClient::MenuItemIDSeparator) {
140 [self drawSeparatorWithBounds:rowBounds]; 139 [self drawSeparatorWithBounds:rowBounds];
141 } else { 140 } else {
142 NSString* name = SysUTF16ToNSString(controller_->names()[i]); 141 NSString* name = SysUTF16ToNSString(controller_->names()[i]);
143 NSString* subtext = SysUTF16ToNSString(controller_->subtexts()[i]); 142 NSString* subtext = SysUTF16ToNSString(controller_->subtexts()[i]);
144 BOOL isSelected = static_cast<int>(i) == controller_->selected_line(); 143 BOOL isSelected = static_cast<int>(i) == controller_->selected_line();
145 [self drawSuggestionWithName:name 144 [self drawSuggestionWithName:name
146 subtext:subtext 145 subtext:subtext
147 index:i 146 index:i
148 bounds:rowBounds 147 bounds:rowBounds
149 selected:isSelected]; 148 selected:isSelected];
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 return nil; 275 return nil;
277 276
278 int iconId = controller_->GetIconResourceID(controller_->icons()[index]); 277 int iconId = controller_->GetIconResourceID(controller_->icons()[index]);
279 DCHECK_NE(-1, iconId); 278 DCHECK_NE(-1, iconId);
280 279
281 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 280 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
282 return rb.GetNativeImageNamed(iconId).ToNSImage(); 281 return rb.GetNativeImageNamed(iconId).ToNSImage();
283 } 282 }
284 283
285 @end 284 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698