| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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_notification_controller.h" | 5 #import "chrome/browser/ui/cocoa/autofill/autofill_notification_controller.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/mac/foundation_util.h" | 10 #include "base/mac/foundation_util.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 | 67 |
| 68 - (id)initWithNotification:(const autofill::DialogNotification*)notification | 68 - (id)initWithNotification:(const autofill::DialogNotification*)notification |
| 69 delegate:(autofill::AutofillDialogViewDelegate*)delegate { | 69 delegate:(autofill::AutofillDialogViewDelegate*)delegate { |
| 70 if (self = [super init]) { | 70 if (self = [super init]) { |
| 71 delegate_ = delegate; | 71 delegate_ = delegate; |
| 72 notificationType_ = notification->type(); | 72 notificationType_ = notification->type(); |
| 73 | 73 |
| 74 base::scoped_nsobject<AutofillNotificationView> view( | 74 base::scoped_nsobject<AutofillNotificationView> view( |
| 75 [[AutofillNotificationView alloc] initWithFrame:NSZeroRect]); | 75 [[AutofillNotificationView alloc] initWithFrame:NSZeroRect]); |
| 76 [view setBackgroundColor: | 76 [view setBackgroundColor: |
| 77 gfx::SkColorToCalibratedNSColor(notification->GetBackgroundColor())]; | 77 skia::SkColorToCalibratedNSColor(notification->GetBackgroundColor())]; |
| 78 [view setBorderColor: | 78 [view setBorderColor: |
| 79 gfx::SkColorToCalibratedNSColor(notification->GetBorderColor())]; | 79 skia::SkColorToCalibratedNSColor(notification->GetBorderColor())]; |
| 80 [self setView:view]; | 80 [self setView:view]; |
| 81 | 81 |
| 82 textview_.reset([[HyperlinkTextView alloc] initWithFrame:NSZeroRect]); | 82 textview_.reset([[HyperlinkTextView alloc] initWithFrame:NSZeroRect]); |
| 83 NSColor* textColor = | 83 NSColor* textColor = |
| 84 gfx::SkColorToCalibratedNSColor(notification->GetTextColor()); | 84 skia::SkColorToCalibratedNSColor(notification->GetTextColor()); |
| 85 [textview_ setMessage:base::SysUTF16ToNSString(notification->display_text()) | 85 [textview_ setMessage:base::SysUTF16ToNSString(notification->display_text()) |
| 86 withFont:[NSFont labelFontOfSize:[[textview_ font] pointSize]] | 86 withFont:[NSFont labelFontOfSize:[[textview_ font] pointSize]] |
| 87 messageColor:textColor]; | 87 messageColor:textColor]; |
| 88 if (!notification->link_range().is_empty()) { | 88 if (!notification->link_range().is_empty()) { |
| 89 linkURL_ = notification->link_url(); | 89 linkURL_ = notification->link_url(); |
| 90 [textview_ setDelegate:self]; | 90 [textview_ setDelegate:self]; |
| 91 [textview_ addLinkRange:notification->link_range().ToNSRange() | 91 [textview_ addLinkRange:notification->link_range().ToNSRange() |
| 92 withURL:base::SysUTF8ToNSString(linkURL_.spec()) | 92 withURL:base::SysUTF8ToNSString(linkURL_.spec()) |
| 93 linkColor:[NSColor blueColor]]; | 93 linkColor:[NSColor blueColor]]; |
| 94 } | 94 } |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 } | 180 } |
| 181 | 181 |
| 182 - (BOOL)textView:(NSTextView *)textView | 182 - (BOOL)textView:(NSTextView *)textView |
| 183 clickedOnLink:(id)link | 183 clickedOnLink:(id)link |
| 184 atIndex:(NSUInteger)charIndex { | 184 atIndex:(NSUInteger)charIndex { |
| 185 delegate_->LinkClicked(linkURL_); | 185 delegate_->LinkClicked(linkURL_); |
| 186 return YES; | 186 return YES; |
| 187 } | 187 } |
| 188 | 188 |
| 189 @end | 189 @end |
| OLD | NEW |