This source file includes following definitions.
- CreateFocusManager
- Create
- Install
#include "ui/views/focus/focus_manager_factory.h"
#include "base/compiler_specific.h"
#include "ui/views/focus/focus_manager.h"
namespace views {
namespace {
class DefaultFocusManagerFactory : public FocusManagerFactory {
public:
DefaultFocusManagerFactory() : FocusManagerFactory() {}
virtual ~DefaultFocusManagerFactory() {}
protected:
virtual FocusManager* CreateFocusManager(Widget* widget,
bool desktop_widget) OVERRIDE {
return new FocusManager(widget, NULL );
}
private:
DISALLOW_COPY_AND_ASSIGN(DefaultFocusManagerFactory);
};
FocusManagerFactory* focus_manager_factory = NULL;
}
FocusManagerFactory::FocusManagerFactory() {
}
FocusManagerFactory::~FocusManagerFactory() {
}
FocusManager* FocusManagerFactory::Create(Widget* widget,
bool desktop_widget) {
if (!focus_manager_factory)
focus_manager_factory = new DefaultFocusManagerFactory();
return focus_manager_factory->CreateFocusManager(widget, desktop_widget);
}
void FocusManagerFactory::Install(FocusManagerFactory* f) {
if (f == focus_manager_factory)
return;
delete focus_manager_factory;
focus_manager_factory = f ? f : new DefaultFocusManagerFactory();
}
}