| 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/views/validation_message_bubble_view.h" | 5 #include "chrome/browser/ui/views/validation_message_bubble_view.h" |
| 6 | 6 |
| 7 #include "chrome/grit/theme_resources.h" | 7 #include "chrome/grit/theme_resources.h" |
| 8 #include "content/public/browser/render_widget_host.h" | 8 #include "content/public/browser/render_widget_host.h" |
| 9 #include "content/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
| 10 #include "ui/base/layout.h" | 10 #include "ui/base/layout.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 85 |
| 86 gfx::Rect ValidationMessageBubbleView::RootViewToScreenRect( | 86 gfx::Rect ValidationMessageBubbleView::RootViewToScreenRect( |
| 87 const gfx::Rect& rect_in_root_view, | 87 const gfx::Rect& rect_in_root_view, |
| 88 const content::RenderWidgetHostView* render_widget_host_view) const { | 88 const content::RenderWidgetHostView* render_widget_host_view) const { |
| 89 gfx::NativeView view = render_widget_host_view->GetNativeView(); | 89 gfx::NativeView view = render_widget_host_view->GetNativeView(); |
| 90 const float scale = ui::GetScaleFactorForNativeView(view); | 90 const float scale = ui::GetScaleFactorForNativeView(view); |
| 91 return gfx::ScaleToEnclosingRect(rect_in_root_view, 1 / scale) + | 91 return gfx::ScaleToEnclosingRect(rect_in_root_view, 1 / scale) + |
| 92 render_widget_host_view->GetViewBounds().origin().OffsetFromOrigin(); | 92 render_widget_host_view->GetViewBounds().origin().OffsetFromOrigin(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 gfx::Size ValidationMessageBubbleView::GetPreferredSize() const { | 95 gfx::Size ValidationMessageBubbleView::GetUnsnappedPreferredSize() const { |
| 96 return size_; | 96 return size_; |
| 97 } | 97 } |
| 98 | 98 |
| 99 int ValidationMessageBubbleView::GetDialogButtons() const { | 99 int ValidationMessageBubbleView::GetDialogButtons() const { |
| 100 return ui::DIALOG_BUTTON_NONE; | 100 return ui::DIALOG_BUTTON_NONE; |
| 101 } | 101 } |
| 102 | 102 |
| 103 void ValidationMessageBubbleView::SetPositionRelativeToAnchor( | 103 void ValidationMessageBubbleView::SetPositionRelativeToAnchor( |
| 104 content::RenderWidgetHost* widget_host, | 104 content::RenderWidgetHost* widget_host, |
| 105 const gfx::Rect& anchor_in_root_view) { | 105 const gfx::Rect& anchor_in_root_view) { |
| 106 SetAnchorRect( | 106 SetAnchorRect( |
| 107 RootViewToScreenRect(anchor_in_root_view, widget_host->GetView())); | 107 RootViewToScreenRect(anchor_in_root_view, widget_host->GetView())); |
| 108 } | 108 } |
| 109 | 109 |
| 110 void ValidationMessageBubbleView::CloseValidationMessage() { | 110 void ValidationMessageBubbleView::CloseValidationMessage() { |
| 111 GetWidget()->Close(); | 111 GetWidget()->Close(); |
| 112 } | 112 } |
| OLD | NEW |