| 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 "ui/gfx/rect.h" | 10 #include "ui/gfx/rect.h" |
| 11 #include "ui/views/bubble/bubble_delegate.h" | 11 #include "ui/views/bubble/bubble_delegate.h" |
| 12 #include "ui/views/controls/button/button.h" | 12 #include "ui/views/controls/button/button.h" |
| 13 #include "ui/views/controls/link_listener.h" | 13 #include "ui/views/controls/link_listener.h" |
| 14 #include "ui/views/view.h" | 14 #include "ui/views/view.h" |
| 15 #include "webkit/forms/password_form.h" | 15 #include "webkit/forms/password_form.h" |
| 16 | 16 |
| 17 namespace autofill { |
| 18 class PasswordGenerator; |
| 19 } |
| 20 |
| 17 namespace content { | 21 namespace content { |
| 18 class PageNavigator; | 22 class PageNavigator; |
| 19 class RenderViewHost; | 23 class RenderViewHost; |
| 20 } | 24 } |
| 21 | 25 |
| 22 namespace views { | 26 namespace views { |
| 23 class TextButton; | 27 class TextButton; |
| 24 class Textfield; | 28 class Textfield; |
| 25 } | 29 } |
| 26 | 30 |
| 27 class PasswordManager; | 31 class PasswordManager; |
| 28 | 32 |
| 29 // PasswordGenerationBubbleView is a bubble used to show possible generated | 33 // PasswordGenerationBubbleView is a bubble used to show possible generated |
| 30 // passwords to users. It is set in the page content, anchored at |anchor_rect|. | 34 // passwords to users. It is set in the page content, anchored at |anchor_rect|. |
| 31 // If the generated password is accepted by the user, the renderer associated | 35 // If the generated password is accepted by the user, the renderer associated |
| 32 // with |render_view_host| and the |password_manager| are informed. | 36 // with |render_view_host| and the |password_manager| are informed. |
| 33 class PasswordGenerationBubbleView : public views::BubbleDelegateView, | 37 class PasswordGenerationBubbleView : public views::BubbleDelegateView, |
| 34 public views::ButtonListener, | 38 public views::ButtonListener, |
| 35 public views::LinkListener { | 39 public views::LinkListener { |
| 36 public: | 40 public: |
| 37 PasswordGenerationBubbleView(const gfx::Rect& anchor_rect, | 41 PasswordGenerationBubbleView(const gfx::Rect& anchor_rect, |
| 38 const webkit::forms::PasswordForm& form, | 42 const webkit::forms::PasswordForm& form, |
| 39 views::View* anchor_view, | 43 views::View* anchor_view, |
| 40 content::RenderViewHost* render_view_host, | 44 content::RenderViewHost* render_view_host, |
| 45 autofill::PasswordGenerator* password_generator, |
| 41 content::PageNavigator* navigator, | 46 content::PageNavigator* navigator, |
| 42 PasswordManager* password_manager); | 47 PasswordManager* password_manager); |
| 43 virtual ~PasswordGenerationBubbleView(); | 48 virtual ~PasswordGenerationBubbleView(); |
| 44 | 49 |
| 45 private: | 50 private: |
| 46 // views::BubbleDelegateView | 51 // views::BubbleDelegateView |
| 47 virtual void Init() OVERRIDE; | 52 virtual void Init() OVERRIDE; |
| 48 virtual gfx::Rect GetAnchorRect() OVERRIDE; | 53 virtual gfx::Rect GetAnchorRect() OVERRIDE; |
| 49 | 54 |
| 50 // views::ButtonListener | 55 // views::ButtonListener |
| (...skipping 12 matching lines...) Expand all Loading... |
| 63 | 68 |
| 64 // Location that the bubble points to | 69 // Location that the bubble points to |
| 65 gfx::Rect anchor_rect_; | 70 gfx::Rect anchor_rect_; |
| 66 | 71 |
| 67 // The form associated with the password field(s) that we are generated. | 72 // The form associated with the password field(s) that we are generated. |
| 68 webkit::forms::PasswordForm form_; | 73 webkit::forms::PasswordForm form_; |
| 69 | 74 |
| 70 // RenderViewHost associated with the button that spawned this bubble. | 75 // RenderViewHost associated with the button that spawned this bubble. |
| 71 content::RenderViewHost* render_view_host_; | 76 content::RenderViewHost* render_view_host_; |
| 72 | 77 |
| 78 // Object to generate passwords. The class won't take the ownership of it. |
| 79 autofill::PasswordGenerator* password_generator_; |
| 80 |
| 73 // An object used to handle page loads that originate from link clicks | 81 // An object used to handle page loads that originate from link clicks |
| 74 // within this UI. | 82 // within this UI. |
| 75 content::PageNavigator* navigator_; | 83 content::PageNavigator* navigator_; |
| 76 | 84 |
| 77 // PasswordManager associated with this tab. | 85 // PasswordManager associated with this tab. |
| 78 PasswordManager* password_manager_; | 86 PasswordManager* password_manager_; |
| 79 | 87 |
| 80 // Class to generate passwords | |
| 81 autofill::PasswordGenerator password_generator_; | |
| 82 | |
| 83 DISALLOW_COPY_AND_ASSIGN(PasswordGenerationBubbleView); | 88 DISALLOW_COPY_AND_ASSIGN(PasswordGenerationBubbleView); |
| 84 }; | 89 }; |
| 85 | 90 |
| 86 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORD_GENERATION_BUBBLE_VIEW_H_ | 91 #endif // CHROME_BROWSER_UI_VIEWS_PASSWORD_GENERATION_BUBBLE_VIEW_H_ |
| OLD | NEW |