This source file includes following definitions.
- Observe
#include "chrome/browser/ui/views/load_complete_listener.h"
#include "base/logging.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_types.h"
LoadCompleteListener::LoadCompleteListener(Delegate* delegate)
: delegate_(delegate) {
DCHECK(delegate);
registrar_.Add(this, content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME,
content::NotificationService::AllSources());
}
LoadCompleteListener::~LoadCompleteListener() {
if (registrar_.IsRegistered(this,
content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME,
content::NotificationService::AllSources())) {
registrar_.Remove(this, content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME,
content::NotificationService::AllSources());
}
}
void LoadCompleteListener::Observe(
int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
DCHECK_EQ(content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, type);
delegate_->OnLoadCompleted();
registrar_.Remove(this, content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME,
content::NotificationService::AllSources());
}