| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_PASSWORD_GENERATION_BUBBLE_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_PASSWORD_GENERATION_BUBBLE_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_PASSWORD_GENERATION_BUBBLE_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_PASSWORD_GENERATION_BUBBLE_VIEW_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "chrome/browser/autofill/password_generator.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/memory/scoped_ptr.h" |
| 10 #include "ui/gfx/rect.h" | 11 #include "ui/gfx/rect.h" |
| 11 #include "ui/views/bubble/bubble_delegate.h" | 12 #include "ui/views/bubble/bubble_delegate.h" |
| 12 #include "ui/views/controls/button/button.h" | 13 #include "ui/views/controls/button/button.h" |
| 13 #include "ui/views/view.h" | 14 #include "ui/views/view.h" |
| 14 | 15 |
| 16 namespace autofill { |
| 17 class PasswordGenerator; |
| 18 } |
| 19 |
| 15 namespace content { | 20 namespace content { |
| 16 class RenderViewHost; | 21 class RenderViewHost; |
| 17 } | 22 } |
| 18 | 23 |
| 19 namespace views { | 24 namespace views { |
| 20 class TextButton; | 25 class TextButton; |
| 21 class Textfield; | 26 class Textfield; |
| 22 } | 27 } |
| 23 | 28 |
| 24 // PasswordGenerationBubbleView is a bubble used to show possible generated | 29 // PasswordGenerationBubbleView is a bubble used to show possible generated |
| 25 // passwords to users. It is set in the page content, anchored at |anchor_rect|. | 30 // passwords to users. It is set in the page content, anchored at |anchor_rect|. |
| 26 // If the generated password is accepted by the user, the renderer associated | 31 // If the generated password is accepted by the user, the renderer associated |
| 27 // with |render_view_host| is informed. | 32 // with |render_view_host| is informed. |
| 28 class PasswordGenerationBubbleView : public views::BubbleDelegateView, | 33 class PasswordGenerationBubbleView : public views::BubbleDelegateView, |
| 29 public views::ButtonListener { | 34 public views::ButtonListener { |
| 30 public: | 35 public: |
| 31 PasswordGenerationBubbleView(const gfx::Rect& anchor_rect, | 36 PasswordGenerationBubbleView(const gfx::Rect& anchor_rect, |
| 32 views::View* anchor_view, | 37 views::View* anchor_view, |
| 33 content::RenderViewHost* render_view_host); | 38 content::RenderViewHost* render_view_host, |
| 39 autofill::PasswordGenerator* password_generator); |
| 34 virtual ~PasswordGenerationBubbleView(); | 40 virtual ~PasswordGenerationBubbleView(); |
| 35 | 41 |
| 36 private: | 42 private: |
| 37 // views::BubbleDelegateView | 43 // views::BubbleDelegateView |
| 38 virtual void Init() OVERRIDE; | 44 virtual void Init() OVERRIDE; |
| 39 virtual gfx::Rect GetAnchorRect() OVERRIDE; | 45 virtual gfx::Rect GetAnchorRect() OVERRIDE; |
| 40 | 46 |
| 41 // views::ButtonListener | 47 // views::ButtonListener |
| 42 virtual void ButtonPressed(views::Button* sender, | 48 virtual void ButtonPressed(views::Button* sender, |
| 43 const views::Event& event) OVERRIDE; | 49 const views::Event& event) OVERRIDE; |
| 44 | 50 |
| 45 // Subviews | 51 // Subviews |
| 46 views::TextButton* accept_button_; | 52 views::TextButton* accept_button_; |
| 47 views::Textfield* text_field_; | 53 views::Textfield* text_field_; |
| 48 | 54 |
| 49 // Location that the bubble points to | 55 // Location that the bubble points to |
| 50 gfx::Rect anchor_rect_; | 56 gfx::Rect anchor_rect_; |
| 51 | 57 |
| 52 // RenderViewHost associated with the button that spawned this bubble. | 58 // RenderViewHost associated with the button that spawned this bubble. |
| 53 content::RenderViewHost* render_view_host_; | 59 content::RenderViewHost* render_view_host_; |
| 54 | 60 |
| 55 // Class to generate passwords | 61 // Object to generate passwords |
| 56 autofill::PasswordGenerator password_generator_; | 62 scoped_ptr<autofill::PasswordGenerator> password_generator_; |
| 57 | 63 |
| 58 DISALLOW_COPY_AND_ASSIGN(PasswordGenerationBubbleView); | 64 DISALLOW_COPY_AND_ASSIGN(PasswordGenerationBubbleView); |
| 59 }; | 65 }; |
| 60 | 66 |
| 61 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORD_GENERATION_BUBBLE_VIEW_H_ | 67 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORD_GENERATION_BUBBLE_VIEW_H_ |
| OLD | NEW |