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

Side by Side Diff: components/infobars/core/confirm_infobar_delegate_factory.h

Issue 812823002: Remove dependency of infobars component on the embedder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tests by instanciating a TestConfirmInfoBarDelegateFactory Created 6 years 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
OLDNEW
(Empty)
1 // Copyright 2014 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 COMPONENTS_INFOBARS_CORE_CONFIRM_INFOBAR_DELEGATE_FACTORY_H_
6 #define COMPONENTS_INFOBARS_CORE_CONFIRM_INFOBAR_DELEGATE_FACTORY_H_
7
8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h"
10
11 namespace infobars {
12 class InfoBar;
13 }
14
15 class ConfirmInfoBarDelegate;
16
17 // ConfirmInfoBarDelegateFactory is an abstract singleton allowing the embedder
18 // to inject an implementation of |ConfirmInfoBarDelegate::CreateInfoBar()|.
19 class ConfirmInfoBarDelegateFactory {
20 public:
21 // Sets the global instance returned by |GetInstance|. The embedder owns the
22 // |instance| and is responsible for calling SetInstance(nullptr) before
23 // destroying it. Must be called before any method in infobars component.
24 static void SetInstance(ConfirmInfoBarDelegateFactory* instance);
25
26 protected:
27 ConfirmInfoBarDelegateFactory();
28 virtual ~ConfirmInfoBarDelegateFactory();
29
30 // Returns the global ConfirmInfoBarDelegateFactory instance.
31 static ConfirmInfoBarDelegateFactory* GetInstance();
32
33 private:
34 // ConfirmInfoBarDelegate is the sole client of this factory. To keep the
35 // interface sealed, all methods are private and the class is marked as a
36 // friend.
37 friend class ConfirmInfoBarDelegate;
38
39 // Returns a confirm infobar that owns |delegate|
40 virtual scoped_ptr<infobars::InfoBar> CreateInfoBar(
41 scoped_ptr<ConfirmInfoBarDelegate> delegate) = 0;
42
43 DISALLOW_COPY_AND_ASSIGN(ConfirmInfoBarDelegateFactory);
44 };
45
46 #endif // COMPONENTS_INFOBARS_CORE_CONFIRM_INFOBAR_DELEGATE_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698