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

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

Issue 24012002: Move Range code to gfx. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: d Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #import "chrome/browser/ui/cocoa/autofill/autofill_main_container.h" 5 #import "chrome/browser/ui/cocoa/autofill/autofill_main_container.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/mac/foundation_util.h" 10 #include "base/mac/foundation_util.h"
11 #include "base/strings/sys_string_conversions.h" 11 #include "base/strings/sys_string_conversions.h"
12 #include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h" 12 #include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h"
13 #include "chrome/browser/ui/cocoa/autofill/autofill_dialog_constants.h" 13 #include "chrome/browser/ui/cocoa/autofill/autofill_dialog_constants.h"
14 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_button.h" 14 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_button.h"
15 #import "chrome/browser/ui/cocoa/autofill/autofill_details_container.h" 15 #import "chrome/browser/ui/cocoa/autofill/autofill_details_container.h"
16 #import "chrome/browser/ui/cocoa/autofill/autofill_notification_container.h" 16 #import "chrome/browser/ui/cocoa/autofill/autofill_notification_container.h"
17 #import "chrome/browser/ui/cocoa/hyperlink_text_view.h" 17 #import "chrome/browser/ui/cocoa/hyperlink_text_view.h"
18 #import "chrome/browser/ui/cocoa/key_equivalent_constants.h" 18 #import "chrome/browser/ui/cocoa/key_equivalent_constants.h"
19 #include "grit/generated_resources.h" 19 #include "grit/generated_resources.h"
20 #import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" 20 #import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h"
21 #include "ui/base/cocoa/window_size_constants.h" 21 #include "ui/base/cocoa/window_size_constants.h"
22 #include "ui/base/l10n/l10n_util.h" 22 #include "ui/base/l10n/l10n_util.h"
23 #include "ui/base/range/range.h" 23 #include "ui/gfx/range/range.h"
24 24
25 @interface AutofillMainContainer (Private) 25 @interface AutofillMainContainer (Private)
26 - (void)buildWindowButtonsForFrame:(NSRect)frame; 26 - (void)buildWindowButtonsForFrame:(NSRect)frame;
27 - (void)layoutButtons; 27 - (void)layoutButtons;
28 - (NSSize)preferredLegalDocumentSizeForWidth:(CGFloat)width; 28 - (NSSize)preferredLegalDocumentSizeForWidth:(CGFloat)width;
29 @end 29 @end
30 30
31 31
32 @implementation AutofillMainContainer 32 @implementation AutofillMainContainer
33 33
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 241
242 - (void)updateLegalDocuments { 242 - (void)updateLegalDocuments {
243 NSString* text = base::SysUTF16ToNSString(delegate_->LegalDocumentsText()); 243 NSString* text = base::SysUTF16ToNSString(delegate_->LegalDocumentsText());
244 244
245 if ([text length]) { 245 if ([text length]) {
246 NSFont* font = [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]; 246 NSFont* font = [NSFont systemFontOfSize:[NSFont smallSystemFontSize]];
247 [legalDocumentsView_ setMessage:text 247 [legalDocumentsView_ setMessage:text
248 withFont:font 248 withFont:font
249 messageColor:[NSColor blackColor]]; 249 messageColor:[NSColor blackColor]];
250 250
251 const std::vector<ui::Range>& link_ranges = 251 const std::vector<gfx::Range>& link_ranges =
252 delegate_->LegalDocumentLinks(); 252 delegate_->LegalDocumentLinks();
253 for (size_t i = 0; i < link_ranges.size(); ++i) { 253 for (size_t i = 0; i < link_ranges.size(); ++i) {
254 NSRange range = link_ranges[i].ToNSRange(); 254 NSRange range = link_ranges[i].ToNSRange();
255 [legalDocumentsView_ addLinkRange:range 255 [legalDocumentsView_ addLinkRange:range
256 withName:@(i) 256 withName:@(i)
257 linkColor:[NSColor blueColor]]; 257 linkColor:[NSColor blueColor]];
258 } 258 }
259 legalDocumentsSizeDirty_ = YES; 259 legalDocumentsSizeDirty_ = YES;
260 } 260 }
261 [legalDocumentsView_ setHidden:[text length] == 0]; 261 [legalDocumentsView_ setHidden:[text length] == 0];
(...skipping 22 matching lines...) Expand all
284 @end 284 @end
285 285
286 286
287 @implementation AutofillMainContainer (Testing) 287 @implementation AutofillMainContainer (Testing)
288 288
289 - (NSButton*)saveInChromeCheckboxForTesting { 289 - (NSButton*)saveInChromeCheckboxForTesting {
290 return saveInChromeCheckbox_.get(); 290 return saveInChromeCheckbox_.get();
291 } 291 }
292 292
293 @end 293 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698