OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/password_manager/save_password_infobar_delegate.h" | 5 #include "chrome/browser/password_manager/save_password_infobar_delegate.h" |
6 #include "chrome/browser/ui/chrome_style.h" | 6 #include "chrome/browser/ui/chrome_style.h" |
7 #include "chrome/browser/ui/cocoa/infobars/confirm_infobar_controller.h" | 7 #include "chrome/browser/ui/cocoa/infobars/confirm_infobar_controller.h" |
8 #include "chrome/browser/ui/cocoa/infobars/infobar_cocoa.h" | 8 #include "chrome/browser/ui/cocoa/infobars/infobar_cocoa.h" |
9 #include "components/infobars/core/infobar.h" | 9 #include "components/infobars/core/infobar.h" |
10 #include "skia/ext/skia_utils_mac.h" | 10 #include "skia/ext/skia_utils_mac.h" |
11 #include "ui/base/cocoa/controls/hyperlink_text_view.h" | 11 #include "ui/base/cocoa/controls/hyperlink_text_view.h" |
12 | 12 |
13 @interface SavePasswordInfobarController : ConfirmInfoBarController | 13 @interface SavePasswordInfobarController : ConfirmInfoBarController |
14 @end | 14 @end |
15 | 15 |
16 @implementation SavePasswordInfobarController | 16 @implementation SavePasswordInfobarController |
17 | 17 |
18 - (void)addAdditionalControls { | 18 - (void)addAdditionalControls { |
19 [super addAdditionalControls]; | 19 [super addAdditionalControls]; |
20 // Set the link inside the message. | 20 // Set the link inside the message. |
21 SavePasswordInfoBarDelegate* delegate = | 21 SavePasswordInfoBarDelegate* delegate = |
22 static_cast<SavePasswordInfoBarDelegate*>([self delegate]); | 22 static_cast<SavePasswordInfoBarDelegate*>([self delegate]); |
23 gfx::Range linkRange = delegate->message_link_range(); | 23 gfx::Range linkRange = delegate->message_link_range(); |
24 if (!linkRange.is_empty()) { | 24 if (!linkRange.is_empty()) { |
25 NSColor* linkColor = | 25 NSColor* linkColor = |
26 gfx::SkColorToCalibratedNSColor(chrome_style::GetLinkColor()); | 26 gfx::SkColorToCalibratedNSColor(chrome_style::GetLinkColor()); |
27 HyperlinkTextView* view = (HyperlinkTextView*)label_.get(); | 27 HyperlinkTextView* view = (HyperlinkTextView*)label_.get(); |
28 [view addLinkRange:linkRange.ToNSRange() | 28 [view addLinkRange:linkRange.ToNSRange() |
29 withName:@"" | 29 withURL:@"about:blank" // using a link here is bad ui |
30 linkColor:linkColor]; | 30 linkColor:linkColor]; |
31 } | 31 } |
32 } | 32 } |
33 | 33 |
34 scoped_ptr<infobars::InfoBar> CreateSavePasswordInfoBar | 34 scoped_ptr<infobars::InfoBar> CreateSavePasswordInfoBar |
35 (scoped_ptr<SavePasswordInfoBarDelegate> delegate) { | 35 (scoped_ptr<SavePasswordInfoBarDelegate> delegate) { |
36 scoped_ptr<InfoBarCocoa> infobar(new InfoBarCocoa(delegate.Pass())); | 36 scoped_ptr<InfoBarCocoa> infobar(new InfoBarCocoa(delegate.Pass())); |
37 base::scoped_nsobject<SavePasswordInfobarController> controller( | 37 base::scoped_nsobject<SavePasswordInfobarController> controller( |
38 [[SavePasswordInfobarController alloc] initWithInfoBar:infobar.get()]); | 38 [[SavePasswordInfobarController alloc] initWithInfoBar:infobar.get()]); |
39 infobar->set_controller(controller); | 39 infobar->set_controller(controller); |
40 return infobar.Pass(); | 40 return infobar.Pass(); |
41 } | 41 } |
42 | 42 |
43 @end | 43 @end |
OLD | NEW |