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

Unified Diff: chrome/browser/ui/cocoa/infobars/save_password_infobar_controller.mm

Issue 1157733005: Make 'Google Smart Lock' a hyperlink in the password infobar on Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: vabr@ Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/cocoa/infobars/save_password_infobar_controller.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/infobars/save_password_infobar_controller.mm
diff --git a/chrome/browser/ui/cocoa/infobars/save_password_infobar_controller.mm b/chrome/browser/ui/cocoa/infobars/save_password_infobar_controller.mm
new file mode 100644
index 0000000000000000000000000000000000000000..51745ae149890ceb307f8b93f169f9f00806299e
--- /dev/null
+++ b/chrome/browser/ui/cocoa/infobars/save_password_infobar_controller.mm
@@ -0,0 +1,45 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/cocoa/infobars/save_password_infobar_controller.h"
+
+#include "chrome/browser/password_manager/save_password_infobar_delegate.h"
+#include "chrome/browser/ui/chrome_style.h"
+#include "chrome/browser/ui/cocoa/infobars/confirm_infobar_controller.h"
+#include "chrome/browser/ui/cocoa/infobars/infobar_cocoa.h"
+#include "components/infobars/core/infobar.h"
+#include "skia/ext/skia_utils_mac.h"
+#include "ui/base/cocoa/controls/hyperlink_text_view.h"
+
+@interface SavePasswordInfobarController : ConfirmInfoBarController
+@end
+
+@implementation SavePasswordInfobarController
+
+- (void)addAdditionalControls {
+ [super addAdditionalControls];
+ // Set the link inside the message.
+ SavePasswordInfoBarDelegate* delegate =
+ static_cast<SavePasswordInfoBarDelegate*>([self delegate]);
+ gfx::Range linkRange = delegate->title_link_range();
+ if (!linkRange.is_empty()) {
+ NSColor* linkColor =
+ gfx::SkColorToCalibratedNSColor(chrome_style::GetLinkColor());
+ HyperlinkTextView* view = (HyperlinkTextView*)label_.get();
+ [view addLinkRange:linkRange.ToNSRange()
+ withName:@""
+ linkColor:linkColor];
+ }
+}
+
+scoped_ptr<infobars::InfoBar> CreateSavePasswordInfoBar
+ (scoped_ptr<SavePasswordInfoBarDelegate> delegate) {
+ scoped_ptr<InfoBarCocoa> infobar(new InfoBarCocoa(delegate.Pass()));
+ base::scoped_nsobject<SavePasswordInfobarController> controller(
+ [[SavePasswordInfobarController alloc] initWithInfoBar:infobar.get()]);
+ infobar->set_controller(controller);
+ return infobar.Pass();
+}
+
+@end
« no previous file with comments | « chrome/browser/ui/cocoa/infobars/save_password_infobar_controller.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698