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

Side by Side Diff: chrome/browser/ui/cocoa/validation_message_bubble_cocoa.mm

Issue 1880853002: Convert ValidationMessageBubbleView to BubbleDialogDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: docs Created 4 years, 8 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) 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 #include "chrome/browser/ui/cocoa/validation_message_bubble_cocoa.h" 5 #include "chrome/browser/ui/cocoa/validation_message_bubble_cocoa.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/mac/foundation_util.h" 9 #include "base/mac/foundation_util.h"
10 #include "base/strings/sys_string_conversions.h" 10 #include "base/strings/sys_string_conversions.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 const base::string16& sub_text) { 160 const base::string16& sub_text) {
161 content::RenderWidgetHost* widget_host = 161 content::RenderWidgetHost* widget_host =
162 web_contents->GetRenderViewHost()->GetWidget(); 162 web_contents->GetRenderViewHost()->GetWidget();
163 controller_.reset([[[ValidationMessageBubbleController alloc] 163 controller_.reset([[[ValidationMessageBubbleController alloc]
164 init:[widget_host->GetView()->GetNativeView() window] 164 init:[widget_host->GetView()->GetNativeView() window]
165 anchoredAt:GetAnchorPoint(widget_host, anchor_in_root_view) 165 anchoredAt:GetAnchorPoint(widget_host, anchor_in_root_view)
166 mainText:main_text 166 mainText:main_text
167 subText:sub_text] retain]); 167 subText:sub_text] retain]);
168 } 168 }
169 169
170 ValidationMessageBubbleCocoa::~ValidationMessageBubbleCocoa() { 170 ValidationMessageBubbleCocoa::~ValidationMessageBubbleCocoa() {}
171 [controller_ close];
172 }
173 171
174 void ValidationMessageBubbleCocoa::SetPositionRelativeToAnchor( 172 void ValidationMessageBubbleCocoa::SetPositionRelativeToAnchor(
175 content::RenderWidgetHost* widget_host, 173 content::RenderWidgetHost* widget_host,
176 const gfx::Rect& anchor_in_root_view) { 174 const gfx::Rect& anchor_in_root_view) {
177 [controller_ setAnchorPoint:GetAnchorPoint(widget_host, anchor_in_root_view)]; 175 [controller_ setAnchorPoint:GetAnchorPoint(widget_host, anchor_in_root_view)];
178 } 176 }
177
178 ValidationMessageBubbleCococa::CloseValidationMessage() {
179 [controller_ close];
180 delete this;
groby-ooo-7-16 2016/04/13 01:42:31 I'm not a fan of self-deletion. Do we have to?
Evan Stade 2016/04/13 15:39:19 I had to make it a WeakPtr (bubble is self-owning)
groby-ooo-7-16 2016/04/13 21:05:56 No, [self autorelease] is an Objective C thing. I
181 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698