OLD | NEW |
---|---|
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/views/bubble/bubble_dialog_delegate.h" |
11 | 12 |
12 namespace content { | 13 namespace content { |
13 class WebContents; | 14 class WebContents; |
14 } | 15 } |
15 | 16 |
16 // A ValidationMessageBubble implementation for Views. | 17 // A ValidationMessageBubble implementation for Views. |
17 class ValidationMessageBubbleView | 18 class ValidationMessageBubbleView |
18 : public ValidationMessageBubble, | 19 : public views::BubbleDialogDelegateView, |
19 public ValidationMessageBubbleDelegate::Observer { | 20 public ValidationMessageBubble, |
21 public base::SupportsWeakPtr<ValidationMessageBubbleView> { | |
20 public: | 22 public: |
23 static const int kWindowMinWidth; | |
msw
2016/04/14 01:51:38
Can these be moved to the cc file if you're removi
Evan Stade
2016/04/18 01:16:43
Done.
| |
24 static const int kWindowMaxWidth; | |
25 | |
21 ValidationMessageBubbleView(content::WebContents* web_contents, | 26 ValidationMessageBubbleView(content::WebContents* web_contents, |
22 const gfx::Rect& anchor_in_root_view, | 27 const gfx::Rect& anchor_in_root_view, |
23 const base::string16& main_text, | 28 const base::string16& main_text, |
24 const base::string16& sub_text); | 29 const base::string16& sub_text); |
25 ~ValidationMessageBubbleView() override; | 30 ~ValidationMessageBubbleView() override; |
26 | 31 |
32 // BubbleDialogDelegateView overrides: | |
33 gfx::Size GetPreferredSize() const override; | |
34 int GetDialogButtons() const override; | |
35 | |
27 // ValidationMessageBubble overrides: | 36 // ValidationMessageBubble overrides: |
28 void SetPositionRelativeToAnchor( | 37 void SetPositionRelativeToAnchor( |
29 content::RenderWidgetHost* widget_host, | 38 content::RenderWidgetHost* widget_host, |
30 const gfx::Rect& anchor_in_root_view) override; | 39 const gfx::Rect& anchor_in_root_view) override; |
31 | 40 void CloseValidationMessage() override; |
32 // ValidationMessageBubbleDelegate::Observer overrides: | |
33 void WindowClosing() override; | |
34 | 41 |
35 private: | 42 private: |
36 ValidationMessageBubbleDelegate* delegate_; | 43 int width_; |
msw
2016/04/14 01:51:38
nit: gfx::Size?
Evan Stade
2016/04/18 01:16:43
Done.
| |
37 | 44 int height_; |
38 DISALLOW_COPY_AND_ASSIGN(ValidationMessageBubbleView); | 45 DISALLOW_COPY_AND_ASSIGN(ValidationMessageBubbleView); |
msw
2016/04/14 01:51:38
nit: blank line above?
Evan Stade
2016/04/18 01:16:43
Done.
| |
39 }; | 46 }; |
40 | 47 |
41 #endif // CHROME_BROWSER_UI_VIEWS_VALIDATION_MESSAGE_BUBBLE_VIEW_H_ | 48 #endif // CHROME_BROWSER_UI_VIEWS_VALIDATION_MESSAGE_BUBBLE_VIEW_H_ |
OLD | NEW |