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

Side by Side Diff: chrome/renderer/autofill/password_generation_manager.h

Issue 10449099: Use shadow DOM API to show icon for password generation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 years, 6 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 | Annotate | Revision Log
OLDNEW
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 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <utility> 10 #include <utility>
11 #include <vector> 11 #include <vector>
12 12
13 #include "content/public/renderer/render_view_observer.h" 13 #include "content/public/renderer/render_view_observer.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"
16
17 namespace WebKit {
18 class WebCString;
19 class WebDocument;
20 }
15 21
16 namespace autofill { 22 namespace autofill {
17 23
18 // This class is responsible for controlling communication for password 24 // This class is responsible for controlling communication for password
19 // generation between the browser (which shows the popup and generates 25 // generation between the browser (which shows the popup and generates
20 // passwords) and WebKit (determines which fields are for account signup and 26 // passwords) and WebKit (shows the generation icon in the password field).
21 // fills in the generated passwords). Currently the WebKit part is not 27 class PasswordGenerationManager : public content::RenderViewObserver,
22 // implemented. 28 public WebKit::WebTextFieldDecoratorClient {
23 class PasswordGenerationManager : public content::RenderViewObserver {
24 public: 29 public:
25 explicit PasswordGenerationManager(content::RenderView* render_view); 30 explicit PasswordGenerationManager(content::RenderView* render_view);
26 virtual ~PasswordGenerationManager(); 31 virtual ~PasswordGenerationManager();
27 32
28 protected: 33 protected:
29 // Returns true if this frame is one that we should consider analyzing. 34 // Returns true if this document is one that we should consider analyzing.
30 // Virtual so that it can be overriden during testing. 35 // Virtual so that it can be overriden during testing.
31 virtual bool ShouldAnalyzeFrame(const WebKit::WebFrame& frame) const; 36 virtual bool ShouldAnalyzeDocument(const WebKit::WebDocument& document) const;
32 37
33 // RenderViewObserver: 38 // RenderViewObserver:
34 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 39 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
35 40
36 private: 41 private:
37 // RenderViewObserver: 42 // RenderViewObserver:
38 virtual void DidFinishDocumentLoad(WebKit::WebFrame* frame) OVERRIDE; 43 virtual void DidFinishDocumentLoad(WebKit::WebFrame* frame) OVERRIDE;
39 virtual void FocusedNodeChanged(const WebKit::WebNode& node) OVERRIDE; 44
45 // WebTextFieldDecoratorClient:
46 virtual bool shouldAddDecorationTo(
47 const WebKit::WebInputElement& element) OVERRIDE;
48 virtual bool visibleByDefault() OVERRIDE;
49 virtual WebKit::WebCString imageNameForNormalState() OVERRIDE;
50 virtual WebKit::WebCString imageNameForDisabledState() OVERRIDE;
51 virtual WebKit::WebCString imageNameForReadOnlyState() OVERRIDE;
52 virtual void handleClick(WebKit::WebInputElement& element) OVERRIDE;
53 virtual void willDetach(const WebKit::WebInputElement&) OVERRIDE;
40 54
41 // Message handlers. 55 // Message handlers.
42 void OnPasswordAccepted(const string16& password); 56 void OnPasswordAccepted(const string16& password);
43 void OnPasswordGenerationEnabled(bool enabled); 57 void OnPasswordGenerationEnabled(bool enabled);
44 58
45 // True if password generation is enabled for the profile associated 59 // True if password generation is enabled for the profile associated
46 // with this renderer. 60 // with this renderer.
47 bool enabled_; 61 bool enabled_;
48 62
49 std::pair<WebKit::WebInputElement, 63 std::vector<WebKit::WebInputElement> passwords_;
50 std::vector<WebKit::WebInputElement> > account_creation_elements_;
51 64
52 DISALLOW_COPY_AND_ASSIGN(PasswordGenerationManager); 65 DISALLOW_COPY_AND_ASSIGN(PasswordGenerationManager);
53 }; 66 };
54 67
55 } // namespace autofill 68 } // namespace autofill
56 69
57 #endif // CHROME_RENDERER_AUTOFILL_PASSWORD_GENERATION_MANAGER_H_ 70 #endif // CHROME_RENDERER_AUTOFILL_PASSWORD_GENERATION_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698