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 3 // found in the LICENSE file. 4 5 #ifndef CHROME_BROWSER_INFOBARS_INFOBAR_SERVICE_H_ 6 #define CHROME_BROWSER_INFOBARS_INFOBAR_SERVICE_H_ 7 8 #include <memory> 9 #include <vector> 10 11 #include "base/macros.h" 12 #include "build/build_config.h" 13 #include "components/infobars/content/content_infobar_manager.h" 14 #include "content/public/browser/web_contents_user_data.h" 15 16 namespace content { 17 class WebContents; 18 } 19 20 namespace infobars { 21 class InfoBar; 22 } 23 24 // //chrome's specialization of ContentInfoBarManager, which implements creation 25 // of confirm infobars and ties the lifetime of ContentInfoBarManager instances 26 // to that of the WebContents with which they are associated. 27 class InfoBarService : public infobars::ContentInfoBarManager, 28 public content::WebContentsUserData<InfoBarService> { 29 public: 30 ~InfoBarService() override; 31 32 // InfoBarManager: 33 // TODO(sdefresne): Change clients to invoke this on infobars::InfoBarManager 34 // and turn the method override private. 35 std::unique_ptr<infobars::InfoBar> CreateConfirmInfoBar( 36 std::unique_ptr<ConfirmInfoBarDelegate> delegate) override; 37 38 protected: 39 explicit InfoBarService(content::WebContents* web_contents); 40 41 private: 42 friend class content::WebContentsUserData<InfoBarService>; 43 44 // infobars::ContentInfoBarManager: 45 void WebContentsDestroyed() override; 46 47 WEB_CONTENTS_USER_DATA_KEY_DECL(); 48 49 DISALLOW_COPY_AND_ASSIGN(InfoBarService); 50 }; 51 52 #endif // CHROME_BROWSER_INFOBARS_INFOBAR_SERVICE_H_ 53