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/validation_message_bubble.h" | 5 #include "chrome/browser/ui/validation_message_bubble.h" |
6 | 6 |
7 #include "chrome/browser/platform_util.h" | 7 #include "chrome/browser/platform_util.h" |
8 #include "chrome/browser/ui/views/validation_message_bubble_delegate.h" | 8 #include "chrome/browser/ui/views/validation_message_bubble_delegate.h" |
9 #include "content/public/browser/render_widget_host.h" | 9 #include "content/public/browser/render_widget_host.h" |
10 #include "content/public/browser/render_widget_host_view.h" | 10 #include "content/public/browser/render_widget_host_view.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 const base::string16& main_text, | 22 const base::string16& main_text, |
23 const base::string16& sub_text); | 23 const base::string16& sub_text); |
24 | 24 |
25 virtual ~ValidationMessageBubbleImpl() { | 25 virtual ~ValidationMessageBubbleImpl() { |
26 if (delegate_ != NULL) | 26 if (delegate_ != NULL) |
27 delegate_->Close(); | 27 delegate_->Close(); |
28 } | 28 } |
29 | 29 |
30 virtual void SetPositionRelativeToAnchor( | 30 virtual void SetPositionRelativeToAnchor( |
31 content::RenderWidgetHost* widget_host, | 31 content::RenderWidgetHost* widget_host, |
32 const gfx::Rect& anchor_in_root_view) OVERRIDE { | 32 const gfx::Rect& anchor_in_root_view) override { |
33 if (!delegate_) | 33 if (!delegate_) |
34 return; | 34 return; |
35 delegate_->SetPositionRelativeToAnchor(anchor_in_root_view + | 35 delegate_->SetPositionRelativeToAnchor(anchor_in_root_view + |
36 widget_host->GetView()->GetViewBounds().origin().OffsetFromOrigin()); | 36 widget_host->GetView()->GetViewBounds().origin().OffsetFromOrigin()); |
37 } | 37 } |
38 | 38 |
39 // ValidationMessageBubbleDelegate::Observer override: | 39 // ValidationMessageBubbleDelegate::Observer override: |
40 virtual void WindowClosing() OVERRIDE { | 40 virtual void WindowClosing() override { |
41 delegate_ = NULL; | 41 delegate_ = NULL; |
42 } | 42 } |
43 | 43 |
44 private: | 44 private: |
45 ValidationMessageBubbleDelegate* delegate_; | 45 ValidationMessageBubbleDelegate* delegate_; |
46 | 46 |
47 DISALLOW_COPY_AND_ASSIGN(ValidationMessageBubbleImpl); | 47 DISALLOW_COPY_AND_ASSIGN(ValidationMessageBubbleImpl); |
48 }; | 48 }; |
49 | 49 |
50 ValidationMessageBubbleImpl::ValidationMessageBubbleImpl( | 50 ValidationMessageBubbleImpl::ValidationMessageBubbleImpl( |
(...skipping 19 matching lines...) Expand all Loading... |
70 const base::string16& main_text, | 70 const base::string16& main_text, |
71 const base::string16& sub_text) { | 71 const base::string16& sub_text) { |
72 const gfx::Rect anchor_in_screen = anchor_in_root_view | 72 const gfx::Rect anchor_in_screen = anchor_in_root_view |
73 + widget_host->GetView()->GetViewBounds().origin().OffsetFromOrigin(); | 73 + widget_host->GetView()->GetViewBounds().origin().OffsetFromOrigin(); |
74 scoped_ptr<ValidationMessageBubble> bubble(new ValidationMessageBubbleImpl( | 74 scoped_ptr<ValidationMessageBubble> bubble(new ValidationMessageBubbleImpl( |
75 widget_host, anchor_in_screen, main_text, sub_text)); | 75 widget_host, anchor_in_screen, main_text, sub_text)); |
76 return bubble.Pass(); | 76 return bubble.Pass(); |
77 } | 77 } |
78 | 78 |
79 } // namespace chrome | 79 } // namespace chrome |
OLD | NEW |