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

Unified Diff: chrome/browser/ui/gtk/validation_message_bubble_gtk.cc

Issue 16583005: Some improvement of validation message bubble UI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits Created 7 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/gtk/bubble/bubble_gtk.cc ('k') | chrome/browser/ui/validation_message_bubble.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/gtk/validation_message_bubble_gtk.cc
diff --git a/chrome/browser/ui/gtk/validation_message_bubble_gtk.cc b/chrome/browser/ui/gtk/validation_message_bubble_gtk.cc
index edebf2c6ccd9c03152e91027c781ce1391898f0b..61951a256ab5163e2f5bb797fbfb987b663bae69 100644
--- a/chrome/browser/ui/gtk/validation_message_bubble_gtk.cc
+++ b/chrome/browser/ui/gtk/validation_message_bubble_gtk.cc
@@ -34,6 +34,9 @@ class ValidationMessageBubbleGtk : public chrome::ValidationMessageBubble,
const string16& main_text,
const string16& sub_text);
virtual ~ValidationMessageBubbleGtk();
+ virtual void SetPositionRelativeToAnchor(
+ content::RenderWidgetHost* widget_host,
+ const gfx::Rect& anchor_in_root_view) OVERRIDE;
// BubbleDelegateGtk override:
virtual void BubbleClosing(BubbleGtk*, bool) OVERRIDE;
@@ -47,21 +50,17 @@ class ValidationMessageBubbleGtk : public chrome::ValidationMessageBubble,
ValidationMessageBubbleGtk::ValidationMessageBubbleGtk(
content::RenderWidgetHost* widget_host,
- const gfx::Rect& anchor_in_screen,
+ const gfx::Rect& anchor_in_root_view,
const string16& main_text,
const string16& sub_text)
: bubble_(NULL) {
if (!widget_host->IsRenderView())
return;
- gfx::Rect bounds_in_screen = widget_host->GetView()->GetViewBounds();
- gfx::Rect anchor = anchor_in_screen;
- anchor.Offset(-bounds_in_screen.x(), -bounds_in_screen.y());
-
Profile* profile = Profile::FromBrowserContext(
content::WebContents::FromRenderViewHost(
content::RenderViewHost::From(widget_host))->GetBrowserContext());
bubble_ = BubbleGtk::Show(widget_host->GetView()->GetNativeView(),
- &anchor,
+ &anchor_in_root_view,
ConstructContent(main_text, sub_text),
BubbleGtk::ANCHOR_TOP_LEFT,
BubbleGtk::POPUP_WINDOW,
@@ -74,6 +73,13 @@ ValidationMessageBubbleGtk::~ValidationMessageBubbleGtk() {
bubble_->Close();
}
+void ValidationMessageBubbleGtk::SetPositionRelativeToAnchor(
+ content::RenderWidgetHost* widget_host,
+ const gfx::Rect& anchor_in_root_view) {
+ if (bubble_)
+ bubble_->SetPositionRelativeToAnchor(&anchor_in_root_view);
+}
+
void ValidationMessageBubbleGtk::BubbleClosing(BubbleGtk*, bool) {
bubble_ = NULL;
}
@@ -124,11 +130,11 @@ namespace chrome {
scoped_ptr<ValidationMessageBubble> ValidationMessageBubble::CreateAndShow(
content::RenderWidgetHost* widget_host,
- const gfx::Rect& anchor_in_screen,
+ const gfx::Rect& anchor_in_root_view,
const string16& main_text,
const string16& sub_text) {
return scoped_ptr<ValidationMessageBubble>(new ValidationMessageBubbleGtk(
- widget_host, anchor_in_screen, main_text, sub_text)).Pass();
+ widget_host, anchor_in_root_view, main_text, sub_text)).Pass();
}
} // namespace chrome
« no previous file with comments | « chrome/browser/ui/gtk/bubble/bubble_gtk.cc ('k') | chrome/browser/ui/validation_message_bubble.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698