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

Side by Side Diff: chrome/browser/ui/views/validation_message_bubble_view.h

Issue 1880853002: Convert ValidationMessageBubbleView to BubbleDialogDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: msw review 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef CHROME_BROWSER_UI_VIEWS_VALIDATION_MESSAGE_BUBBLE_VIEW_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_VALIDATION_MESSAGE_BUBBLE_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_VALIDATION_MESSAGE_BUBBLE_VIEW_H_ 6 #define CHROME_BROWSER_UI_VIEWS_VALIDATION_MESSAGE_BUBBLE_VIEW_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/weak_ptr.h"
9 #include "chrome/browser/ui/validation_message_bubble.h" 10 #include "chrome/browser/ui/validation_message_bubble.h"
10 #include "chrome/browser/ui/views/validation_message_bubble_delegate.h" 11 #include "ui/gfx/geometry/size.h"
12 #include "ui/views/bubble/bubble_dialog_delegate.h"
11 13
12 namespace content { 14 namespace content {
13 class WebContents; 15 class WebContents;
14 } 16 }
15 17
16 // A ValidationMessageBubble implementation for Views. 18 // A ValidationMessageBubble implementation for Views.
17 class ValidationMessageBubbleView 19 class ValidationMessageBubbleView
18 : public ValidationMessageBubble, 20 : public views::BubbleDialogDelegateView,
19 public ValidationMessageBubbleDelegate::Observer { 21 public ValidationMessageBubble,
22 public base::SupportsWeakPtr<ValidationMessageBubbleView> {
20 public: 23 public:
21 ValidationMessageBubbleView(content::WebContents* web_contents, 24 ValidationMessageBubbleView(content::WebContents* web_contents,
22 const gfx::Rect& anchor_in_root_view, 25 const gfx::Rect& anchor_in_root_view,
23 const base::string16& main_text, 26 const base::string16& main_text,
24 const base::string16& sub_text); 27 const base::string16& sub_text);
25 ~ValidationMessageBubbleView() override; 28 ~ValidationMessageBubbleView() override;
26 29
30 // BubbleDialogDelegateView overrides:
31 gfx::Size GetPreferredSize() const override;
32 int GetDialogButtons() const override;
33
27 // ValidationMessageBubble overrides: 34 // ValidationMessageBubble overrides:
28 void SetPositionRelativeToAnchor( 35 void SetPositionRelativeToAnchor(
29 content::RenderWidgetHost* widget_host, 36 content::RenderWidgetHost* widget_host,
30 const gfx::Rect& anchor_in_root_view) override; 37 const gfx::Rect& anchor_in_root_view) override;
31 38 void CloseValidationMessage() override;
32 // ValidationMessageBubbleDelegate::Observer overrides:
33 void WindowClosing() override;
34 39
35 private: 40 private:
36 ValidationMessageBubbleDelegate* delegate_; 41 gfx::Size size_;
37 42
38 DISALLOW_COPY_AND_ASSIGN(ValidationMessageBubbleView); 43 DISALLOW_COPY_AND_ASSIGN(ValidationMessageBubbleView);
39 }; 44 };
40 45
41 #endif // CHROME_BROWSER_UI_VIEWS_VALIDATION_MESSAGE_BUBBLE_VIEW_H_ 46 #endif // CHROME_BROWSER_UI_VIEWS_VALIDATION_MESSAGE_BUBBLE_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698