1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_MANAGER_DELEGATE_H_ 6 #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_MANAGER_DELEGATE_H_ 7 #pragma once 8 9 namespace webkit_glue { 10 struct PasswordFormFillData; 11 } // namespace webkit_glue 12 13 class PasswordFormManager; 14 class Profile; 15 16 // An abstraction of operations in the external environment (TabContents) 17 // that the PasswordManager depends on. This allows for more targeted 18 // unit testing. 19 class PasswordManagerDelegate { 20 public: 21 PasswordManagerDelegate() {} 22 virtual ~PasswordManagerDelegate() {} 23 24 // Fill forms matching |form_data| in |tab_contents|. By default, goes 25 // through the RenderViewHost to FillPasswordForm. Tests can override this 26 // to sever the dependency on the entire rendering stack. 27 virtual void FillPasswordForm( 28 const webkit_glue::PasswordFormFillData& form_data) = 0; 29 30 // A mechanism to show an infobar in the current tab at our request. 31 virtual void AddSavePasswordInfoBar(PasswordFormManager* form_to_save) = 0; 32 33 // Get the profile for which we are managing passwords. 34 virtual Profile* GetProfileForPasswordManager() = 0; 35 36 // If any SSL certificate errors were encountered as a result of the last 37 // page load. 38 virtual bool DidLastPageLoadEncounterSSLErrors() = 0; 39 40 private: 41 DISALLOW_COPY_AND_ASSIGN(PasswordManagerDelegate); 42 }; 43 44 45 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_MANAGER_DELEGATE_H_ 46