| 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_RENDERER_AUTOFILL_PASSWORD_GENERATION_MANAGER_H_ | 5 #ifndef CHROME_RENDERER_AUTOFILL_PASSWORD_GENERATION_MANAGER_H_ |
| 6 #define CHROME_RENDERER_AUTOFILL_PASSWORD_GENERATION_MANAGER_H_ | 6 #define CHROME_RENDERER_AUTOFILL_PASSWORD_GENERATION_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "content/public/renderer/render_view_observer.h" | 12 #include "content/public/renderer/render_view_observer.h" |
| 13 #include "googleurl/src/gurl.h" | 13 #include "googleurl/src/gurl.h" |
| 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" |
| 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextFieldDecorator
Client.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextFieldDecorator
Client.h" |
| 16 | 16 |
| 17 namespace WebKit { | 17 namespace WebKit { |
| 18 class WebCString; | 18 class WebCString; |
| 19 class WebDocument; | 19 class WebDocument; |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace webkit { | 22 namespace content { |
| 23 namespace forms { | |
| 24 struct PasswordForm; | 23 struct PasswordForm; |
| 25 } // namespace forms | 24 } |
| 26 } // namespace webkit | |
| 27 | 25 |
| 28 namespace autofill { | 26 namespace autofill { |
| 29 | 27 |
| 30 // This class is responsible for controlling communication for password | 28 // This class is responsible for controlling communication for password |
| 31 // generation between the browser (which shows the popup and generates | 29 // generation between the browser (which shows the popup and generates |
| 32 // passwords) and WebKit (shows the generation icon in the password field). | 30 // passwords) and WebKit (shows the generation icon in the password field). |
| 33 class PasswordGenerationManager : public content::RenderViewObserver, | 31 class PasswordGenerationManager : public content::RenderViewObserver, |
| 34 public WebKit::WebTextFieldDecoratorClient { | 32 public WebKit::WebTextFieldDecoratorClient { |
| 35 public: | 33 public: |
| 36 explicit PasswordGenerationManager(content::RenderView* render_view); | 34 explicit PasswordGenerationManager(content::RenderView* render_view); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 53 virtual bool shouldAddDecorationTo( | 51 virtual bool shouldAddDecorationTo( |
| 54 const WebKit::WebInputElement& element) OVERRIDE; | 52 const WebKit::WebInputElement& element) OVERRIDE; |
| 55 virtual bool visibleByDefault() OVERRIDE; | 53 virtual bool visibleByDefault() OVERRIDE; |
| 56 virtual WebKit::WebCString imageNameForNormalState() OVERRIDE; | 54 virtual WebKit::WebCString imageNameForNormalState() OVERRIDE; |
| 57 virtual WebKit::WebCString imageNameForDisabledState() OVERRIDE; | 55 virtual WebKit::WebCString imageNameForDisabledState() OVERRIDE; |
| 58 virtual WebKit::WebCString imageNameForReadOnlyState() OVERRIDE; | 56 virtual WebKit::WebCString imageNameForReadOnlyState() OVERRIDE; |
| 59 virtual void handleClick(WebKit::WebInputElement& element) OVERRIDE; | 57 virtual void handleClick(WebKit::WebInputElement& element) OVERRIDE; |
| 60 virtual void willDetach(const WebKit::WebInputElement& element) OVERRIDE; | 58 virtual void willDetach(const WebKit::WebInputElement& element) OVERRIDE; |
| 61 | 59 |
| 62 // Message handlers. | 60 // Message handlers. |
| 63 void OnFormNotBlacklisted(const webkit::forms::PasswordForm& form); | 61 void OnFormNotBlacklisted(const content::PasswordForm& form); |
| 64 void OnPasswordAccepted(const string16& password); | 62 void OnPasswordAccepted(const string16& password); |
| 65 void OnPasswordGenerationEnabled(bool enabled); | 63 void OnPasswordGenerationEnabled(bool enabled); |
| 66 | 64 |
| 67 // Helper function to decide whether we should show password generation icon. | 65 // Helper function to decide whether we should show password generation icon. |
| 68 void MaybeShowIcon(); | 66 void MaybeShowIcon(); |
| 69 | 67 |
| 70 content::RenderView* render_view_; | 68 content::RenderView* render_view_; |
| 71 | 69 |
| 72 // True if password generation is enabled for the profile associated | 70 // True if password generation is enabled for the profile associated |
| 73 // with this renderer. | 71 // with this renderer. |
| 74 bool enabled_; | 72 bool enabled_; |
| 75 | 73 |
| 76 // Stores the origin of the account creation form we detected. | 74 // Stores the origin of the account creation form we detected. |
| 77 GURL account_creation_form_origin_; | 75 GURL account_creation_form_origin_; |
| 78 | 76 |
| 79 // Stores the origins of the password forms confirmed not to be blacklisted | 77 // Stores the origins of the password forms confirmed not to be blacklisted |
| 80 // by the browser. A form can be blacklisted if a user chooses "never save | 78 // by the browser. A form can be blacklisted if a user chooses "never save |
| 81 // passwords for this site". | 79 // passwords for this site". |
| 82 std::vector<GURL> not_blacklisted_password_form_origins_; | 80 std::vector<GURL> not_blacklisted_password_form_origins_; |
| 83 | 81 |
| 84 std::vector<WebKit::WebInputElement> passwords_; | 82 std::vector<WebKit::WebInputElement> passwords_; |
| 85 | 83 |
| 86 DISALLOW_COPY_AND_ASSIGN(PasswordGenerationManager); | 84 DISALLOW_COPY_AND_ASSIGN(PasswordGenerationManager); |
| 87 }; | 85 }; |
| 88 | 86 |
| 89 } // namespace autofill | 87 } // namespace autofill |
| 90 | 88 |
| 91 #endif // CHROME_RENDERER_AUTOFILL_PASSWORD_GENERATION_MANAGER_H_ | 89 #endif // CHROME_RENDERER_AUTOFILL_PASSWORD_GENERATION_MANAGER_H_ |
| OLD | NEW |