OLD | NEW |
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 Loading... |
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 void ValidationMessageBubbleCocoa::CloseValidationMessage() { |
| 179 [controller_ close]; |
| 180 delete this; |
| 181 } |
OLD | NEW |